diff --git a/libisoburn/branches/1.1.8/AUTHORS b/libisoburn/branches/1.1.8/AUTHORS new file mode 100644 index 00000000..0547ea18 --- /dev/null +++ b/libisoburn/branches/1.1.8/AUTHORS @@ -0,0 +1,3 @@ +Thomas Schmitt +Vreixo Formoso Lopes + diff --git a/libisoburn/branches/1.1.8/CONTRIBUTORS b/libisoburn/branches/1.1.8/CONTRIBUTORS new file mode 100644 index 00000000..e69de29b diff --git a/libisoburn/branches/1.1.8/COPYING b/libisoburn/branches/1.1.8/COPYING new file mode 100644 index 00000000..5a965fbc --- /dev/null +++ b/libisoburn/branches/1.1.8/COPYING @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/libisoburn/branches/1.1.8/COPYRIGHT b/libisoburn/branches/1.1.8/COPYRIGHT new file mode 100644 index 00000000..cf623700 --- /dev/null +++ b/libisoburn/branches/1.1.8/COPYRIGHT @@ -0,0 +1,18 @@ +Mario Danic , +Vreixo Formoso +Thomas Schmitt +libisoburn is Copyright (C) 2007-2011 Vreixo Formoso, Thomas Schmitt +xorriso is Copyright (C) 2007-2011 Thomas Schmitt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + or later as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/libisoburn/branches/1.1.8/ChangeLog b/libisoburn/branches/1.1.8/ChangeLog new file mode 100644 index 00000000..5add052b --- /dev/null +++ b/libisoburn/branches/1.1.8/ChangeLog @@ -0,0 +1,502 @@ +SVN trunk (to become libisoburn-1.1.8.tar.gz) +=============================================================================== +* Bug fix: libburn misinterpreted mode page 2A if block descriptors are present +* New option -sleep +* Info document and man page for xorrecord + + +libisoburn-1.1.6.tar.gz Tue Sep 27 2011 +=============================================================================== +* Bug fix: -extract_single extracted directory content +* Bug fix: -extract was not immediately aborted if -abort_on was triggered +* Bug fix: xorriso did not write to files in filesystems with >= 4 TB free space +* Bug fix: libisofs: ACL entries of groups and of user id 0 were not properly + recorded and cannot be restored +* Bug fix: libisofs: No ACLs were recorded on FreeBSD +* Enabled recording and restoring of extattr on FreeBSD. +* New option -list_extras +* New -osirrox option strict_acl +* New -find and -findx action list_extattr +* Workaround for collision with Linux udev which lets device links vanish + +libisoburn-1.1.4.tar.gz Mon Aug 8 2011 +=============================================================================== +* Bug fix: xorriso native mode on some drives wrote unreadble ISO images to CD +* Bug fix: -assert_volid did not work. Regression since version 1.1.0. +* Bug fix: -acl or -xattr worked with -extract only on Linux and FreeBSD +* New option -device_links + +libisoburn-1.1.2.tar.gz Fri Jul 8 2011 +=============================================================================== +* Bug fix: Since 1.0.6: Unreadable image produced by: xorrisofs ... >image.iso +* Bug fix: -update_r scheduled non-existing files for hardlink update +* Enabled extraction of the boot catalog file to disk filesystem +* New option -list_speeds + +GNU xorriso-1.1.0.pl01.tar.gz Mon Jun 20 2011 +=============================================================================== +* Bug fix: Due to a bug in libburn-1.1.0, GNU xorriso-1.1.0 compiled only + on GNU/Linux, FreeBSD, and Solaris, but not on other systems. + +libisoburn-1.1.0.tar.gz Sat Jun 18 2011 +=============================================================================== +* Bug fix: -mount_opts shared worked only with -osirrox o_excl_off +* Bug fix: xorriso command -add_plainly "any" did not add all files to the image +* Bug fix: The attempt to blank already blank DVD-RW was not gracefully blocked +* Bug fix: -as mkisofs -isohybrid-mbr without -no-pad was not cylinder aligned +* New option -signal_handling +* New option -close_damaged +* Dropped suffix .plXY from tarball name + +libisoburn-1.0.8.pl00.tar.gz Thu Apr 14 2011 +=============================================================================== +* Bug fix: mkisofs emulation could ignore options (regression in 0.1.6) + +libisoburn-1.0.6.pl00.tar.gz Sat Apr 9 2011 +=============================================================================== +* Bug fix: -as mkisofs padding did not work (regression in 1.0.4) +* Bug fix: Options -gid and -uid had no effect +* New API call isoburn_set_truncate() +* New relax option isoburn_igopt_joliet_long_names +* New option -early_stdio_test +* New options -print_info and -print_mark +* New -compliance option joliet_long_names +* -as mkisofs option -joliet-long is now fully functional +* Burning DVD-R DAO with 2 kB size granularity rather than 32 kB + +libisoburn-1.0.4.pl00.tar.gz Thu Mar 10 2011 +=============================================================================== +libisoburn novelties: +* New isoburn_ropt_set_extensions() option isoburn_ropt_nomd5tag +xorriso novelties: +* Bug fix: xorrisofs did not work under growisofs -M (version 1.0.0 was ok) +* Bug fix: -as mkisofs -C attempted to read volume header of blank media +* Bug fix: -as mkisofs -old-root did not work with -graft-points +* Bug fix: -as mkisofs -partition_hd_cyl had no effect +* Bug fix: -as mkisofs did not properly unescape target part of pathspecs +* Bug fix: isohybrid image size was not aligned to cylinder boundary +* Bug fix: Compilation without zlib failed +* New -padding modes "included" and "appended" +* New bootspec partition_cyl_align=, new -as mkisofs option -partition_cyl_align +* New -as mkisofs and -as cdrecord option --no_rc +* Own man page and info document for xorrisofs + +libisoburn-1.0.2.pl00.tar.gz Mon Feb 23 2011 +=============================================================================== +libisoburn novelties: +* Removed compiler obstacles of GNU xorriso on Solaris 9 +* New isoburn_igopt_set_extensions() option isoburn_igopt_old_empty +xorriso novelties: +* Bug fix: Images produced with -for_backup might be unreadable and + also fail -check_md5 verification. +* Bug fix: mkisofs emulation options -l , -full-iso9660-filenames did not work. +* Bug fix: Option -mkdir yielded SIGSEGV due to a NULL pointer +* Bug fix: ECMA-119 standards violation with Volume Descriptor Set Terminator +* New options -clone and -cp_clone +* New -find actions update_merge, rm_merge, clear_merge +* New -as mkisofs option -max-iso9660-filenames +* New -as mkisofs option --old-empty +* New -as mkisofs options -root , -old-root +* New -as mkisofs options --old-root-no-md5, --old-root-no-ino, --old-root-dev + +libisoburn-1.0.0.pl00.tar.gz Mon Jan 17 2011 +=============================================================================== +libisoburn novelties: +* New API call isoburn_igopt_set_untranslated_name_len() +xorriso novelties: +* Bug fix: -as mkisofs -print-size did not account for -partition_offset +* Default -abort_on value is now "FAILURE" with batch and "NEVER" with dialog +* New -compliance options untranslated_names , untranslated_name_len= +* New -as mkisofs option -untranslated_name_len +* New -compliance option iso_9660_1999, -as mkisofs option -iso-level 4 +* New -compliance option iso_9660_level=number +* New -compliance option allow_dir_id_ext, -as mkisofs -disallow_dir_id_ext +* Disabled TOC emulation with -as mkisofs. May be re-enabled by --emul-toc. + +libisoburn-0.6.6.pl00.tar.gz Sun Dec 12 2010 +=============================================================================== +libisoburn novelties: +* New API calls isoburn_igopt_set_disc_label(), isoburn_igopt_get_disc_label() +* New API calls isoburn_ropt_set_displacement(), isoburn_ropt_get_displacement() +xorriso novelties: +* Bug fix: -as mkisofs -print-size printed the size but also produced ISO image +* Build problem fix on Linux 2.4 in GNU xorriso libjte/checksum.c +* New -as mkisofs option -joliet-long +* New bootspec sparc_label=, new -as mkisofs options -sparc-boot , -sparc-label +* New option -displacement + +libisoburn-0.6.4.pl00.tar.gz Tue Oct 26 2010 +=============================================================================== +libisoburn novelties: +* New API call isoburn_libjte_req() +* New API calls isoburn_igopt_attach_jte() and isoburn_igopt_detach_jte() +* New API call isoburn_igopt_set_tail_blocks() +* New API call isoburn_libjte_req() +xorriso novelties: +* New option -jigdo +* New -as mkisofs options -jigdo-* and -md5-list as of genisoimage +* New -as mkisofs options -checksum_algorithm_iso, -checksum_algorithm_template +* New bootspecs mips_path= and mipsel_path= for Debian MIPS releases +* New -as mkisofs options -mips-boot and -mipsel-boot +* New option -append_partition, -as mkisofs -append_partition + +libisoburn-0.6.2.pl00.tar.gz Sat Sep 18 2010 +=============================================================================== +libisoburn novelties: +* New API function isoburn_igopt_set_part_offset() +* Hiding all non-API symbols from the linker by use of --version-script +* Now with history of release notes in ./ChangeLog file. +xorriso novelties: +* Bug fix: Regression with -hardlinks and -compliance old_rr, 0.4.2, Aug 2009 +* New option -preparer_id, -as mkisofs options -p and -preparer +* New -boot_image specifier emul_type=none|hard_disk|floppy +* New boot_image boot specs partition_offset,partition_hd_cyl,partition_sec_hd +* Made behavior of -as mkisofs with unknown options more similar to original +* New -as mkisofs option -hard-disk-boot, enabled -b without -no-emul-boot +* New -as mkisofs option -e from Fedora genisoimage +* New -as mkisofs options -partition_offset,-partition_hd_cyl,-partition_sec_hd + +libisoburn-0.6.0.pl00.tar.gz Fri Jul 02 2010 +=============================================================================== +libisoburn novelties: +xorriso novelties: +* New option -read_mkisofsrc interprets .mkisofsrc To be performed before -as + mkisofs. Performed automatically with program alias name "xorrisofs". +* Implemented -as mkisofs options -dir-mode, -file-mode, -abstract, -biblio, + -copyright +* Implemented -as mkisofs options -hide, -hide-joliet, -hide-list, + -hide-joliet-list +* New -as mkisofs option --boot-catalog-hide +* New option -hide, -find action -hide, -find test -hidden +* New -boot_image bootspec cat_hidden=on +* New options -copyright_file , -biblio_file , -abstract_file +* New find test -disk_name +* Enabled use of libreadline on Solaris +* Bug fix: -check_media patch_lba0= could install wrong image size +* Bug fix: -as mkisofs option -volset was wrongly interpreted like -volid + +libisoburn-0.5.8.pl00.tar.gz Mon Jun 14 2010 +=============================================================================== +libisoburn novelties: +* xorriso source split into more modules, object code moved into libisoburn +xorriso novelties: +* New write extension option isoburn_igopt_no_emul_toc +* New -compliance rule no_emul_toc, new -as mkisofs --no-emul-toc +* Implemented -as cdrecord -V +* Implemented -as mkisofs options -U, -N, -l, -d, -allow-lowercase + +libisoburn-0.5.6.pl00.tar.gz Tue May 04 2010 +=============================================================================== +libisoburn novelties: +xorriso novelties: +* Allowing up to 32 boot images +* New -boot_image bootspecs + efi_path=, platform_id=, sel_crit=, id_string=, next +* New -as mkisofs options --efi-boot, -eltorito-alt-boot + +libisoburn-0.5.4.pl00.tar.gz Mon Apr 19 2010 +=============================================================================== +libisoburn novelties: +* New API call isoburn_igopt_set_system_area() +* New API call isoburn_igopt_set_pvd_times() +* New isoburn_igopt_set_relaxed() options: only_iso_versions, no_j_force_dots + xorriso novelties: +* New -boot_image any system_area=, -as mkisofs option -G +* New -boot_image grub partition_table=on, -as mkisofs --protective-msdos-label +* New -boot_image isolinux partition_table=on, -as mkisofs -isohybrid-mbr +* New option -volume_date, -as mkisofs --modification-date= +* New -find action mkisofs_r,-as mkisofs -r +* New -find action sort_weight, -as mkisofs --sort-weight +* New -compliance options only_iso_version, no_j_force_dots avoid + a bug in GRUB 1.96. They are default now. + +libisoburn-0.5.2.pl00.tar.gz Tue Mar 30 2010 +=============================================================================== +xorriso novelties: +* xorriso documentation is now based on a hybrid format of Texinfo and man- + page. Copies included: .texi, .info, .1 (man page) + +libisoburn-0.5.0.pl00.tar.gz Tue Feb 22 2010 +=============================================================================== +xorriso novelties: +* The former xorriso-standalone project is now GNU xorriso under GPLv3+. This + affects some documentation and the generator script, but not the license of + libisoburn or its program xorriso. +* Bug fix: xorriso -update_r could lead to SIGSEGV if applied to a data file + rather than a directory. +* Bug fix on FreeBSD: xorriso could leave the drive tray locked. +* New option -scsi_log + +libisoburn-0.4.8.pl00.tar.gz Tue Jan 26 2010 +=============================================================================== +xorriso novelties: +* Bug fix: xorriso did not blank CD-RW with images that were prepared + on hard disk. +* New configure option --enable-libcdio for system adapter to libcdio-0.83git + +libisoburn-0.4.6.pl00.tar.gz Wed Dec 09 2009 +=============================================================================== +xorriso novelties: +* New options -dvd_obs and -stdio_sync +* New configure option --enable-dvd-obs-64k + +libisoburn-0.4.4.pl00.tar.gz Wed Oct 28 2009 +=============================================================================== +xorriso novelties: +* Bug fix: With -as cdrecord : -xa1 and -xamix were ignored although they do + matter. +* Option -toc now reports the individual media type. E.g. with a DVD+RW: + "Media product: RICOHJPN/W11/49 , Ricoh Company Limited" +* New option -pvd_info displays image id strings. New options -system_id , - + volset_id allow to set such image id strings. +* New option -mount_opts tries to circumvent an eventual ban to mount the same + device twice. Some Linux systems allow to mount two sessions of the same + media only if they get fooled via the loop device. +* New option -scdbackup_tag performs the task of the scdbackup MD5 checksum + filter inside xorriso. +Already fixed by patch releases of xorriso-0.4.2: +* Bug fix: -cut_out deleted previously cut-out pieces of the same file +* Bug fix libisofs: Filenames could lose blanks during a multi-session cycle +* Bug fix: -for_backup did not enable -xattr and -md5 if no drive was chosen + yet +* Bug fix: xorrisofs -help, xorrecord -help displayed original xorriso -help + +libisoburn-0.4.2.pl02.tar.gz Thu Oct 08 2009 +=============================================================================== +* Bug fix: -for_backup did not enable -xattr and -md5 if no drive was chosen + yet +* Bug fix: xorrisofs -help, xorrecord -help displayed original xorriso -help + +Libisoburn 0.4.2.pl01 +=============================================================================== +* Bug fix: xorriso option -cut_out deleted previously cut-out pieces of the + same file. The bug was introduced with release 0.1.4 in March 2008. + +Libisoburn 0.4.2 +=============================================================================== +* New write options isoburn_igopt_session_md5, isoburn_igopt_file_md5, + isoburn_igopt_file_stability allow to record MD5 checksums of session and + single data files. +* New read option isoburn_ropt_nomd5 allows to read those MD5 sums when + importing an ISO image. +xorriso novelties: +* New option -md5, new -as mkisofs option --md5 allow to record in the image + MD5 checksums for the whole session and for each single data file. +* New options -check_md5, -check_md5_r allow to verify the whole session or + single files by comparing their image data with their MD5 sums. +* Options -compare, -compare_r, -update, update_r now can use recorded MD5. +* New -find actions check_md5, get_md5, make_md5 allow to check, to display or + to recompute MD5 checksums of data files. New find test -has_md5 + distinguishes data files which have recorded MD5 from files which have none. +* New -find test -has_any_xattr and action get_any_xattr allow to inspect the + libisofs specific attributes of namespace "isofs". +* Options -lsl and lsdl now display correct link counts if -hardlinks is on. +* New option -calm_drive allows to reduce drive noise if no data reading is + intended for a while. +* New option -list_profiles allows to inquire and process the list of supported + media types. +* Bug fix: xorriso -as mkisofs did not understand the -C option of growisofs + any more. (Already fixed by release 0.4.0.pl01, 20 Jul 2009) + +libisoburn-0.4.0.pl01.tar.gz Mon Jul 20 2009 +=============================================================================== +xorriso novelties: +* New option -hardlinks enables recording and restoring of hard link relations. +* Improved reading performance with -update_r and -extract. +* New option -for_backup as shortcut for -acl -xattr -hardlinks +* Operators with option -find : -not, -or, -and, (, ), -if, -then, -else +* New -find tests -wholename, -prune +* Bug fix: SIGSEGV with option -status and no search string +* Bug fix: -load volid did not perform pattern search +* Bug fix: Copies of overwriteable media on sequential were mistaken in ROM + drives +Libisoburn 0.4.0.pl01 release notes: +* Bug fix: xorriso -as mkisofs did not understand the -C option of growisofs + any more + +libisoburn-0.3.8.pl00.tar.gz Sun Apr 19 2009 +=============================================================================== +libisoburn novelties: +* New API calls isoburn_ropt_set_auto_incharset() and + isoburn_ropt_get_auto_incharset() +xorriso novelties: +* New options -set_filter, -set_filter_r, -find -exec set_filter allow to + manipulate the content of data files on the fly. +* New option -zisofs, built-in filters --zisofs , --gzip , --gunzip enable + compression and decompression of data file content. +* New options -external_filter , -unregister_filter, -close_filter_list allow + arbitrary external processes to do content filtering. +* New options -show_stream, -show_stream_r allow to inspect the origin and the + filters of data files in an emerging image. +* New option -auto_charset based on xattr "isofs.cs" allows to tag an ISO + filesystem image with the character set name that is in use on the current + terminal. + +libisoburn-0.3.6.pl00.tar.gz Mon Mar 16 2009 +=============================================================================== +xorriso novelties: +* Dummy MMC adapter of libburn allows compilation on systems other than Linux, + FreeBSD +* Default of -compliance has been changed to "old_rr", new rule "new_rr" +* New -stream_recording modes with start address or "data". "on" is now 32s. + +libisoburn-0.3.4.pl00.tar.gz Sun Mar 01 2009 +=============================================================================== +* New isoburn_read_opts values: isoburn_ropt_noaaip, isoburn_ropt_noacl, + isoburn_ropt_noea +xorriso novelties: +* New option -acl enables ACL import and export +* New options -getfacl, -getfacl_r, -setfacl, -setfacl_r, -setfacl_list +* New find tests -has_acl, -has_no_acl , new find actions getfacl, setfacl +* New option -xattr enables import and export of Extended Attributes +* New options -getfattr, -getfattr_r, -setfattr, -setfattr_r, -setfattr_list +* New find tests -has_xattr, -has_aaip, new find actions getfattr, setfattr +* New -as mkisofs options --acl and --xattr +* New option -disk_dev_ino accelerates incremental backups + +libisoburn-0.3.2.pl00.tar.gz Tue Jan 06 2009 +=============================================================================== +* New API function isoburn_get_mount_params() +* Now depending on libburn-0.6.0 which supports BD-R media +xorriso novelties: +* Bug fix: Options -extract and -extract_single were enabled with -osirrox off +* New options -mount , -mount_cmd , -session_string +* New -format modes by_size_ and fast_by_size_ +* New option -assert_volid +* New option -drive_class for safety management of pseudo-drive access + +libisoburn-0.3.0.pl00.tar.gz Tue Dec 2 2008 +=============================================================================== +* Now depending on libisofs-0.6.12 and libburn-0.5.6 to ensure use of their + recent bug fixes +xorriso novelties: +* New options -quoted_path_list, -quoted_not_list +* New option -backslash_codes for weird file names and terminal safety +* New options -charset, -in_charset, -out_charset +* New option -local_charset allows to override locale +* New option -application_id +* New option -compliance allows certain deviations from standards +* Suitable ISOLINUX boot images are made alternatively bootable via an MBR +* Bug fix: Forgot exit value registration to -return_with. + Thanks to Steve Dodd. +* Bug fix: -format as_needed did not recognize unformatted BD-RE +* Bug fix: disk patterns with relative addresses were not properly resolved + +libisoburn-0.2.8.pl00.tar.gz Wed Oct 15 2008 +=============================================================================== +* Now depending on libisofs-0.6.10 and libburn-0.5.4 to ensure use of their + recent bug fixes +xorriso novelties: +* Ability to write and maintain bootable ISO images based on ISOLINUX +* New ./configure option --disable-libreadline to make binary more portable +* Bug fix: -as mkisofs -iso-level was accused to be an unknown option +* Bug fix: -follow link attributed random target filenames to looping links + +libisoburn-0.2.6.pl00.tar.gz Sat Sep 20 2008 +=============================================================================== +xorriso novelties: +* Capability to insert and extract files far larger than 4 GB +* New option -file_size_limit, -as mkisofs now supports -iso-level 1 to 3 +* New option -extract_cut +* New -error_behavior "file_extraction" behavior "best_effort" +* New option -check_media_defaults +* New option -list_delimiter +* Bug fix: -format full did not re-format already formatted DVD+RW + +libisoburn-0.2.4.pl00.tar.gz Mo Aug 25 2008 +=============================================================================== +xorriso novelties: +* New option -check_media +* New -find test -damaged, new -find actions "report_damage", "report_lba" +* New -error_behavior occasion "file_extraction" + +libisoburn-0.2.2.pl01.tar.gz Fr Jul 25 2008 +=============================================================================== +Libisoburn 0.2.2 release notes (Jul 19 2008) +* New API function isoburn_prepare_blind_grow() +* New flag bits with isoburn_set_msc1(), isoburn_read_iso_head() +xorriso novelties: +* New option -grow_blindly +* Options -C and -M for -as mkisofs emulation +* Options for -as cdrecord emulation: -multi, -msinfo, -isosize, tsize, -- + grow_overwriteable_iso, write_start_address, +* New option -pacifier, more compatible pacifier with -as mkisofs +* make install creates aliases as symbolic links: osirrox, xorrisofs, xorrecord +* Can serve growisofs if started as xorrisofs, genisofs, mkisofs, genisoimage +pl01 changes (Jul 25 2008): +* Bug fix: Variable DESTDIR was not properly respected during make install + +libisoburn-0.2.0.pl00.tar.gz Mon Jun 23 2008 +=============================================================================== +Libisoburn 0.2.0 release notes: +* New API functions isoburn_set_msgs_submit(), isoburn_drive_set_msgs_submit() +xorriso novelties: +* Bug fix: -chmod unintentionally performed o-x as first operation +* New options -cpax, -cp_rx, -cp_rax, -extract to restore files and trees from + ISO image to disk filesystem. +* New option -paste_in to copy ISO files into parts of disk files +* New options -map_l, -compare_l, -update_l, -extract_l + +libisoburn-0.1.8.pl00.tar.gz Tue Jun 3 2008 +=============================================================================== +* Bug fix: Major,minor numbers of device files appeared as 0,1 in next session +* Bug fix: modifying to overwriteable target yielded unmountable results +xorriso novelties: +* New option -stream_recording for full speed with DVD-RAM and BD-RE +* New options -osirrox and -cpx allow to extract single files from ISO image + +libisoburn-0.1.6.pl00.tar.gz Mon May 19 2008 +=============================================================================== +* Support for BD-RE (by depending on libburn-0.4.8) +* New API wrapper calls isoburn_toc_*() around libburn TOC inquiry calls +* New API call isoburn_read_iso_head() identifies ISO 9660 filesystems +* New API call isoburn_set_msc1() (like mount -o sbsector=) +xorriso novelties: +* Bug fix: -update_r and others did not work properly with relative paths +* New options -map and -map_single +* New options -not_paths, -not_leaf, -not_list, -not_mgt, -as mkisofs -m +* Emulated -toc on overwriteable media, new -toc layout with volume id +* New option -load makes alternative sessions accessible +* New -blank and -format modes 'as_needed' +* New option -list_formats and -format mode 'by_index_' + +libisoburn-0.1.4.pl00.tar.gz Wed Apr 30 2008 +=============================================================================== +* Improved performance with reading directory trees +* xorriso: Improved attribute transfer from disk for target +* xorriso: Incremental backup functionality by new option -update_r +* xorriso: Options -cut_out and split_size map byte intervals of oversized + files into ISO files +* xorriso: Emulation of some basic mkisofs and cdrecord options +* Dynamically linkable with release version 0.6.4 of libisofs + +Version 0.1.2 was not released as libisoburn +but only as xorriso standalone version. Wed Mar 12 2008 +=============================================================================== +* Bug fix: -report_about HINT or higher did not report at all +* Bug fix: speed=number without unit or media type letter was always CD speed +* Bug fix: it was possible to write to appendable media which was not -indev +* Bug fix: -follow param did not work for adding non-directory symbolic links +* Bug fix: It was not possible to -add /THIS=a /b=THIS +* Improved attribute transfer from disk for implicit target directories +* New option -as "cdrecord" emulates a narrow set of cdrecord gestures +* New option -as "mkisofs" emulates a narrow set of mkisofs gestures +* New option -publisher +* New option -errfile_log +* Support for DVD+R/DL media +* New options -compare, -compare_r and according -find -exec action +* New options -update, -update_r and according -find -exec action +* New -find actions "rm", "rm_r", new -findx -type "m" -exec "empty_iso_dir" +* New option -cut_out + +libisoburn-0.1.0.pl01.tar.gz Fri Feb 15 2008 +=============================================================================== +* Initial release of libisoburn/xorriso +* libisoburn connects libisofs and libburn +* libisoburn emulates multi-session on media without session history +* xorriso is an integrated multi-session tool for ISO 9660 Rock Ridge images +* due to a subtle mistake in ABI usage with libisofs this release had to be + restricted to dynamic linking with exactly libisofs-0.6.2 where the mistake + does no harm. A version of libisoburn which is open to all future libisofs + versions will be released shortly after libisofs.0.6.4. + diff --git a/libisoburn/branches/1.1.8/INSTALL b/libisoburn/branches/1.1.8/INSTALL new file mode 100644 index 00000000..a6580e5a --- /dev/null +++ b/libisoburn/branches/1.1.8/INSTALL @@ -0,0 +1,237 @@ + +See file README for libisoburn and xorriso specific installation instructions. +This file here is rather a manual for advanced usage of ./configure + +------------------------------------------------------------------- + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006 Free Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/libisoburn/branches/1.1.8/Makefile.am b/libisoburn/branches/1.1.8/Makefile.am new file mode 100644 index 00000000..687ec9ba --- /dev/null +++ b/libisoburn/branches/1.1.8/Makefile.am @@ -0,0 +1,271 @@ + +# ts A90315 : LIBBURNIA_PKGCONFDIR is defined OS specific in acinclude.m4 +# was: pkgconfigdir=$(libdir)/pkgconfig +pkgconfigdir=$(LIBBURNIA_PKGCONFDIR) + +libincludedir=$(includedir)/libisoburn + +lib_LTLIBRARIES = libisoburn/libisoburn.la +ACLOCAL_AMFLAGS = -I ./ + +## ========================================================================= ## + +# Build libraries +libisoburn_libisoburn_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +libisoburn_libisoburn_la_SOURCES = \ + libisoburn/isoburn.h \ + libisoburn/libisoburn.h \ + libisoburn/burn_wrap.c \ + libisoburn/data_source.c \ + libisoburn/isoburn.c \ + libisoburn/isofs_wrap.c \ +\ + xorriso/xorriso.h \ + xorriso/xorriso_private.h \ + xorriso/sfile.h \ + xorriso/sfile.c \ + xorriso/aux_objects.h \ + xorriso/aux_objects.c \ + xorriso/findjob.h \ + xorriso/findjob.c \ + xorriso/check_media.h \ + xorriso/check_media.c \ + xorriso/misc_funct.h \ + xorriso/misc_funct.c \ + xorriso/text_io.h \ + xorriso/text_io.c \ + xorriso/match.h \ + xorriso/match.c \ + xorriso/emulators.h \ + xorriso/emulators.c \ + xorriso/disk_ops.h \ + xorriso/disk_ops.c \ + xorriso/cmp_update.h \ + xorriso/cmp_update.c \ + xorriso/parse_exec.h \ + xorriso/parse_exec.c \ + xorriso/opts_a_c.c \ + xorriso/opts_d_h.c \ + xorriso/opts_i_o.c \ + xorriso/opts_p_z.c \ +\ + xorriso/xorrisoburn.h \ + xorriso/base_obj.h \ + xorriso/base_obj.c \ + xorriso/lib_mgt.h \ + xorriso/lib_mgt.c \ + xorriso/sort_cmp.h \ + xorriso/sort_cmp.c \ + xorriso/drive_mgt.h \ + xorriso/drive_mgt.c \ + xorriso/iso_img.h \ + xorriso/iso_img.c \ + xorriso/iso_tree.h \ + xorriso/iso_tree.c \ + xorriso/iso_manip.h \ + xorriso/iso_manip.c \ + xorriso/write_run.h \ + xorriso/write_run.c \ + xorriso/read_run.h \ + xorriso/read_run.c \ + xorriso/filters.h \ + xorriso/filters.c \ + xorriso/xorriso_timestamp.h \ + xorriso/xorriso_buildstamp.h \ + version.h + +libisoburn_libisoburn_la_LIBADD = \ + -lisofs \ + -lburn + +libinclude_HEADERS = \ + libisoburn/libisoburn.h \ + xorriso/xorriso.h + +# libisoburn_libisoburn_la_CFLAGS = $(READLINE_DEF) $(LIBACL_DEF) $(XATTR_DEF) \ +# $(EXTF_DEF) $(EXTF_SUID_DEF) $(ZLIB_DEF) \ +# $(XORRISO_DVD_OBS_64K) + +## ========================================================================= ## + + +# This is the reference application of libisoburn. See man xorriso/xorriso.1 +# +bin_PROGRAMS = \ + xorriso/xorriso + +# This looks quite ugly with make install: xorriso.c is compiled twice again +# +# Trying to create a build timestamp file +# +# BUILT_SOURCES = xorriso/xorriso_buildstamp.h +# +# phony targets get rebuilt every time +# +# .PHONY: xorriso/xorriso_buildstamp.h +# xorriso/xorriso_buildstamp.h: +# date -u '+#define Xorriso_build_timestamP "%Y.%m.%d.%H%M%S"' >xorriso/xorriso_buildstamp.h +# cat xorriso/xorriso_buildstamp.h + +xorriso_xorriso_CPPFLAGS = -Ilibisoburn +# xorriso_xorriso_CFLAGS = $(READLINE_DEF) $(LIBACL_DEF) $(XATTR_DEF) \ +# $(EXTF_DEF) $(EXTF_SUID_DEF) $(ZLIB_DEF) \ +# $(XORRISO_DVD_OBS_64K) + +xorriso_xorriso_LDADD = libisoburn/libisoburn.la -lisofs -lburn \ + $(THREAD_LIBS) $(LIBBURN_ARCH_LIBS) + +xorriso_xorriso_SOURCES = \ + xorriso/xorriso.h \ + xorriso/xorriso_main.c + + +# Install symbolic links to the xorriso binary +# +install-exec-hook: + if test -e "$(DESTDIR)$(bindir)"/xorrisofs ; then rm "$(DESTDIR)$(bindir)"/xorrisofs ; else echo ; fi + ln -s xorriso "$(DESTDIR)$(bindir)"/xorrisofs + if test -e "$(DESTDIR)$(bindir)"/osirrox ; then rm "$(DESTDIR)$(bindir)"/osirrox ; else echo ; fi + ln -s xorriso "$(DESTDIR)$(bindir)"/osirrox + if test -e "$(DESTDIR)$(bindir)"/xorrecord ; then rm "$(DESTDIR)$(bindir)"/xorrecord ; else echo ; fi + ln -s xorriso "$(DESTDIR)$(bindir)"/xorrecord + $(LIBBURNIA_LDCONFIG_CMD) "$(DESTDIR)$(libdir)" || echo 'NOTE: Explicite dynamic library configuration failed. If needed, configure manually for:' "$(DESTDIR)$(libdir)" + + +# Alternative to the disabled .PHONY above. +# Trying to create a build timestamp file semi-manually: make buildstamped +# +buildstamp: + date -u '+#define Xorriso_build_timestamP "%Y.%m.%d.%H%M%S"' >xorriso/xorriso_buildstamp.h + cat xorriso/xorriso_buildstamp.h + +# For now make buildstamped has to be performed explicitely. +buildstamped: buildstamp + make + + + +## Build companion applications +noinst_PROGRAMS = \ + test/compare_file \ + xorriso/make_xorriso_1 + +# A program to compare two files in mirrored trees in mounted filesystems +# To compare tree /media/dvd and /original/dir : +# find /media/dvd -exec test/compare_file '{}' /media/dvd /original/dir ';' +# +test_compare_file_CPPFLAGS = +test_compare_file_CFLAGS = +test_compare_file_LDADD = +test_compare_file_SOURCES = test/compare_file.c + +# Specialized converter from xorriso/xorriso.texi to xorriso/xorriso.1 +# +xorriso_make_xorriso_1_CPPFLAGS = +xorriso_make_xorriso_1_CFLAGS = +xorriso_make_xorriso_1_LDADD = +xorriso_make_xorriso_1_SOURCES = xorriso/make_xorriso_1.c + +## ========================================================================= ## + +## Build documentation (You need Doxygen for this to work) +webhost = http://libburn-api.pykix.org +webpath = / +docdir = $(DESTDIR)$(prefix)/share/doc/$(PACKAGE)-$(VERSION) + +doc: doc/html + +doc/html: doc/doxygen.conf + if [ -f ./doc/doc.lock ]; then \ + $(RM) -r doc/html; \ + doxygen doc/doxygen.conf; \ + fi + +doc-upload: doc/html + scp -r $ + and Thomas Schmitt +Integrated sub project of libburnia-project.org. +http://files.libburnia-project.org/releases/libisoburn-1.1.6.tar.gz +Copyright (C) 2006-2011 Vreixo Formoso, Thomas Schmitt. +Provided under GPL version 2 or later. +------------------------------------------------------------------------------ + +libisoburn is a frontend for libraries libburn and libisofs which enables +creation and expansion of ISO-9660 filesystems on all CD/DVD/BD media supported +by libburn. This includes media like DVD+RW, which do not support multi-session +management on media level and even plain disk files or block devices. + +The price for that is thorough specialization on data files in ISO-9660 +filesystem images. So libisoburn is not suitable for audio (CD-DA) or any +other CD layout which does not entirely consist of ISO-9660 sessions. + +xorriso is an application of libisoburn, libisofs, and libburn, which reads +commands from program arguments, files, stdin, or readline. +Its features are also available via a C language API of libisoburn. + +Currently they are fully supported on Linux with kernels >= 2.4, +on FreeBSD with ATAPI/CAM support enabled in the kernel, see atapicam(4), +and on OpenSolaris (tested with kernel 5.11). +On other X/Open compliant systems libburn will only offer POSIX i/o with disk +file objects, but no direct MMC operation on CD/DVD/BD drives. + +By using this software you agree to the disclaimer at the end of this text: +"... without even the implied warranty ..." + + + Compilation, First Glimpse, Installation + +Dynamic library and compile time header requirements for libisoburn-1.1.6 : +- libburn.so.4 , version libburn-1.1.6 or higher +- libisofs.so.6 , version libisofs-1.1.6 or higher +libisoburn and xorriso will not start with libraries which are older than their +include headers seen at compile time. + +Obtain libisoburn-1.1.6.tar.gz, take it to a directory of your choice +and do: + + tar xzf libisoburn-1.1.6.tar.gz + cd libisoburn-1.1.6 + +Within that directory execute: + + ./configure --prefix=/usr + make + +Then become superuser and execute + make install +which will make available libisoburn.so.1 and the program xorriso. + +On GNU/Linux it will try to run program ldconfig with the library installation +directory as only argument. Failure to do so will not abort installation. +One may disable ldconfig by ./configure option --disable-ldconfig-at-install . + + +By use of a version script, the libisoburn.so library exposes no other function +names but those of the API definitions in and +. +If -Wl,--version-script=... makes problems with the local compiler, then +disable this encapsulation feature by + ./configure --disable-versioned-libs + make clean ; make + +The ./configure script of libisoburn can check via pkg-config whether suitable +libburn and libisoburn are installed. Regrettably this test failed on several +systems due to local pkg-config problems. So it is disabled by default and may +be enabled by: + ./configure --enable-pkg-check-modules +In this case, ./configure fails if no suitable installations are found. + + + xorriso + +libisoburn comes with a command line and dialog application named xorriso, +which offers a substantial part of libisoburn features to shell scripts and +users. Its file xorriso/README_gnu_xorriso describes the tarball of the +derived package GNU xorriso as first preference for a statically linked +xorriso installation. +The libisoburn installation described above produces a dynamically linked +xorriso binary depending on libburn.so, libisofs.so, libisoburn.so. + +After installation documentation is available via + man xorriso + man xorrisofs + man xorrecord + +Several alias links point to the xorriso binary: + xorrisofs starts xorriso with -as mkisofs emulation already enabled + xorrecord starts xorriso with -as cdrecord emulation already enabled + osirrox starts with -osirrox image-to-disk copying already enabled + +By default xorriso will depend on libreadline if the readline-dev headers +are present. This dependcy can be avoided by running + ./configure --prefix=/usr --disable-libreadline + make clean ; make +Never omit the "make clean" command after switching libreadline enabling. +Other deliberate dependency reduction options of ./configure are: + --disable-libacl avoid use of ACL functions like acl_to_text() + --disable-xattr avoid use of xattr functions like listxattr() on Linux + resp. extattr_list_file() on FreeBSD + --disable-zlib avoid use of zlib functions like compress2() + --disable-libjte avoid use of libjte for -jigdo command + +xorriso allows to use external processes as file content filters. This is +a potential security risk which may be avoided by ./configure option + --disable-external-filters +By default the filter feature is disabled if effective user id and real +user id differ. This ban can be lifted by + --enable-external-filters-setuid + +In some situations Linux may deliver a better write performance to DVD drives +if 64 KB rather than 32 KB are transmitted in each write operation. +64k can be made default at configure time by: + --enable-dvd-obs-64k + + + libisoburn, libisofs, and libburn C language API + +For the lower API concepts and calls see + ./libisoburn/libisoburn.h +as well as + /usr/include/libisofs/libisofs.h + /usr/include/libburn/libburn.h + + + xorriso C language API + +Actually the dynamically linked xorriso binary is only a small start program +for the xorriso API that is implemented inside libisoburn. +There are API calls for command readers and interpreters, and there are +API calls for each single command of xorriso. + +Interested programmers should have a look into the API definition at + xorriso/xorriso.h +and the start program + xorriso/xorriso_main.c + +The header file xorriso.h gets installed suitable for + #include + +So after installation of a binary libisoburn package you may find it e.g. as + /usr/include/libisoburn/xorriso.h + + + Drives and Disk File Objects + +The user of libisoburn applications needs operating system dependent +permissions for the CD/DVD/BD drives which shall be used. +On Linux and FreeBSD this means -rw-permissions, even if only reading is +intended. On Solaris one needs privileges "basic,sys_devices" and r-permission, +even if writing is intended. + +A list of rw-accessible drives can be obtained by + xorriso -devices +resp. by xorriso API call + Xorriso_option_devices() +resp. by libburn API call + burn_drive_scan() + +A possible source of problems are hald or other automounters. +If you can spot a process "hald-addon-storage" with the address of +your desired drive, then consider to kill it. +A similar process "udisks-daemon: polling ..." can be seen on newer Linuxes. + +On Debian GNU/Linux 6.0.2 amd64 there is + /lib/udev/rules.d/80-udisks.rules +where one can remove all CD drives ("sr*") from the list of automountable +devices: + KERNEL=="sd*|hd*|mmcblk*|mspblk*", ENV{UDISKS_PRESENTATION_NOPOLICY}="0" + # KERNEL=="sd*|hd*|sr*|mmcblk*|mspblk*", ENV{UDISKS_PRESENTATION_NOPOLICY}="0" +Copying the recognition criterion from + /etc/udev/rules.d/70-persistent-cd.rules +one can prevent automounting a single drive, too. E.g.: + SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-2:0:0:0", ENV{UDISKS_PRESENTATION_NOPOLICY}:="1" + +If you cannot get rid of the automounter, try whether it helps to always load +the drive tray manually before starting a write run of xorriso. Wait until the +drive light is off and the mounted media appears. +Then try to unmount the mounted media before a write run. + + +Besides true optical drives, libisoburn can also address disk files as input or +output drives. The addresses of the disk files have to be preceded by "stdio:". +Like: + "stdio:/tmp/pseudo_drive" + +Note: xorriso by default prefixes "stdio:" to addresses outside the /dev tree + if they do not lead to an optical drive device file. + + + Testing + +For automated and manual tests of xorriso's functionality see file + releng/README. + + + Result comparison with self produced ISO images + +We are quite sure that libisofs produces accurate representations of the disk +files. This opinion is founded on a lot of test burns and checks by a little +test program which compares files from the mounted image with the orignals +on disk. It uses the normal POSIX filesystem calls, i.e. no libburnia stuff. + +This program is not installed systemwide but stays in the installation +directory of the libisoburn tarball as test/compare_file . Usually it is +run as -exec payload of a find command. It demands at least three arguments: +The path of the file to compare, the prefix1 to be cut off from path +and the prefix2 which gets prepended afterwards to obtain the path of the +second file to compare. +As further argument there can be -no_ctime which suppresses the comparison +of ctime date stamps. +The exit value is 0 if no difference was detected, non-0 else. + +Example: After + xorriso ... -pathspecs on -add /=/original/dir -- + mount /media/dvd + cd test +compare tree /media/dvd with tree /original/dir : + find /original/dir -exec ./compare_file '{}' /original/dir /media/dvd ';' \ + | less +and vice versa: + find /media/dvd -exec ./compare_file '{}' /media/dvd /original/dir ';' \ + | less + + +------------------------------------------------------------------------------ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 or later + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +------------------------------------------------------------------------------ +Based on and sub project of: +libburnia-project.org +By Mario Danic , + Vreixo Formoso + Thomas Schmitt +Copyright (C) 2006-2011 Mario Danic, Vreixo Formoso, Thomas Schmitt. + +We will not raise any legal protest to dynamic linking of our libraries +with applications that are not under GPL, as long as they fulfill +the condition of offering the library source code used, whether +altered or unaltered, under the GPLv2+, along with the application. +Nevertheless, the safest legal position is not to link libburn with +non-GPL compatible programs. + +libburnia-project.org is inspired by and in other components still containing +parts of old +Libburn. By Derek Foreman and + Ben Jansens +Copyright (C) 2002-2006 Derek Foreman and Ben Jansens +libisoburn does not stem from their code. + diff --git a/libisoburn/branches/1.1.8/TODO b/libisoburn/branches/1.1.8/TODO new file mode 100644 index 00000000..23e3b643 --- /dev/null +++ b/libisoburn/branches/1.1.8/TODO @@ -0,0 +1,11 @@ +[Task] Figure out how to use "Requires" in pc.in (libisoburn and libisofs would benefit) +[Task] Figure out the usage of Libs.private (used in libburn) +[Task] Improve build system +[Task] Investigate build system, so other libburnia components can benefit +[Task] Write Doxygen files +[Task] Explain to Thomas & Vreixo about NEWS importance (all libburnia components + will benefit +[Task] Write a document about ABI & API +[Task] Create following targets for make: Src, Indent, Docs, Test, All [Any other suggestions?) + +All those tasks are currently assigned to Mario. diff --git a/libisoburn/branches/1.1.8/acinclude.m4 b/libisoburn/branches/1.1.8/acinclude.m4 new file mode 100644 index 00000000..ccc499a6 --- /dev/null +++ b/libisoburn/branches/1.1.8/acinclude.m4 @@ -0,0 +1,263 @@ +AC_DEFUN([LIBBURNIA_SET_FLAGS], +[ +case $target_os in +freebsd*) + LDFLAGS="$LDFLAGS -L/usr/local/lib" + CPPFLAGS="$CPPFLAGS -I/usr/local/include" + ;; +solaris*) + LDFLAGS="$LDFLAGS -L/usr/local/lib" +esac +]) + + +AC_DEFUN([TARGET_SHIZZLE], +[ + ARCH="" + LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig + + AC_MSG_CHECKING([target operating system]) + + LIBBURNIA_LDCONFIG_CMD="echo 'No ldconfig run performed. If needed, configure manually for:'" + case $target in + *-*-linux*) + ARCH=linux + LIBBURN_ARCH_LIBS= + LIBBURNIA_LDCONFIG_CMD=ldconfig + ;; + *-*-freebsd*) + ARCH=freebsd + LIBBURN_ARCH_LIBS=-lcam + + # This may later be overridden by configure --enable-libdir-pkgconfig + LIBBURNIA_PKGCONFDIR=$(echo "$libdir" | sed 's/\/lib$/\/libdata/')/pkgconfig + ;; + *) + ARCH= + LIBBURN_ARCH_LIBS= +# AC_ERROR([You are attempting to compile for an unsupported platform]) + ;; + esac + + AC_MSG_RESULT([$ARCH]) +]) + + +dnl LIBBURNIA_CHECK_ICONV is by Thomas Schmitt, libburnia project +dnl It is based on gestures from: +dnl iconv.m4 serial AM7 (gettext-0.18) +dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl From Bruno Haible. +dnl +AC_DEFUN([LIBBURNIA_CHECK_ICONV], +[ + + dnl Check whether it is allowed to link with -liconv + AC_MSG_CHECKING([for iconv() in separate -liconv ]) + libburnia_liconv="no" + libburnia_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + [libburnia_liconv="yes"], + [LIBS="$libburnia_save_LIBS"] + ) + AC_MSG_RESULT([$libburnia_liconv]) + + if test x"$libburnia_save_LIBS" = x"$LIBS" + then + dnl GNU iconv has no function iconv() but libiconv() and a macro iconv() + dnl It is not tested whether this is detected by above macro. + AC_CHECK_LIB(iconv, libiconv, , ) + fi + + dnl Check for iconv(..., const char **inbuf, ...) + AC_MSG_CHECKING([for const qualifier with iconv() ]) + AC_TRY_COMPILE([ +#include +#include +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +], [], [libburnia_iconv_const=""], [libburnia_iconv_const="const"] + ) + if test x$libburnia_iconv_const = xconst + then + AC_DEFINE_UNQUOTED([ICONV_CONST], [const]) + else + AC_DEFINE_UNQUOTED([ICONV_CONST], []) + fi + test -z "$libburnia_iconv_const" && libburnia_iconv_const="no" + AC_MSG_RESULT([$libburnia_iconv_const]) +]) + + +dnl LIBBURNIA_ASSERT_ICONV is by Thomas Schmitt, libburnia project +dnl +AC_DEFUN([LIBBURNIA_ASSERT_ICONV], +[ + if test x$XORRISO_ASSUME_ICONV = x + then + dnl Check for the essential gestures of libisofs/util.c + AC_MSG_CHECKING([for iconv() to be accessible now ]) + AC_TRY_LINK([ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ], +[iconv_t cd = iconv_open("",""); +iconv(cd,NULL,NULL,NULL,NULL); +iconv_close(cd); +], [iconv_test="yes"], [iconv_test="no"] + ) + AC_MSG_RESULT([$iconv_test]) + if test x$iconv_test = xno + then + echo >&2 + echo "Cannot get function iconv() to work. Configuration aborted." >&2 + echo "Check whether your system needs a separate libiconv installed." >&2 + echo "If it is installed but not found, try something like" >&2 + echo ' export LDFLAGS="$LDFLAGS -L/usr/local/lib"' >&2 + echo ' export CPPFLAGS="$CPPFLAGS -I/usr/local/include"' >&2 + echo ' export LIBS="$LIBS -liconv"' >&2 + echo "You may override this test by exporting variable" >&2 + echo " XORRISO_ASSUME_ICONV=yes" >&2 + echo >&2 + (exit 1); exit 1; + fi + fi +]) + + +dnl LIBBURNIA_TRY_READLINE is by Thomas Schmitt, libburnia project +dnl It performs the actual test compilation for readline. +dnl Variable LIBS has to be set by the caller. +AC_DEFUN([LIBBURNIA_TRY_READLINE], +[ + AC_TRY_LINK([ +#include +#include +#include +#include +#include +#include +#include +#include ], +[HIST_ENTRY **hl; +readline(""); +add_history(""); +hl= history_list(); +], [readline_test="yes"], [readline_test="no"] + ) +]) + + +dnl LIBBURNIA_ASSERT_READLINE is by Thomas Schmitt, libburnia project +dnl It disables xorriso readline if not all needed functions are present +AC_DEFUN([LIBBURNIA_ASSERT_READLINE], +[ + if test x$XORRISO_ASSUME_READLINE = x + then + dnl Check for the essential gestures of libisofs/util.c + AC_MSG_CHECKING([for desired functions in libreadline]) + readline_msg= + libburnia_save_LIBS="$LIBS" + LIBS="$LIBS -lreadline" + LIBBURNIA_TRY_READLINE + if test x$readline_test = xno + then + LIBS="$libburnia_save_LIBS" + LIBS="$LIBS -lreadline -lcurses" + LIBBURNIA_TRY_READLINE + if test x$readline_test = xyes + then + readline_msg=", with -lcurses" + fi + fi + if test x$readline_test = xno + then + READLINE_DEF= + LIBS="$libburnia_save_LIBS" + fi + AC_MSG_RESULT([$readline_test $readline_msg]) + fi +]) + + +dnl LIBISOBURN_ASSERT_VERS_LIBS is by Thomas Schmitt, libburnia project +dnl It tests whether -Wl,--version-script=... works with the compiler +AC_DEFUN([LIBISOBURN_ASSERT_VERS_LIBS], +[ + libburnia_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=libisoburn/libisoburn.ver" + AC_TRY_LINK([#include ], [printf("Hello\n");], + [vers_libs_test="yes"], [vers_libs_test="no"]) + if test x$vers_libs_test = xno + then + LDFLAGS="$libburnia_save_LDFLAGS" + fi +]) + + +dnl LIBBURNIA_SET_PKGCONFIG is by Thomas Schmitt, libburnia project +dnl It determines the install directory for the *.pc file. +dnl Important: Must be performed _after_ TARGET_SHIZZLE +dnl +AC_DEFUN([LIBBURNIA_SET_PKGCONFIG], +[ +### for testing --enable-libdir-pkgconfig on Linux +### LIBBURNIA_PKGCONFDIR="$libdir"data/pkgconfig + +if test "x$LIBBURNIA_PKGCONFDIR" = "x$libdir"/pkgconfig +then + dummy=dummy +else + AC_ARG_ENABLE(libdir-pkgconfig, + [ --enable-libdir-pkgconfig Install to $libdir/pkgconfig on any OS, default=no], + , enable_libdir_pkgconfig="no") + AC_MSG_CHECKING([for --enable-libdir-pkgconfig]) + if test "x$enable_libdir_pkgconfig" = xyes + then + LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig + fi + AC_MSG_RESULT([$enable_libdir_pkgconfig]) +fi + +libburnia_pkgconfig_override="no" +AC_ARG_ENABLE(pkgconfig-path, +[ --enable-pkgconfig-path=DIR Absolute path of directory for libisofs-*.pc], +libburnia_pkgconfig_override="yes" , enable_pkgconfig_path="none") +AC_MSG_CHECKING([for overridden pkgconfig directory path]) +if test "x$enable_pkgconfig_path" = xno +then + libburnia_pkgconfig_override="no" +fi +if test "x$enable_pkgconfig_path" = x -o "x$enable_pkgconfig_path" = xyes +then + libburnia_pkgconfig_override="invalid argument" +fi +if test "x$libburnia_pkgconfig_override" = xyes +then + LIBBURNIA_PKGCONFDIR="$enable_pkgconfig_path" + AC_MSG_RESULT([$LIBBURNIA_PKGCONFDIR]) +else + AC_MSG_RESULT([$libburnia_pkgconfig_override]) +fi +AC_SUBST(LIBBURNIA_PKGCONFDIR) + +dnl For debugging only +### AC_MSG_RESULT([LIBBURNIA_PKGCONFDIR = $LIBBURNIA_PKGCONFDIR]) + +]) + diff --git a/libisoburn/branches/1.1.8/bootstrap b/libisoburn/branches/1.1.8/bootstrap new file mode 100755 index 00000000..3e27cf45 --- /dev/null +++ b/libisoburn/branches/1.1.8/bootstrap @@ -0,0 +1,11 @@ +#!/bin/sh -x + +aclocal -I . +libtoolize --copy --force +autoconf + +# Not with libisoburn +# autoheader + +automake --foreign --add-missing --copy --include-deps + diff --git a/libisoburn/branches/1.1.8/configure.ac b/libisoburn/branches/1.1.8/configure.ac new file mode 100644 index 00000000..2f75dad5 --- /dev/null +++ b/libisoburn/branches/1.1.8/configure.ac @@ -0,0 +1,373 @@ +AC_INIT([libisoburn], [1.1.7], [http://libburnia-project.org]) +AC_PREREQ([2.50]) +dnl AC_CONFIG_HEADER([config.h]) + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +LIBBURNIA_SET_FLAGS + +AM_INIT_AUTOMAKE([subdir-objects]) +AC_CONFIG_MACRO_DIR([./]) + +dnl Hint: Search list for version code aspects: +dnl /AC_INIT( +dnl /ISOBURN_.*_VERSION +dnl /LT_.* +dnl /LIB.*_REQUIRED + +dnl The API version codes are defined in libisoburn/libisoburn.h +dnl #define isoburn_header_version_* +dnl configure.ac only rules the libtool revision numbering about +dnl LT_CURREN, LT_AGE, LT_REVISION where SONAME becomes LT_CURRENT - LT_AGE +dnl +dnl These three are only copies to provide libtool with unused LT_RELEASE +ISOBURN_MAJOR_VERSION=1 +ISOBURN_MINOR_VERSION=1 +ISOBURN_MICRO_VERSION=7 + +dnl ISOBURN_VERSION=$ISOBURN_MAJOR_VERSION.$ISOBURN_MINOR_VERSION.$ISOBURN_MICRO_VERSION + +AC_SUBST(ISOBURN_MAJOR_VERSION) +AC_SUBST(ISOBURN_MINOR_VERSION) +AC_SUBST(ISOBURN_MICRO_VERSION) +dnl AC_SUBST(ISOBURN_VERSION) + +dnl Libtool versioning +dnl Generate libisoburn.so.1.x.y +dnl SONAME will become LT_CURRENT - LT_AGE +dnl +dnl ts B10927 +dnl ### This is the release version 1.1.6 = libisoburn.so.1.73.0 +dnl This is the development version after above stable release +dnl LT_CURRENT++, LT_AGE++ have not happened yet. +dnl ### LT_CURRENT++, LT_AGE++ has happened meanwhile. +dnl +dnl SONAME = 74 - 73 = 1 . Library name = libisoburn.so.1.73.0 +LT_RELEASE=$ISOBURN_MAJOR_VERSION.$ISOBURN_MINOR_VERSION +LT_CURRENT=74 +LT_AGE=73 +LT_REVISION=0 +LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` + +AC_SUBST(LT_RELEASE) +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) +AC_SUBST(LT_CURRENT_MINUS_AGE) + +AC_PREFIX_DEFAULT([/usr/local]) +test "$prefix" = "NONE" && prefix=$ac_default_prefix + +AM_MAINTAINER_MODE + +AM_PROG_CC_C_O +AC_C_CONST +AC_C_INLINE +AC_C_BIGENDIAN + +dnl Large file support +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO +AC_CHECK_FUNC([fseeko]) +if test ! $ac_cv_func_fseeko; then + AC_ERROR([Libburn requires largefile support.]) +fi + +if test x$LIBISOBURN_OLD_ICONV_CONFIGURE = x +then + +dnl ts B00410 : To detect the need for -liconv and const argument of iconv() + LIBBURNIA_CHECK_ICONV + +else + +dnl Outdated: produces double -liconv and warnings about parameter mismatch +dnl If iconv(3) is in an extra lib, then it gets added to variable LIBS. +dnl If not, then no -liconv will be added. + AC_CHECK_LIB(iconv, iconv, , ) +dnl GNU iconv has no function iconv() but libiconv() and a macro iconv() + AC_CHECK_LIB(iconv, libiconv, , ) + +fi + +AC_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) +LIBTOOL="$LIBTOOL --silent" + +AC_PROG_INSTALL + +AC_CHECK_HEADERS() + +THREAD_LIBS=-lpthread +AC_SUBST(THREAD_LIBS) + +TARGET_SHIZZLE +AC_SUBST(ARCH) +AC_SUBST(LIBBURNIA_PKGCONFDIR) +AC_SUBST(LIBBURN_ARCH_LIBS) + + +dnl Determine target directory for libisoburn-*.pc +dnl Important: Must be performed _after_ TARGET_SHIZZLE +dnl +LIBBURNIA_SET_PKGCONFIG + + +AC_ARG_ENABLE(libreadline, +[ --enable-libreadline Enable use of libreadline by xorriso, default=yes], + , enable_libreadline=yes) +if test x$enable_libreadline = xyes; then +dnl Check whether there is readline-devel and readline-runtime. +dnl If not, erase this macro which would enable use of readline(),add_history() + READLINE_DEF="-DXorriso_with_readlinE" + + if test x$XORRISO_OLD_READLINE_CONFIGURE = x + then + +dnl ts B00411 : To disable readline if not all needed functions are present + LIBBURNIA_ASSERT_READLINE + + else +dnl The empty yes case obviously causes -lreadline to be linked + AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, , READLINE_DEF= ), READLINE_DEF= ) +dnl The X= in the yes case prevents that -lreadline gets linked twice + AC_CHECK_HEADER(readline/history.h, AC_CHECK_LIB(readline, add_history, X= , READLINE_DEF= ), READLINE_DEF= ) + fi +else + READLINE_DEF= +fi +AC_SUBST(READLINE_DEF) + +dnl ts A90329 +dnl ACL and xattr do not need to be enabled in libisoburn or xorriso source +dnl but without AC_CHECK_LIB() xorriso will not be linked with -lacl . +dnl On my Linux this does work with an ACL enabled libisofs but in general +dnl it seems not be right. +dnl So for now it seems to be best to do the same configuration for libisoburn +dnl and xorriso as for libisofs. + +AC_ARG_ENABLE(libacl, +[ --enable-libacl Enable use of libacl by libisofs, default=yes], + , enable_libacl=yes) +if test x$enable_libacl = xyes; then +dnl Check whether there is libacl-devel and libacl-runtime. +dnl If not, erase this macro which would enable use of acl_to_text and others + LIBACL_DEF="-DLibisofs_with_aaip_acL" +dnl The empty yes case obviously causes -lacl to be linked + AC_CHECK_HEADER(sys/acl.h, AC_CHECK_LIB(acl, acl_to_text, , LIBACL_DEF= ), LIBACL_DEF= ) +else + LIBACL_DEF= +fi +AC_SUBST(LIBACL_DEF) + + +AC_ARG_ENABLE(xattr, +[ --enable-xattr Enable use of xattr by libisofs, default=yes], + , enable_xattr=yes) +if test x$enable_xattr = xyes; then +dnl Check whether there is the header for Linux xattr. +dnl If not, erase this macro which would enable use of listxattr and others + XATTR_DEF="-DLibisofs_with_aaip_xattR" + AC_CHECK_HEADER(attr/xattr.h, AC_CHECK_LIB(c, listxattr, X= , XATTR_DEF= ), XATTR_DEF= ) +else + XATTR_DEF= +fi +AC_SUBST(XATTR_DEF) + + +dnl ts A90409 +dnl Same situation as with xattr and ACL: libisoburn does not depend directly +dnl on zlib. But if it is enabled in libisofs then it seems wise to link it +dnl with libisoburn apps. +AC_ARG_ENABLE(zlib, +[ --enable-zlib Enable use of zlib by libisofs, default=yes], + , enable_zlib=yes) +if test x$enable_zlib = xyes; then +dnl Check whether there is the header for zlib. +dnl If not, erase this macro which would enable use of compress2() and others. +dnl Linking fails on SuSE 9.0 because zlib has compress2() but lacks +dnl compressBound(). So compressBound is the more modern thing to test. +dnl The empty parameter after "compressBound" causes -lz. + ZLIB_DEF="-DLibisofs_with_zliB" + AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, compressBound, , ZLIB_DEF= ), ZLIB_DEF= ) +else + ZLIB_DEF= +fi +AC_SUBST(ZLIB_DEF) + +dnl ts B00928 +AC_ARG_ENABLE(libjte, +[ --enable-libjte Enable use of libjte by xorriso, default=yes], + , enable_libjte=yes) +if test "x$enable_libjte" = xyes; then + LIBJTE_DEF="-DXorriso_with_libjtE" + AC_CHECK_HEADER(libjte/libjte.h, AC_CHECK_LIB(jte, libjte_new, , LIBJTE_DEF= ), LIBJTE_DEF= ) +else + LIBJTE_DEF= +fi +AC_SUBST(LIBJTE_DEF) + +dnl ts B00107 +dnl Just for the case that it is necessary to give link option -lcdio not only +dnl with libburn but also with libburn apps like xorriso. +dnl On SuSE 10.2 this is not needed. libburn finds libcdio on its own. +AC_ARG_ENABLE(libcdio, +[ --enable-libcdio Enable EXPERIMENTAL use of libcdio as system adapter, default=no], + , enable_libcdio=no) +if test x$enable_libcdio = xyes; then +dnl Check whether there is libcdio-devel and libcdio-runtime. +dnl If not, erase this macro + LIBCDIO_DEF="-DLibburn_use_libcdiO" +dnl The empty yes case obviously causes -lcdio to be linked + AC_CHECK_HEADER(cdio/cdio.h, AC_CHECK_LIB(cdio, mmc_last_cmd_sense, , LIBCDIO_DEF= ), LIBCDIO_DEF= ) +else + LIBCDIO_DEF= +fi +if test x$LIBCDIO_DEF = x +then + if test x$enable_libcdio = xyes + then + echo "WARNING: could not enable use of libcdio as system adapter" + fi +else + echo "enabled EXPERIMENTAL use of libcdio as system adapter" +fi +AC_SUBST(LIBCDIO_DEF) + + +AC_ARG_ENABLE(external-filters, +[ --enable-external-filters Enable use of external filter programs by xorriso, default=yes], + , enable_external_filters=yes) +if test x"$enable_external_filters" = xyes; then + EXTF_DEF="-DXorriso_allow_external_filterS" + echo "enabled xorriso external filter programs" +else + EXTF_DEF= + echo "disabled xorriso external filter programs" +fi +AC_SUBST(EXTF_DEF) + +AC_ARG_ENABLE(external-filters-setuid, +[ --enable-external-filters-setuid Enable xorriso external filter programs under setuid, default=no], + , enable_external_filters_setuid=no) +if test x$enable_external_filters_setuid = xyes; then + EXTF_SUID_DEF="-DXorriso_allow_extf_suiD" + echo "enabled xorriso external filter programs under setuid" +else + EXTF_SUID_DEF= + echo "disabled xorriso external filter programs under setuid" +fi +AC_SUBST(EXTF_SUID_DEF) + +AC_ARG_ENABLE(dvd-obs-64k, +[ --enable-dvd-obs-64k 64 KB default size for xorriso DVD/BD writing, default=no], + , enable_dvd_obs_64=no) +if test x$enable_dvd_obs_64k = xyes; then + XORRISO_DVD_OBS_64K="-DXorriso_dvd_obs_default_64K" + echo "enabled xorriso write size default 64 KB on DVD and BD" +else + XORRISO_DVD_OBS_64K= + echo "disabled xorriso write size default 64 KB on DVD and BD" +fi +AC_SUBST(XORRISO_DVD_OBS_64K) + +# Library versioning normally serves a complex purpose. +# Since libisoburn obeys strict ABI backward compatibility, it needs only the +# simple feature to declare function names "global:" or "local:". Only the +# global ones are visible to applications at library load time. +AC_ARG_ENABLE(versioned-libs, +[ --enable-versioned-libs Enable strict symbol encapsulation , default=yes], + , enable_versioned_libs=yes) +if test x$enable_versioned_libs = xyes; then + vers_libs_test=no + LIBISOBURN_ASSERT_VERS_LIBS + if test x$vers_libs_test = xno + then + echo "disabled strict symbol encapsulation (test failed)" + else + echo "enabled strict symbol encapsulation" + fi +else + echo "disabled strict symbol encapsulation" +fi + +AC_ARG_ENABLE(ldconfig-at-install, +[ --enable-ldconfig-at-install On GNU/Linux run ldconfig, default=yes], + , ldconfig_at_install=yes) +if test x$ldconfig_at_install = xyes; then + dummy=dummy +else + LIBBURNIA_LDCONFIG_CMD="echo 'NOTE: ldconfig is disabled. If needed, configure manually for:'" + echo "disabled run of ldconfig during installation on GNU/Linux" +fi +AC_SUBST(LIBBURNIA_LDCONFIG_CMD) + + + +AC_CHECK_HEADER(libburn/libburn.h) +AC_CHECK_HEADER(libisofs/libisofs.h) + + +# ------- Visible mark in configure : Start of library check + +# Check for proper library versions if this is desired. +# (It fails too often on too many systems.) +AC_ARG_ENABLE(pkg-check-modules, +[ --enable-pkg-check-modules Enable pkg-config check for libburn and libisofs , default=no], + , enable_pkg_check_modules=no) +if test x$enable_pkg_check_modules = xyes; then + +dnl If PKG_CHECK_MODULES is to be used after this if-block, +dnl then it might be necessary to perform PKG_PROG_PKG_CONFIG before the block. + + LIBBURN_REQUIRED=1.1.7 + LIBISOFS_REQUIRED=1.1.6 + PKG_CHECK_MODULES(LIBBURN, libburn-1 >= $LIBBURN_REQUIRED) + PKG_CHECK_MODULES(LIBISOFS, libisofs-1 >= $LIBISOFS_REQUIRED) + if test x$LIBCDIO_DEF = x; then + dummy=dummy + else + LIBCDIO_REQUIRED=0.83 + PKG_CHECK_MODULES(LIBCDIO, libcdio >= $LIBCDIO_REQUIRED) + fi +else + echo "checking for LIBBURN... skipped, no --enable-pkg-check-modules" + echo "checking for LIBISOFS... skipped, no --enable-pkg-check-modules" + if test x$LIBCDIO_DEF = x; then + dummy=dummy + else + echo "checking for LIBCDIO... skipped, no --enable-pkg-check-modules" + fi +fi + +# ------- Visible mark in configure : End of library check + +dnl Add compiler-specific flags + +dnl See if the user wants aggressive optimizations of the code +AC_ARG_ENABLE(debug, +[ --enable-debug Disable aggressive optimizations [default=yes]], + , enable_debug=yes) +if test x$enable_debug != xyes; then + if test x$GCC = xyes; then + CFLAGS="-O3 $CFLAGS" + CFLAGS="-fexpensive-optimizations $CFLAGS" + fi + CFLAGS="-DNDEBUG $CFLAGS" +else + if test x$GCC = xyes; then + CFLAGS="-g -pedantic -Wall -Wextra -Wno-unused-parameter $CFLAGS" + fi + CFLAGS="-DDEBUG $CFLAGS" +fi + +CFLAGS="$READLINE_DEF $LIBACL_DEF $XATTR_DEF $EXTF_DEF $EXTF_SUID_DEF $ZLIB_DEF $LIBJTE_DEF $XORRISO_DVD_OBS_64K $CFLAGS" + +AC_CONFIG_FILES([ + Makefile + doc/doxygen.conf + version.h + libisoburn-1.pc + ]) +AC_OUTPUT diff --git a/libisoburn/branches/1.1.8/doc/comments b/libisoburn/branches/1.1.8/doc/comments new file mode 100644 index 00000000..4d7a79dc --- /dev/null +++ b/libisoburn/branches/1.1.8/doc/comments @@ -0,0 +1,85 @@ +/** + @author Mario Danic, Vreixo Formoso, Thomas Schmitt + + @mainpage Libisoburn Documentation Index + + @section intro Introduction + +Libburnia is an open-source project for reading, mastering and writing +optical discs. This page is about its capability to read, manipulate, and +write ISO 9660 filesystems with Rock Ridge extensions. Media can be optical +media or filesystem objects. + +Our scope is currently Linux 2.4 and 2.6, or FreeBSD, or OpenSolaris. + +libisoburn is an add-on to libburn and libisofs which coordinates both and +also allows to grow ISO-9660 filesystem images on multi-session media as well +as on overwriteable media via the same API. +All media peculiarities are handled automatically. + +xorriso is an application of all three libraries which creates, loads, +manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. +Manipulation is not only adding or overwriting of files but also deletion, +renaming, and attribute changing. An incremental backup feature is provided. +The xorriso features are accessible via built-in command interpreters and +via a C language API. + + +SONAME: +libisoburn.so.1 (since 0.1.0, February 2008). + + + @section using Using the libraries + +Our build system is based on autotools. +User experience tells us that you will need at least autotools version 1.7. + +To build libisoburn go into its toplevel directory and execute: + +- ./bootstrap (needed if you downloaded from SVN) + +- ./configure + +- make + +To make the library and the xorriso application accessible for running resp. +software development: + +- make install + + +For direct use as command line tool use the xorriso binary which among many +other features provides a mkisofs emulation via command "-as mkisofs". +See man page xorriso/xorriso.1 or GNU info document xorriso/xorriso.info. + + +If you want to link an own application with libisoburn, you have +two alternative APIs for choice: + +- libisoburn, together with libburn and libisofs. + +- xorriso, a complete representation of xorriso command line options. + It encapsulates the three lower level libraries. + Calls of both API families shall not be mixed. + +For a description of the lbisoburn API read libisoburn/libisoburn.h +See file README for download and installation of a release tarball. +You will also have to install and understand the two libraries of the +Libburnia project which provide fundamental services: +libburn is the library by which preformatted data get onto optical media. +See libburn/libburn.h for its API description. +libisofs is the library to handle ISO 9660 filesystems with Rock Ridge +extensions. Its API is described in libisofs/libisofs.h . + +For xorriso features see its man page xorriso/xorriso.1 or +its GNU info document xorriso/xorriso.info. +For the corresponding C language API see libisoburn/xorriso.h (resp. +xorriso/xorriso.h in the build directory). +The implementation this API is part of libisoburn. +The xorriso command line tool gets installed as dynamically linked +binary together with libisoburn. + +There is also a statically linked release named GNU xorriso. +See xorriso/README_gnu_xorriso for its download and installation. + +*/ diff --git a/libisoburn/branches/1.1.8/doc/doxygen.conf.in b/libisoburn/branches/1.1.8/doc/doxygen.conf.in new file mode 100644 index 00000000..1a4e15eb --- /dev/null +++ b/libisoburn/branches/1.1.8/doc/doxygen.conf.in @@ -0,0 +1,1294 @@ +# Doxyfile 1.5.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = @PACKAGE_NAME@ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @PACKAGE_VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = @top_srcdir@ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text " + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = libisoburn \ + doc \ + test + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = libisoburn.h \ + xorriso.h \ + comments + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = test + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = OB \ + OTK \ + _ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = doc/html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 200 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = letter + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = DOXYGEN + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +# ts B10415: dot causes sigsegv on Debian buildd +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = NO + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/libisoburn/branches/1.1.8/doc/faq.wiki b/libisoburn/branches/1.1.8/doc/faq.wiki new file mode 100644 index 00000000..ffc7c91b --- /dev/null +++ b/libisoburn/branches/1.1.8/doc/faq.wiki @@ -0,0 +1,246 @@ + +'''Libburnia Frequently Asked Questions''' + +Please post your questions to +[http://mailman-mail1.webfaction.com/listinfo/libburn-hackers/ libburn-hackers mailing list]. + +---------------------------------------------------------------------------- +'''Content:''' +---------------------------------------------------------------------------- + +Burning: + + [#diff_cdrskin_xorriso What is the difference between cdrskin and xorriso ?] + +Imaging: + + [#edit_files Is there a way to edit files inside the ISO image ?] + + [#boot_arch For which architectures xorriso is able to create bootable images ?] + + [#isohybrid How to enable booting from USB stick ?] + + [#partition_offset What is partition offset feature all about?] + + [#partition_offset_apple Partition offset bad on Apple ?] + +Development: + + [#api_specs Where are the APIs of libburnia libraries described ?] + + [#gui_advise I want to write a GUI on the top of libburnia libraries. Any pointers or recommendations ?] + +Miscellaneous: + + [#example_links Where to see examples ?] + + [#xorriso_aliases What personalities are supported by xorriso ?] + + [#xorriso_dialog_mode What is xorriso dialog mode useful for ?] + + [#version_numbers Why is every second release missing ?] + +---------------------------------------------------------------------------- +'''Burning''' +---------------------------------------------------------------------------- + +===== What is the difference between cdrskin and xorriso ? ===== #diff_cdrskin_xorriso + +[wiki:Cdrskin cdrskin] is a dedicated emulator of program cdrecord, based on +libburn. It tries to be as similar to cdrecord as is possible under that +premise. + +[wiki:Xorriso xorriso] is an integrated tool which creates, loads, manipulates, +and writes ISO 9660 filesystem images with Rock Ridge extensions. +It is based on libburn, libisofs, and libisoburn. One of its features is +the emulation of the corresponding tasks as done by mkisofs and cdrecord. + +---------------------------------------------------------------------------- +'''Imaging''' +---------------------------------------------------------------------------- + +===== Is there a way to edit files inside the ISO image ? ===== #edit_files + +File content cannot be altered. But files may be replaced by new copies from +the disk filesystem. + +The main method of manipulating an existing ISO image is to append a session +with a new complete directory tree and the file content of the added or +overwritten files. Depending on the media type you get gaps between sessions +of up to 20 MB. So better try to do all foreseeable changes by one add-on +session. + +===== For which architectures xorriso is able to create bootable images ? ===== #boot_arch + +Currently it supports systems with PC-BIOS via El Torito for booting from +CD, DVD, or BD media, and via MBR for booting from memory sticks or hard +disks. Further it supports machines with MIPS processor from SGI (Big Endian) +and DEC (Little Endian), and SUN SPARC machines. +(See [http://bazaar.launchpad.net/%7Elibburnia-team/libisofs/scdbackup/annotate/head%3A/doc/boot_sectors.txt libisofs/doc/boot_sectors.txt] +for technical details.) + +Machines which support EFI may either boot via El Torito or use the files +of the ISO image directly. It is possible to append to the ISO image a +writeable FAT12 partition where files for EFI may be stored and changed. + +===== How to enable booting from USB stick ? ===== #isohybrid + +The ISOLINUX boot loader is normally started from CD, DVD or BD media +by a PC-BIOS via an El Torito boot record. But if the ISO image resides on an +USB stick or another hard-disk-like device, then PC-BIOS ignores El Torito +and rather expects a Master Boot Record (MBR). Both boot record types can +reside in the same ISO image. Therefore it is possible to create an MBR that +starts the boot image file of ISOLINUX which is already target of the El Torito +boot record. This kind of MBR is called "isohybrid". ISOLINUX provides +a program named isohybrid to patch existing images, but libisofs can create an +MBR already when producing the ISO image. See in +[http://www.gnu.org/software/xorriso/man_1_xorriso.html manual page of xorriso] +option -boot_image with arguments "isolinux" "system_area=", +and -as mkisofs option -isohybrid-mbr. + +See [http://en.wikipedia.org/wiki/Master_boot_record Wikipedia on MBR] for +general information about PC-DOS Master Boot Records, and +[http://syslinux.zytor.com/wiki/index.php/ISOLINUX ISOLINUX wiki] for special +information about ISOLINUX. The wiki example with mkisofs can be performed +as well by help of xorriso option -as mkisofs. + +A similar combination of El Torito and MBR is created by GRUB2 tool +grub-mkrescue. See [http://www.gnu.org/software/grub/ homepage of GNU GRUB 2] +for general information. + +===== What is partition offset feature all about? ===== #partition_offset + +If an MBR is present, then it contains a partition table with up to four +entries. The MBR is located at the very start of the ISO image. By +tradition the first partition should begin only after the range of MBR and +eventual supporting data blocks. On hard disk one often sees partition 1 +starting at byte 63*512. Further it is tradition that the payload filesystem +is mountable via one of the partitions. + +The isohybrid MBR has its only partition start at byte 0. Thus it is mountable +but does not obey the tradition to begin only after the MBR. The grub-mkrescue +MBR on the other hand has partition 1 start at byte 512, which makes it +unmountable. Only the unpartitioned base device can be mounted. (On GNU/Linux +e.g. /dev/sdb is the base device whereas /dev/sdb1 is partition 1.) + +The compromise offered by libisofs is to create a second superblock at +address 16*2048 and to let start partition 1 at this address. The second +superblock leads to a second directory tree which takes into account the +address difference between partition 1 and the base device. So the image +gets mountable via both devices and reserves 32 kB for boot manager software +where it may manipulate and augment the MBR. +(See [http://libburnia-project.org/wiki/PartitionOffset Partition Offset Wiki] +for examples.) + +There are reports of machines which will not boot from USB stick if +partition offset is 0. + +===== Partition offset bad on Apple ? ===== #partition_offset_apple + +Apple's "Snow Leopard" operating system refuses to mount Debian CD images +with non-zero partition offset. + +The issue is still under investigation. But for now one has to choose +between mountability on Apple "Snow Leopard" or bootability from USB stick +on Kontron CG2100 "carrier grade server". + +---------------------------------------------------------------------------- +'''Developing''' +---------------------------------------------------------------------------- + +===== Where are the APIs of libburnia libraries described ? ===== #api_specs + +The decisive references are the inclusion headers of the libraries +, , , +and . + +Current SVN versions of these files: +[http://libburnia-project.org/browser/libburn/trunk/libburn/libburn.h libburn/libburn.h] , +[http://bazaar.launchpad.net/%7Elibburnia-team/libisofs/scdbackup/annotate/head%3A/libisofs/libisofs.h libisofs/libisofs.h] , +[http://libburnia-project.org/browser/libisoburn/trunk/libisoburn/libisoburn.h libisoburn/libisoburn.h] , +[http://libburnia-project.org/browser/libisoburn/trunk/xorriso/xorriso.h libisoburn/xorriso.h] + +Doxygen generated API descriptions at +[http://api.libburnia-project.org api.libburnia-project.org] +might be slightly behind the latest developments. + +===== I want to write a GUI on the top of libburnia libraries. Any pointers or recommendations ? ===== #gui_advise + +Most appreciated would be a GUI for xorriso which allows to copy files from +a view of the hard disk filesystem to a view of the ISO filesystem, and vice +versa. The xorriso implementation is located inside libisoburn. + +Each option that is described in +[http://www.gnu.org/software/xorriso/man_1_xorriso.html man 1 xorriso] +can be performed by a corresponding C function that is defined in +[http://libburnia-project.org/browser/libisoburn/trunk/xorriso/xorriso.h xorriso.h]. +Further there are calls for library startup and shutdown, for problem +handling, and for the interpreters of xorriso's command line interface. +The xorriso API encapsulates calls to libisofs, libburn, and libisoburn. + +An alternative to the xorriso C API is xorriso dialog mode. +[#xorriso_dialog_mode See below.] + +The known existing GUIs [http://www.xfce.org/projects/xfburn/ Xfburn], +[http://projects.gnome.org/brasero/ Brasero], +[http://flburn.sourceforge.net/ FlBurn] +rather use libisofs and libburn directly. +(Please submit an URI if you want your libburnia GUI application mentioned +here.) + +---------------------------------------------------------------------------- +'''Miscellaneous''' +---------------------------------------------------------------------------- + +===== Where to see examples ? ===== #example_links + +[http://www.gnu.org/software/xorriso/man_1_xorriso.html#EXAMPLES xorriso examples] , +[http://scdbackup.sourceforge.net/man_1_cdrskin_devel.html#EXAMPLES cdrskin examples] , +[http://libburnia-project.org/browser/libburn/trunk/test/libburner.c libburner.c a minimal but complete burn program] +(also illustrated at the end of [http://api.libburnia-project.org/libburn/ libburn API intro]). + + +===== What personalities are supported by xorriso ? ===== #xorriso_aliases + +The name by which xorriso is started may trigger certain features which +normally would need to be enabled by program options. + +xorrisofs starts up in mkisofs emulation mode, which otherwise would have to +be entered by command -as "mkisofs". + +xorrecord starts up in cdrecord emulation mode, which is normally entered by +command -as "cdrecord". This emulation is only able to write a single data +track as new session to blank or appendable media. No audio. No multiple +tracks in one session. + +osirrox allows to copy files from ISO image to disk and to apply option -mount +to one or more of the existing ISO sessions. This is normally enabled by +option -osirrox "on:o_excl_off". + +===== What is xorriso dialog mode useful for ? ===== #xorriso_dialog_mode + +Dialog mode is initiated if -dialog "on" is among the program arguments. +It can be used to inspect and exploit existing ISO 9660 images or +to explore xorriso's behavior in order to develop the command sequence +for a batch run. + +Frontend programmers may fork xorriso initiating a xorriso dialog session +(-dialog "on" -use_readline "off" -pkt_output "on" -mark "done"), +and interact with it from their own program via pipes connected to +xorriso's stdin and stdout. This is more efficient than forking xorriso +every now and then to perform various commands in order to complete +complex tasks like image size prediction. + +===== Why is every second release missing ? ===== #version_numbers + +Releases have an even third version number. Like 0.5.6 or 1.0.4. +During development the next higher odd number is used. E.g. 0.5.7 or 1.0.5. + +The content of release tarballs does not get changed without changing +their name. The development tarballs of xorriso and cdrskin may change +their content without notice. + +---------------------------------------------------------------------------- +Site maintainer: Do not edit this wiki directly but rather the SVN version +of libisoburn/trunk/doc/faq.wiki. When done, paste it into the wiki editor. + diff --git a/libisoburn/branches/1.1.8/doc/partition_offset.wiki b/libisoburn/branches/1.1.8/doc/partition_offset.wiki new file mode 100644 index 00000000..4e64005d --- /dev/null +++ b/libisoburn/branches/1.1.8/doc/partition_offset.wiki @@ -0,0 +1,232 @@ + +The partition offset feature of libisofs can produce ISO 9660 images which bear +a quite conventional partition table if copied onto a USB stick. The first +partition marks the size of the ISO image but starts at a non-zero address. +Thus it marks a small part of the device as unclaimed by partitions and +available for storing boot loader code. + +Nevertheless the USB stick is mountable via its overall device file as well as +via the partition device file. E.g. on GNU/Linux: /dev/sdb and /dev/sdb1. +This is achieved by two distinct sets of meta-data which refer to the same +file content. + +The dual-mount feature supports Rock Ridge and Joliet too. +It is capable of multi-session. + +Currently only offset 32 kB seems to make sense. Smaller offsets are prohibited +by fundamental assumptions of libisofs and libisoburn. Larger offsets would +extend the unclaimed area into vital blocks of the ISO image. + +-------------------------------------------------------------------------- + +Meanwhile Debian +[http://cdimage.debian.org/cdimage/daily-builds/daily/current/ daily] +and [http://cdimage.debian.org/cdimage/weekly-builds/ weekly] builds make +use of this feature with their bootable ISO images for i386 and amd64. E.g. +[http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/iso-cd/debian-testing-i386-businesscard.iso debian-testing-i386-businesscard.iso]. + +According to a +[http://syslinux.zytor.com/archives/2011-March/016201.html thread of march 2011] +on Syslinux mailing list this enabled booting of a Kontron CG2100 server +from USB stick, which otherwise failed. + +Regrettably the feature seems to prevent mounting of ISO 9660 images on +Apple "Snow Leopard" systems. +At least this is the outcome of a +[http://lists.debian.org/debian-cd/2011/04/msg00029.html debian-cd thread of april 2011]. + +-------------------------------------------------------------------------- + +Example: + +Testing mountability and ISOLINUX bootability from USB stick and CD. + +Overview: + +The test image was derived from one year old RIPLinux-9.3-non-X.iso which +has an isohybrid MBR. Syslinux version seems to be 3.82. That MBR and the file +tree from the mounted RIPLinux image was used to build a new ISO image +with 16 * 2kB partition offset. Isohybrid MBR patching was done by xorriso. + +Details: + +The first 32 kB of an ISO 9660 image are called System Area and may host any +byte pattern. In the case of RIPLinux-9.3-non-X.iso only the first 512 bytes +are non-zero. But to avoid any assumptions, all 32 kB get copied here. +{{{ + dd if=RIPLinux-9.3-non-X.iso bs=1K count=32 of=RIPLinux-9.3-non-X.sysarea +}}} +Normally the System Area file with its MBR is provided by the Syslinux +installation under the name isohdp[fp]x*.bin . +E.g. /usr/lib/syslinux/isohdpfx.bin + +The files of the image are made accessible for reading +{{{ + mount -o loop RIPLinux-9.3-non-X.iso /mnt +}}} + +A new ISO image gets composed. The first three lines of arguments are taken +from the prescriptions of ISOLINUX wiki and adapted to the names used in +RIPLinux-9.3-non-X.iso. +Option -isohybrid-mbr imports the copied System Area and patches the MBR +according to rules published by hpa on Syslinux mailing list. +Option -partition_offset 16 causes the first partition to start at 2 kB block +number 16. It also prepares the image to be mountable by this partition, too. +{{{ + xorriso -as mkisofs \ + -o new_image.iso \ + -b boot/isolinux/isolinux.bin -c boot/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -isohybrid-mbr RIPLinux-9.3-non-X.sysarea \ + -partition_offset 16 \ + /mnt +}}} +The image was copied onto a USB stick +{{{ + dd if=new_image.iso of=/dev/sdc +}}} +and plugged into a Debian system. +{{{ + fdisk -lu /dev/sdb +}}} +yields +{{{ + Device Boot Start End Blocks Id System +/dev/sdb1 * 64 120831 60384 17 Hidden HPFS/NTFS +}}} + +I can mount /dev/sdb and /dev/sdb1 alike: +{{{ + mount /dev/sdb1 /mnt1 + mount -o loop /dev/sdb /mnt +}}} +-o loop avoids failure with "mount: /dev/sdb already mounted or /mnt busy". +A comparison by +{{{ + diff -r /mnt /mnt1 +}}} +reports no difference. +Human readable files look ok. +Test-reading all content by +{{{ + tar cf - /mnt | wc +}}} +yields a reasonable byte count of 60743680 and no errors. + +The machine boots RIPLinux from this USB stick with no visible problems. +It can then mount /dev/sdb as well as /dev/sdb1. +The ISO image boots from CD too. + +Mounting the partition can be simulated with an image file on hard disk by +cutting off the first partition_offset blocks of 2 KB: +{{{ + dd if=new_image.iso of=partition_image.iso bs=2048 skip=16 + mount -o loop partition_image.iso /mnt1 +}}} + +-------------------------------------------------------------------------- + +Another test was made with GRUB 2 by downloading +{{{ + bzr branch http://bzr.savannah.gnu.org/r/grub/trunk/grub +}}} + +Before building GRUB 2, the file +{{{ + util/grub-mkrescue.in +}}} +was edited to replace in the options of the xorriso command: +{{{ + --protective-msdos-label +}}} +by +{{{ + -partition_offset 16 -no-pad +}}} +Then GRUB 2 was built and installed. + +The resulting image from +{{{ + ./grub-mkrescue -o image.iso +}}} +was put onto USB stick. It passed the same tests on Debian +as above RIPLinux example. It boots to a GRUB prompt. + +Due to option -no-pad the image is about 250 kB smaller than +the image produced by original grub-mkrescue. Else it would have grown by +about 50 kB. + +Unpadded ISO images are safe except for burning on CD in TAO mode. +In this case problems may occur with reading the last few data blocks. +So when burning onto CD make sure to require SAO mode and/or to +require padding by 300 kB. +Burning on DVD or BD needs no such caution. Neither does copying +on USB stick or hard disk. + +Program fdisk will complain about "different physical/logical" addresses. +This can be silenced by adding option +{{{ + -partition_cyl_align on +}}} +at the cost of image padding up to the next full MB. +E.g. by 402 kB to 2 MB. + +-------------------------------------------------------------------------- + +Open questions: + +- Shall the partition of an isohybrid image be marked bootable ? +Currently xorriso keeps the 0x80 mark of an imported MBR +resp. the 0x80 mark which xorriso sets by its own MBR +preparations. + - If not to be marked bootable: + What equipment would the partition need to justify having the mark ? + +------------------------------------------------------------------------ + +Application: + +The partition offset feature can be controlled by libisofs API calls +{{{ +int iso_write_opts_set_part_offset(IsoWriteOpts *opts, + uint32_t block_offset_2k, + int secs_512_per_head, + int heads_per_cyl); + +int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768], + int options, int flag); +}}} +resp. by libisoburn calls +{{{ +int isoburn_igopt_set_part_offset(struct isoburn_imgen_opts *opts, + uint32_t block_offset_2k, + int secs_512_per_head, int heads_per_cyl); + +int isoburn_igopt_get_part_offset(struct isoburn_imgen_opts *opts, + uint32_t *block_offset_2k, + int *secs_512_per_head, int *heads_per_cyl); + +int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o, + char data[32768], int options); + +int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o, + char data[32768], int *options); +}}} +resp. by xorriso options +{{{ + -boot_image any partition_offset=(2kb_block_adr) + -boot_image any partition_sec_hd=(number) + -boot_image any partition_hd_cyl=(number) + -boot_image any partition_cyl_align(on|auto|off) + + -as mkisofs ... -partition_offset (2kb_block_adr) \ + -partition_hd_cyl (number) \ + -partition_sec_hd (number) \ + -partition_cyl_align (on|auto|off) ... +}}} + +As stated above, an offset larger than 16 would expose vital parts of the +ISO image as unclaimed space. Values smaller than 16 are not accepted. +So use either an offset of 16 blocks or keep the feature disabled by +offset 0. + diff --git a/libisoburn/branches/1.1.8/doc/qemu_xorriso.wiki b/libisoburn/branches/1.1.8/doc/qemu_xorriso.wiki new file mode 100644 index 00000000..87fe7a58 --- /dev/null +++ b/libisoburn/branches/1.1.8/doc/qemu_xorriso.wiki @@ -0,0 +1,509 @@ + +This text describes how to set up a qemu virtual machine so that xorriso +on its guest GNU/Linux can operate a CD, DVD or BD recorder of the host +system. + +The options follow proposals of Paolo Bonzini on qemu-devel mailing list. +My compliments for his patient guidance. + +This worked with a qemu git clone which was made few days before the +release candidate v1.0-rc0 was tagged. + +---------------------------------------------------------------------- +qemu start command : + +{{{ + $ qemu \ + -enable-kvm \ + -nographic \ + -m 512 \ + -net nic,model=ne2k_pci \ + -net user,hostfwd=tcp::5557-:22 \ + -hda /dvdbuffer/i386-install.qemu \ + -drive file=/dev/sr2,if=none,id=scsicd,format=raw \ + -device virtio-blk-pci,drive=scsicd,logical_block_size=2048,physical_block_size=2048 \ + -cdrom .../some_image.iso +}}} + +With this setup of -drive and -device it is necessary to have a +medium in the drive, when qemu gets started. Else it will refuse. + +The guest system is accessible via ssh and scp at port 5557 of the +host system. + +'''/dev/sr2''' is the address of the DVD drive which is handed over to the +guest system. + +'''.../some_image.iso''' may be any readable file which shall serve as +virtual DVD-ROM. qemu is not happy without such a thing. + +'''/dvdbuffer/i386-install.qemu''' is the disk image, where the guest operating +system was installed by: +{{{ + $ qemu-img create /dvdbuffer/i386-install.qemu 8G + $ qemu \ + -enable-kvm \ + -m 512 \ + -net nic,model=ne2k_pci \ + -hda /dvdbuffer/i386-install.qemu \ + -cdrom debian-6.0.3-i386-netinst.iso \ + -boot d +}}} + +Host system of my test is Debian GNU/Linux 6.0.2 amd64, +which had access to the Internet when the guest was installed. + +---------------------------------------------------------------------- + +Preparations on guest system Debian GNU/Linux 6.0.3 i386 + +There appears no /dev/sr for the passthrough drive. Thus libburn will not +list it by its drive search function. One may use it nevertheless. But +xorriso will only do so if prefix "mmc:" is used with the address: +{{{ + -dev mmc:/dev/vda +}}} +The drive will be listed by libburn if there is a symbolic link /dev/sr* +pointing to it. On Debian 6, this link persists only if it is created +by an udev rule. + +In /lib/udev/rules.d/50-udev-default.rules: +{{{ + KERNEL=="vda", SYMLINK+="sr1" +}}} + +libburn on Linux needs rw-permission for the drive's device node. +The virtual device /dev/vda is in group "disk". Usual for CD drives is +group "cdrom", to which i (or the Debian installer ?) have added my +normal user when i installed the guest system. +Like with the symbolic link, such a change persists on Debian 6 only as +udev rule. + +In /lib/udev/rules.d/91-permissions.rules: +{{{ + KERNEL=="vda", GROUP="cdrom" +}}} + +This should yield +{{{ + lrwxrwxrwx 1 root root 3 Nov 8 11:19 /dev/sr1 -> vda + brw-rw---- 1 root cdrom 254, 0 Nov 8 11:19 /dev/vda +}}} + +Beginning with libburnia release 1.1.8, the tests will also be +possible with dynamically linked xorriso which comes with libisoburn +and needs installed libburn and libisofs. That's what packages of +Debian and other distros deliver. + +For now, one needs GNU xorriso from a recent development tarball +{{{ + http://scdbackup.sourceforge.net/xorriso-1.1.7.tar.gz +}}} +Do +{{{ + $ tar xzf xorriso-1.1.7.tar.gz + $ cd xorriso-1.1.7 + $ ./configure && make +}}} +Either do as superuser +{{{ + # make install +}}} +or execute it where it was built as +{{{ + $ ./xorriso/xorriso ...arguments... +}}} +After compilation, this binary does not depend on files in the build +directory. You may move it to any other location. + +The version must be >= 1.1.7, Version timestamp >= 2011.11.09.111414 +{{{ + $ xorriso -version +}}} +tells the versions of its components on stdout: +{{{ + ... + xorriso version : 1.1.7 + Version timestamp : 2011.11.09.111414 + ... +}}} + +For details about the following xorriso commands, read +{{{ + man xorriso + man ./xorriso/xorriso.1 +}}} +or with the same content +{{{ + info xorriso + info ./xorriso/xorriso.info +}}} +Or read the [http://scdbackup.sourceforge.net/man_1_xorriso_devel.html online man page of xorriso]. + + +Note that the sequence of xorriso arguments matters. They are commands +which get performed one after the other. +This differs from the behavior of mkisofs, cdrecord, et.al., +which parse all arguments and then perform actions in a hardcoded +sequence. + +Writing happens automatically if ISO filetree changes are pending +at the end of the program run. This is like with other burn tools. +(There is a command -commit for intermediate writing e.g. in dialog +mode.) + +---------------------------------------------------------------------- + +Listing accessible drives: +{{{ + $ xorriso -devices +}}} +shows on stdout: +{{{ + 0 -dev '/dev/sr0' rwrw-- : 'QEMU ' 'QEMU DVD-ROM' + 1 -dev '/dev/sr1' rwrw-- : 'Optiarc ' 'BD RW BD-5300S' +}}} + +---------------------------------------------------------------------- + +The burn tests are presented here for unformatted DVD-RW media. +The xorriso commands apply also to other types of optical media. +See "Other applicable media types:" further below. + +---------------------------------------------------------------------- + +Inspecting drive and medium: +{{{ + $ xorriso -outdev /dev/sr1 -toc +}}} +should show on stdout something like +{{{ + Drive current: -dev '/dev/sr1' + Drive type : vendor 'Optiarc' product 'BD RW BD-5300S' revision '1.04' + Media current: DVD-RW sequential recording + Media product: RITEKW04 , Ritek Corp + Media status : is written , is closed + Media blocks : 306592 readable , 0 writable , 2298496 overall + TOC layout : Idx , sbsector , Size , Volume Id + ISO session : 1 , 0 , 106696s , ISOIMAGE + ISO session : 2 , 135536 , 108385s , ISOIMAGE + ISO session : 3 , 250240 , 56202s , ISOIMAGE + Media summary: 3 sessions, 271744 data blocks, 531m data, 0 free +}}} + +---------------------------------------------------------------------- + +Blanking to single session capability: + +This medium has to be blanked before further writing. For the DAO +test, one can save time by fast blanking, which xorriso normally +dislikes because the result is not capable of multi-session: +{{{ + $ xorriso -outdev /dev/sr1 -blank deformat_quickest +}}} +should report on stderr +{{{ + ... + xorriso : UPDATE : Blanking ( 1.0% done in 2 seconds ) + ... + xorriso : UPDATE : Blanking ( 95.4% done in 36 seconds ) + xorriso : UPDATE : Blanking ( 99.0% done in 37 seconds ) + ... + Media current: DVD-RW sequential recording + Media status : is blank + Media summary: 0 sessions, 0 data blocks, 0 data, 4489m free +}}} +Do not worry if the pacifier messages show no neat percentage progress. +Some drives report "1.0%" until they are done. Some report "1.0%" +after "99%". + +---------------------------------------------------------------------- + +Writing a DAO session: + +Use one or more moderately sized directories as input. Here: /usr/bin. +Terminate the list of -add arguments by argument "--". +It is important to have command -close "on" among the arguments. +{{{ + $ xorriso -md5 on -outdev /dev/sr1 -close on -add /usr/bin -- +}}} +should report on stderr +{{{ + ... + xorriso : UPDATE : 594 files added in 1 seconds + ... + xorriso : UPDATE : Thank you for being patient. Working since 2 seconds. + xorriso : UPDATE : Writing: 32s 0.1% fifo 100% buf 0% 0.1xD + ... + xorriso : UPDATE : Writing: 2704s 5.1% fifo 11% buf 0% 3.9xD + ... + xorriso : UPDATE : Writing: 20208s 38.2% fifo 52% buf 99% 4.0xD + ... + xorriso : UPDATE : Writing: 52885s 100.0% fifo 0% buf 99% 0.0xD + ISO image produced: 52735 sectors + Written to media : 52885 sectors at LBA 0 + Writing to '/dev/sr1' completed successfully. +}}} +Do not worry if there is no progress to see for a few dozen seconds +at the beginning. +The run will last at least as long as writing of 1 GB would need. +If you write less data, then there will be a lot of zero progress +messages at the end of writing. + +---------------------------------------------------------------------- + +Checkreading the result: +{{{ + $ xorriso -md5 on -indev /dev/sr1 -check_md5_r sorry / -- +}}} +The word "sorry" sets the severity class of the event message, which is +emitted in case of MD5 mismatch. (See man xorriso, "Exception processing".) + +This should report on stderr +{{{ + ... + Drive current: -indev '/dev/sr1' + Media current: DVD-RW sequential recording + Media status : is written , is closed + Media summary: 1 session, 52885 data blocks, 103m data, 0 free + Volume id : 'ISOIMAGE' + xorriso : UPDATE : 568079 content bytes read in 5 seconds + xorriso : UPDATE : 17074k content bytes read in 10 seconds + ... + xorriso : UPDATE : 103.7m content bytes read in 35 seconds + File contents and their MD5 checksums match. +}}} +and the exit value should be 0, if no mismatch was reported. + +A mismatch message would look like +{{{ + ... + MD5 MISMATCH: '/usr/bin/ncursesw5-config' + ... + Mismatch detected between file contents and MD5 checksums. + xorriso : SORRY : Event triggered by MD5 comparison mismatch + xorriso : NOTE : Tolerated problem event of severity 'SORRY' + xorriso : NOTE : -return_with SORRY 32 triggered by problem severity SORRY +}}} +and the exit value would be non-zero. + +---------------------------------------------------------------------- + +Blanking to multi-session capability: +{{{ + $ xorriso -outdev /dev/sr1 -blank as_needed +}}} +This will need as long as writing the DVD-RW up to its end. +Blanking option "as_needed" lets xorriso decide what to do in order +to make the medium writable from scratch. With DVD-RW it will decide for +-blank "all". + +The report on stderr should end by +{{{ + ... + xorriso : UPDATE : Blanking ( 98.9% done in 902 seconds ) + xorriso : UPDATE : Blanking ( 99.0% done in 903 seconds ) + xorriso : UPDATE : Blanking ( 99.0% done in 904 seconds ) + Blanking done + xorriso : NOTE : Re-assessing -outdev '/dev/sr1' + Drive current: -outdev '/dev/sr1' + Media current: DVD-RW sequential recording + Media status : is blank + Media summary: 0 sessions, 0 data blocks, 0 data, 4489m free +}}} + +---------------------------------------------------------------------- + +Writing multiple sessions (DVD-RW write type Incremental): + +This time do not perform command -close "on", so that the medium +stays writable: +{{{ + $ xorriso -md5 on -dev /dev/sr1 -add /usr/lib -- + ... + xorriso : UPDATE : Writing: 105280s 98.6% fifo 0% buf 77% 3.5xD + xorriso : UPDATE : Writing: 106796s 100.0% fifo 0% buf 62% 2.2xD + xorriso : UPDATE : Closing track/session. Working since 44 seconds + ... + xorriso : UPDATE : Closing track/session. Working since 77 seconds + ISO image produced: 106646 sectors + Written to media : 106800 sectors at LBA 0 + Writing to '/dev/sr1' completed successfully. +}}} +Checkread like after the DAO test: +{{{ + $ xorriso -md5 on -indev /dev/sr1 -check_md5_r sorry / -- + ... + xorriso : UPDATE : 204.0m content bytes read in 63 seconds + File contents and their MD5 checksums match. +}}} +Writing the second session looks like the first one. Just use another +set of input files to get a visible change in the ISO 9660 file tree: +{{{ + $ xorriso -md5 on -dev /dev/sr1 -add /usr/bin -- + ... + Written to media : 53408 sectors at LBA 135488 + Writing to '/dev/sr1' completed successfully. +}}} +And checkread the whole tree of files (i.e. both sessions): +{{{ + $ xorriso -md5 on -indev /dev/sr1 -check_md5_r sorry / -- + ... + xorriso : UPDATE : 307.8m content bytes read in 89 seconds + File contents and their MD5 checksums match. +}}} +At the end of writing a final session, the medium can be closed. +It will not take more writing unless it gets blanked or formatted. +So use command -close "on" to demand closing after writing. +{{{ + $ xorriso -md5 on -dev /dev/sr1 -close on -add /usr/sbin -- + ... + Written to media : 16160 sectors at LBA 195056 + Writing to '/dev/sr1' completed successfully. +}}} +Checkread +{{{ + $ xorriso -md5 on -indev /dev/sr1 -check_md5_r sorry / -- + ... + Media current: DVD-RW sequential recording + Media status : is written , is closed + Media summary: 3 sessions, 176368 data blocks, 344m data, 4064m free + ... + xorriso : UPDATE : 337.7m content bytes read in 97 seconds + File contents and their MD5 checksums match. +}}} + +----------------------------------------------------------------------------- + +If the drive tray can move by itself, you may now eject the medium: +{{{ + $ xorriso -outdev /dev/sr1 -eject all +}}} + +----------------------------------------------------------------------------- + +Other applicable media types: + +These test runs for sequential DVD-RW may be performed on CD-RW with the +same xorriso arguments. Be aware that /usr/lib will hardly fit on a CD. +So choose smaller directories for CD. + +-blank "deformat_quickest" addresses a peculiarity of DVD-RW. +It will work on other media like -blank "fast". + +Except the blanking runs, the tests may also be performed on BD-R, DVD-R, +DVD+R, and CD-R. But you would waste two media by this. + +The first session on CD will always be written with write type SAO, +further sessions will be written with TAO. + +CD-R and DVD-R have a simulation mode. It can be enabled by xorriso +command -dummy "on", but of course it will not produce readable results. +So this simulation is usable only for first sessions on blank media. + +----------------------------------------------------------------------------- + +Now for formatted overwritable media: + +All blank, write and check runs of above tests "Writing multiple sessions" +may also be performed with DVD+RW, DVD-RAM, formatted DVD-RW, and BD-RE. +There is no way to close formatted media. The command -close "on" +gets silently ignored. + +The write methods and states of formatted media differ from those of +sequential media. But xorriso presents to the user a unified +multi-session usage model, under the assumption that all emulated +sessions contain ISO 9660 filesystem images, which successively +build on each other. + +So from the view of xorriso commands, the only task which makes +them differ from sequential media, is to apply optional formatting +or re-formatting. +A special case are BD-R, which xorriso may format but will not bring +into (pseudo-) overwritable state. Formatted BD-R perform Defect +Management by default, which checkreads during writing and replaces +bad block. + +The mandatory formatting of unused DVD+RW and BD-RE is done by xorriso +automatically. Just start a normal write run. DVD-RAM are sold formatted. + +xorriso treats overwritable media with a valid ISO 9660 filesystem as +appendable media. To make then writable from scratch, apply +-blank "as_needed", which will actually write a few bytes into the PVD +(superblock) of the ISO filesystem to invalidate it. + +De-formatting is only possible with DVD-RW. E.g. by -blank "deformat". + +----------------------------------------------------------------------------- + +Format DVD-RW for overwriting without intermediate blanking, +or format BD-R for Defect Management: +{{{ + $ xorriso -outdev /dev/sr1 -format as_needed +}}} +should report on stderr +{{{ + ... + xorriso : UPDATE : Formatting ( 99.0% done in 116 seconds ) + Formatting done + xorriso : NOTE : Re-assessing -outdev '/dev/sr1' + Drive current: -outdev '/dev/sr1' + Media current: DVD-RW restricted overwrite + Media status : is blank + Media summary: 0 sessions, 0 data blocks, 0 data, 4488m free +}}} +As with blanking, one should not worry if the progress messages show +unplausible percentages. Some drives are more equal than others. + +Formatting is said to be much stress to the medium. -format option +"as_needed" applies it only to yet unformatted media. + +When performing above write tests, take care to use -blank "as_needed" +rather than -blank "deformat_quickest". Else you will get a sequential +unformatted DVD-RW rather than a formatted DVD-RW which xorriso is +willing to write from scratch. +There is no use in a separate "DAO" test on overwritable media anyway. + +----------------------------------------------------------------------------- + +Change the formatted size of a BD-RE: + +First learn about formatted size and proposals of other sizes. +(One can issue own wishes, too. See in man xorriso, command -format.) +{{{ + $ xorriso -outdev /dev/sr1 -list_formats +}}} +should tell on stdout +{{{ + ... + Format status: formatted, with 23610.0 MiB + BD Spare Area: 0 blocks consumed, 131072 blocks available + Format idx 0 : 00h , 11826176s , 23098.0 MiB + Format idx 1 : 01h , 11564032s , 22586.0 MiB + Format idx 2 : 30h , 11826176s , 23098.0 MiB + Format idx 3 : 30h , 11564032s , 22586.0 MiB + Format idx 4 : 30h , 12088320s , 23610.0 MiB + Format idx 5 : 31h , 12219392s , 23866.0 MiB +}}} +So lets go back from 23610.0 MiB to the default size of 23098.0 MiB +{{{ + $ xorriso -outdev /dev/sr1 -format by_index_2 -blank as_needed + ... + Media summary: 2 sessions, 105470 data blocks, 206m data, 22.4g free +}}} +Although the heads of the old sessions might remain readable after +-format, better do not rely on this and a append -blank "as_needed" to +avoid any data corruption. +If you want to keep the data, then make at least a checkread run. + +Check whether the size has changed: +{{{ + $ xorriso -outdev /dev/sr1 -list_formats +}}} +should tell on stdout +{{{ + ... + Format status: formatted, with 23098.0 MiB + BD Spare Area: 0 blocks consumed, 393216 blocks available + ... +}}} diff --git a/libisoburn/branches/1.1.8/doc/startup_file.txt b/libisoburn/branches/1.1.8/doc/startup_file.txt new file mode 100644 index 00000000..2c15d484 --- /dev/null +++ b/libisoburn/branches/1.1.8/doc/startup_file.txt @@ -0,0 +1,22 @@ +# This is an example for a xorriso startup file. +# If found at one of the following addresses then its text lines will get +# executed by xorriso as commands before any of its program arguments: +# /etc/default/xorriso +# /etc/opt/xorriso/rc +# /etc/xorriso/xorriso.conf +# $HOME/.xorrisorc +# Note: Command -no_rc as first program argument prevents this execution. + + +# Disallow the use of hard disk /dev/sda and its partitions as +# pseudo-drive (e.g. as output target of an ISO image). + +-drive_class banned /dev/sda* + + +# Allow the use of /dev/sdb, /dev/sdc, and /dev/sdd as pseudo-drives +# without the prefix "stdio:" which is usually required for device addresses +# which begin by "/dev/" but represent no CD drives. + +-drive_class harmless /dev/sd[bcd] + diff --git a/libisoburn/branches/1.1.8/libisoburn-1.pc.in b/libisoburn/branches/1.1.8/libisoburn-1.pc.in new file mode 100644 index 00000000..7fae3f90 --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn-1.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libisoburn +Description: Multi-session filesystem extension to libisofs, libburn. +Version: @VERSION@ +Requires: +Libs: -L${libdir} -lisoburn +Cflags: -I${includedir}/libisoburn + diff --git a/libisoburn/branches/1.1.8/libisoburn/burn_wrap.c b/libisoburn/branches/1.1.8/libisoburn/burn_wrap.c new file mode 100644 index 00000000..d0f8c230 --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/burn_wrap.c @@ -0,0 +1,2055 @@ + +/* + cc -g -c \ + -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE \ + burn_wrap.c +*/ +/* libburn wrappers for libisoburn + + Copyright 2007 - 2011 Thomas Schmitt, + Provided under GPL version 2 or later. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +/* <<< A70929 : hardcoded CD-RW with fabricated -msinfo +#define Hardcoded_cd_rW 1 +#define Hardcoded_cd_rw_c1 12999 +#define Hardcoded_cd_rw_nwA 152660 +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef Xorriso_standalonE + +#include +#include +#ifdef Xorriso_with_libjtE +#include +#endif + +#else /* ! Xorriso_standalonE */ + +#include "../libisofs/libisofs.h" +#include "../libburn/libburn.h" +#ifdef Xorriso_with_libjtE +#include "../libjte/libjte.h" +#endif + +#endif /* Xorriso_standalonE */ + + +#include "libisoburn.h" +#include "isoburn.h" + + +/* The global list of isoburn objects. Usually there is only one. */ +extern struct isoburn *isoburn_list_start; /* in isoburn.c */ + +/* Default values for application provided msgs_submit methods. + To be attached to newly aquired drives. + Storage location is isoburn.c +*/ +extern int (*libisoburn_default_msgs_submit) + (void *handle, int error_code, char msg_text[], + int os_errno, char severity[], int flag); +extern void *libisoburn_default_msgs_submit_handle; +extern int libisoburn_default_msgs_submit_flag; + + +static int isoburn_emulate_toc(struct burn_drive *d, int flag); + + +int isoburn_initialize(char msg[1024], int flag) +{ + int major, minor, micro, bad_match= 0, no_iso_init= 0; + + +/* First the ugly compile time checks for header version compatibility. + If everthing matches, then they produce no C code. In case of mismatch, + intentionally faulty C code will be inserted. +*/ + +#ifdef iso_lib_header_version_major +/* The minimum requirement of libisoburn towards the libisofs header + at compile time is defined in libisoburn/libisoburn.h : + isoburn_libisofs_req_major + isoburn_libisofs_req_minor + isoburn_libisofs_req_micro + It gets compared against the version macros in libisofs/libisofs.h : + iso_lib_header_version_major + iso_lib_header_version_minor + iso_lib_header_version_micro + If the header is too old then the following code shall cause failure of + libisoburn compilation rather than to allow production of a program with + unpredictable bugs or memory corruption. + The compiler messages supposed to appear in this case are: + error: 'LIBISOFS_MISCONFIGURATION' undeclared (first use in this function) + error: 'INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisofs_dot_h_TOO_OLD__SEE_libisoburn_dot_h_AND_burn_wrap_dot_h' undeclared (first use in this function) + error: 'LIBISOFS_MISCONFIGURATION_' undeclared (first use in this function) +*/ +/* The indendation is an advise of man gcc to help old compilers ignoring */ + #if isoburn_libisofs_req_major > iso_lib_header_version_major + #define Isoburn_libisofs_dot_h_too_olD 1 + #endif + #if isoburn_libisofs_req_major == iso_lib_header_version_major && isoburn_libisofs_req_minor > iso_lib_header_version_minor + #define Isoburn_libisofs_dot_h_too_olD 1 + #endif + #if isoburn_libisofs_req_minor == iso_lib_header_version_minor && isoburn_libisofs_req_micro > iso_lib_header_version_micro + #define Isoburn_libisofs_dot_h_too_olD 1 + #endif + +#ifdef Isoburn_libisofs_dot_h_too_olD +LIBISOFS_MISCONFIGURATION = 0; +INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisofs_dot_h_TOO_OLD__SEE_libisoburn_dot_h_AND_burn_wrap_dot_c = 0; +LIBISOFS_MISCONFIGURATION_ = 0; +#endif + +#endif /* iso_lib_header_version_major */ + +/* The minimum requirement of libisoburn towards the libburn header + at compile time is defined in libisoburn/libisoburn.h : + isoburn_libburn_req_major + isoburn_libburn_req_minor + isoburn_libburn_req_micro + It gets compared against the version macros in libburn/libburn.h : + burn_header_version_major + burn_header_version_minor + burn_header_version_micro + If the header is too old then the following code shall cause failure of + cdrskin compilation rather than to allow production of a program with + unpredictable bugs or memory corruption. + The compiler messages supposed to appear in this case are: + error: 'LIBBURN_MISCONFIGURATION' undeclared (first use in this function) + error: 'INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libburn_dot_h_TOO_OLD__SEE_libisoburn_dot_h_and_burn_wrap_dot_h' undeclared (first use in this function) + error: 'LIBBURN_MISCONFIGURATION_' undeclared (first use in this function) +*/ + +/* The indendation is an advise of man gcc to help old compilers ignoring */ + #if isoburn_libburn_req_major > burn_header_version_major + #define Isoburn_libburn_dot_h_too_olD 1 + #endif + #if isoburn_libburn_req_major == burn_header_version_major && isoburn_libburn_req_minor > burn_header_version_minor + #define Isoburn_libburn_dot_h_too_olD 1 + #endif + #if isoburn_libburn_req_minor == burn_header_version_minor && isoburn_libburn_req_micro > burn_header_version_micro + #define Isoburn_libburn_dot_h_too_olD 1 + #endif + +#ifdef Isoburn_libburn_dot_h_too_olD +LIBBURN_MISCONFIGURATION = 0; +INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libburn_dot_h_TOO_OLD__SEE_libisoburn_dot_h_and_burn_wrap_dot_h = 0; +LIBBURN_MISCONFIGURATION_ = 0; +#endif + + +#ifdef Xorriso_with_libjtE + +/* The minimum requirement of libisoburn towards the libjte header + at compile time is the same as the one of a usable libisfs itowards libjte. + So the requirement is defined in libisofs/libisofs.h : + iso_libjte_req_major , iso_libjte_req_minor , iso_libjte_req_micro +*/ + /* The indendation is an advise of man gcc to help old compilers ignoring */ + #if iso_libjte_req_major > LIBJTE_VERSION_MAJOR + #define Libisofs_libjte_dot_h_too_olD 1 + #endif + #if iso_libjte_req_major == LIBJTE_VERSION_MAJOR && iso_libjte_req_minor > LIBJTE_VERSION_MINOR + #define Libisofs_libjte_dot_h_too_olD 1 + #endif + #if iso_libjte_req_minor == LIBJTE_VERSION_MINOR && iso_libjte_req_micro > LIBJTE_VERSION_MICRO + #define Libisofs_libjte_dot_h_too_olD 1 + #endif + +#ifdef Libisofs_libjte_dot_h_too_olD +LIBJTE_MISCONFIGURATION = 0; +INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libjte_dot_h_TOO_OLD__SEE_libisofs_dot_h_AND_burn_wrap.c_c = 0; +LIBJTE_MISCONFIGURATION_ = 0; +#endif + +#endif /* Xorriso_with_libjtE */ + + +/* End of ugly compile time tests (scroll up for explanation) */ + + + msg[0]= 0; + +#ifdef Xorriso_with_libjtE + + libjte__version(&major, &minor, µ); + sprintf(msg + strlen(msg), "libjte-%d.%d.%d ", major, minor, micro); + if (libjte__is_compatible(LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR, + LIBJTE_VERSION_MICRO, 0)) { + sprintf(msg+strlen(msg), "ok, "); + } else { + sprintf(msg + strlen(msg), + "- TOO OLD -, need at least libjte-%d.%d.%d ,\n", + LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR, + LIBJTE_VERSION_MICRO); + bad_match= 1; + no_iso_init= 1; /* iso_init() will fail anyway */ + } + +#endif /* Xorriso_with_libjtE */ + + if(!no_iso_init) { + if(iso_init()<0) { + sprintf(msg+strlen(msg), "Cannot initialize libisofs\n"); + return(0); + } + } + iso_lib_version(&major, &minor, µ); + sprintf(msg+strlen(msg), "libisofs-%d.%d.%d ", major, minor, micro); +#ifdef iso_lib_header_version_major + if(iso_lib_is_compatible(iso_lib_header_version_major, + iso_lib_header_version_minor, + iso_lib_header_version_micro)) { + sprintf(msg+strlen(msg), "ok, "); + } else { + sprintf(msg+strlen(msg),"- TOO OLD -, need at least libisofs-%d.%d.%d ,\n", + iso_lib_header_version_major, iso_lib_header_version_minor, + iso_lib_header_version_micro); + bad_match= 1; + } +#else + if(iso_lib_is_compatible(isoburn_libisofs_req_major, + isoburn_libisofs_req_minor, + isoburn_libisofs_req_micro)) { + sprintf(msg+strlen(msg), "suspicious, "); + } else { + sprintf(msg+strlen(msg),"- TOO OLD -, need at least libisofs-%d.%d.%d ,\n", + isoburn_libisofs_req_major, isoburn_libisofs_req_minor, + isoburn_libisofs_req_micro); + bad_match= 1; + } +#endif /* ! iso_lib_header_version_major */ + + if(!burn_initialize()) { + sprintf(msg+strlen(msg), "Cannot initialize libburn\n"); + return(0); + } + + burn_version(&major, &minor, µ); + sprintf(msg+strlen(msg), "libburn-%d.%d.%d ", major, minor, micro); + if(major > burn_header_version_major + || (major == burn_header_version_major + && (minor > burn_header_version_minor + || (minor == burn_header_version_minor + && micro >= burn_header_version_micro)))) { + sprintf(msg+strlen(msg), "ok, "); + } else { + sprintf(msg+strlen(msg), "- TOO OLD -, need at least libburn-%d.%d.%d ,\n", + burn_header_version_major, burn_header_version_minor, + burn_header_version_micro); + bad_match= 1; + } + + isoburn_version(&major, &minor, µ); + sprintf(msg+strlen(msg), "for libisoburn-%d.%d.%d", major, minor, micro); + if(bad_match) + return(0); + + isoburn_destroy_all(&isoburn_list_start, 0); /* isoburn_list_start= NULL */ + return(1); +} + + +/* API @since 0.1.0 */ +int isoburn_libisofs_req(int *major, int *minor, int *micro) +{ + *major= iso_lib_header_version_major; + *minor= iso_lib_header_version_minor; + *micro= iso_lib_header_version_micro; + return(1); +} + + +/* API @since 0.1.0 */ +int isoburn_libburn_req(int *major, int *minor, int *micro) +{ + *major= burn_header_version_major; + *minor= burn_header_version_minor; + *micro= burn_header_version_micro; + return(1); +} + + +/* API @since 0.6.4 */ +int isoburn_libjte_req(int *major, int *minor, int *micro) +{ +#ifdef Xorriso_with_libjtE + *major= LIBJTE_VERSION_MAJOR; + *minor= LIBJTE_VERSION_MINOR; + *micro= LIBJTE_VERSION_MICRO; +#else + *major= *minor= *micro= 0; +#endif /* ! Xorriso_with_libjtE */ + return(1); +} + + +int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code, + char msg_text[], int os_errno, + char severity[], int flag), + void *submit_handle, int submit_flag, int flag) +{ + libisoburn_default_msgs_submit= msgs_submit; + libisoburn_default_msgs_submit_handle= submit_handle; + libisoburn_default_msgs_submit_flag= submit_flag; + return(1); +} + + +int isoburn_is_intermediate_dvd_rw(struct burn_drive *d, int flag) +{ + int profile, ret= 0, format_status, num_formats; + char profile_name[80]; + enum burn_disc_status s; + off_t format_size= -1; + unsigned bl_sas; + + s= isoburn_disc_get_status(d); + ret= burn_disc_get_profile(d, &profile, profile_name); + if(ret>0 && profile==0x13) + ret= burn_disc_get_formats(d, &format_status, &format_size, + &bl_sas, &num_formats); + if(ret>0 && profile==0x13 && s==BURN_DISC_BLANK && + format_status==BURN_FORMAT_IS_UNKNOWN) + return(1); + return(0); +} + + +/** Examines the medium and sets appropriate emulation if needed. + @param flag bit0= pretent blank on overwriteable media + bit3= if the drive reports a -ROM profile then try to read + table of content by scanning for ISO image headers. + bit4= do not emulate TOC on overwriteable media + bit5= ignore ACL from external filesystems + bit6= ignore POSIX Extended Attributes from external filesystems + bit7= pretend -ROM and scan for table of content +*/ +static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d, + int flag) +{ + int ret, profile, readonly= 0, role, random_access; + int emulation_started= 0; + struct burn_multi_caps *caps= NULL; + struct isoburn_toc_entry *t; + char profile_name[80]; + struct isoburn_toc_disc *disc= NULL; + struct isoburn_toc_session **sessions; + struct isoburn_toc_track **tracks; + int num_sessions= 0, num_tracks= 0, track_count= 0, session_no= 0; + char msg[80]; + enum burn_disc_status s; + +#ifndef Hardcoded_cd_rW + int lba, nwa; +#endif + + s= burn_disc_get_status(d); + profile_name[0]= 0; + ret= burn_disc_get_profile(d, &profile, profile_name); + if(ret<=0) + profile= 0x00; + ret= burn_disc_get_multi_caps(d, BURN_WRITE_NONE, &caps, 0); + if(ret<0) /*== 0 is read-only medium, but it is too early to reject it here */ + goto ex; + if(ret==0 || (flag & 128)) + readonly= 1; + if(flag & 128) + flag = (flag & ~ 16) | 8; + + ret= isoburn_new(o, 0); + if(ret<=0) + goto ex; + (*o)->drive= d; + (*o)->msgs_submit= libisoburn_default_msgs_submit; + (*o)->msgs_submit_handle= libisoburn_default_msgs_submit_handle; + (*o)->msgs_submit_flag= libisoburn_default_msgs_submit_flag; + iso_image_set_ignore_aclea((*o)->image, (flag >> 5 ) & 3); + +#ifdef Hardcoded_cd_rW + /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */ + caps->start_adr= 0; + (*o)->fabricated_disc_status= BURN_DISC_APPENDABLE; +#endif + + role= burn_drive_get_drive_role(d); + random_access= caps->start_adr || role == 4; + if(random_access) + (*o)->emulation_mode= 1; + if(random_access && !readonly) { /* set emulation to overwriteable */ + ret= isoburn_is_intermediate_dvd_rw(d, 0); + if(ret>0) { + (*o)->min_start_byte= 0; + (*o)->nwa= 0; + (*o)->zero_nwa= 0; + } + if((flag & 1) && role != 4 && role != 5) { + (*o)->nwa= (*o)->zero_nwa; + (*o)->fabricated_disc_status= BURN_DISC_BLANK; + } else { + ret= isoburn_start_emulation(*o, 0); + if(ret<=0) { + (*o)->emulation_mode= -1; + goto ex; + } + emulation_started= 1; + /* try to read emulated toc */ + ret= isoburn_emulate_toc(d, flag & 16); + if(ret<0) { + (*o)->emulation_mode= -1; + goto ex; + } + } + } else { + + /* >>> recognize unsuitable media (but allow read-only media) */; + + if(readonly && s != BURN_DISC_EMPTY) { + + /* >>> ts B10712: This maps BURN_DISC_UNSUITABLE to BURN_DISC_FULL + which can hardly be correct in general. + ??? What reason does this have ? + */ + (*o)->fabricated_disc_status= BURN_DISC_FULL; + + /* This might be an overwriteable medium in a -ROM drive. + Pitfall: + Multi-session media which bear a xorriso image for overwriteables + in their first session would get a TOC of that first image rather + than of the medium. + It is not possible to distinguish a BD-RE from a single session + BD-R with an image for overwriteables. But as soon as the medium + bears 2 logical tracks it cannot be overwriteable. + So count the number of tracks first. + */ + disc= isoburn_toc_drive_get_disc(d); + if(disc != NULL) { + sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); + for(session_no= 0; session_no < num_sessions; session_no++) { + tracks= isoburn_toc_session_get_tracks(sessions[session_no], + &num_tracks); + if(tracks != NULL) + track_count+= num_tracks; + } + isoburn_toc_disc_free(disc); + } + + sprintf(msg, "ROM medium has libburn track count = %d", track_count); + isoburn_msgs_submit(*o, 0x00060000, msg, 0, "DEBUG", 0); + + if((flag & 16) || track_count >= 2) { + ret= 0; /* toc emulation off, or not overwriteable */ + } else { + ret= isoburn_start_emulation(*o, 1); + if(ret<=0) { + (*o)->emulation_mode= -1; + goto ex; + } + emulation_started= 1; + ret= isoburn_emulate_toc(d, 1); + if(ret<0) + goto ex; + else if(ret > 0) + (*o)->emulation_mode= 1; + } + if(ret == 0 && (profile != 0x08 || (flag & 128)) && (flag & 8)) { + /* This might also be multi-session media which do not + get shown with a decent TOC. + CD-R TOC (profile 0x08) can be trusted. Others not. + Do a scan search of ISO headers. + */ + if(!emulation_started) { + ret= isoburn_start_emulation(*o, 1); + if(ret<=0) { + (*o)->emulation_mode= -1; + goto ex; + } + } + ret= isoburn_emulate_toc(d, 1|2); + if(ret<0) + goto ex; + if(ret>0) { /* point msc1 to last session */ + if((*o)->toc!=NULL) { + for(t= (*o)->toc; t->next!=NULL; t= t->next); + (*o)->fabricated_msc1= t->start_lba; + } + } + } + } +#ifdef Hardcoded_cd_rW + (*o)->nwa= Hardcoded_cd_rw_nwA; +#else + ret= burn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa); + if(ret>0) + (*o)->nwa= nwa; + if((*o)->nwa < (*o)->zero_nwa) + (*o)->zero_nwa= 0; +#endif + + } + + ret= 1; +ex: + if(caps!=NULL) + burn_disc_free_multi_caps(&caps); + return(ret); +} + + +/** + @param flag bit0= load + bit1= regard overwriteable media as blank + bit2= if the drive is a regular disk file: truncate it to + the write start address + bit3= if the drive reports a -ROM profile then try to read + table of content by scanning for ISO image headers. + (depending on media type and drive state this might + help or it might make the resulting toc even worse) + bit4= do not emulate TOC on overwriteable media + bit5= ignore ACL from external filesystems + bit6= ignore POSIX Extended Attributes from external filesystems + bit7= pretend -ROM profile and scan for table of content + bit8= re-assess (*drive_infos)[0] rather than aquiring adr +*/ +int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], + char *adr, int flag) +{ + int ret, drive_grabbed= 0; + struct isoburn *o= NULL; + int conv_ret; + char *libburn_drive_adr= NULL; + + /* Should be obsolete by new drive addressing of libburn-0.5.2 */ + /* but helps with kernel 2.4 to use /dev/sr */ + libburn_drive_adr= calloc(1, BURN_DRIVE_ADR_LEN); + if(libburn_drive_adr == NULL) + {ret= -1; goto ex;} + conv_ret= burn_drive_convert_fs_adr(adr, libburn_drive_adr); + if(conv_ret<=0) + strcpy(libburn_drive_adr, adr); + + if(flag & 256) + ret= burn_drive_re_assess((*drive_infos)[0].drive, 0); + else + ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, flag&1); + if(ret<=0) + goto ex; + drive_grabbed= 1; + ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive, + (flag & (8 | 16 | 32 | 64 | 128)) | !!(flag&2)); + if(ret<=0) + goto ex; + + if(flag&4) { + ret= isoburn_find_emulator(&o, (*drive_infos)[0].drive, 0); + if(ret>0 && o!=NULL) + o->truncate= 1; + } + + ret= 1; +ex: + if(ret<=0) { + if(drive_grabbed) + burn_drive_release((*drive_infos)[0].drive, 0); + isoburn_destroy(&o, 0); + } + if(libburn_drive_adr != NULL) + free(libburn_drive_adr); + return(ret); +} + + +int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], + char *adr, int load) +{ + int ret; + + ret= isoburn_drive_aquire(drive_infos, adr, !!load); + return(ret); +} + + +int isoburn_drive_grab(struct burn_drive *drive, int load) +{ + int ret; + struct isoburn *o= NULL; + + ret= burn_drive_grab(drive, load); + if(ret<=0) + goto ex; + ret= isoburn_welcome_media(&o, drive, 0); + if(ret<=0) + goto ex; + + ret= 1; +ex: + if(ret<=0) + isoburn_destroy(&o,0); + return(ret); +} + + +/** Retrieve medium emulation and eventual isoburn emulator of drive. + @return -1 unsuitable medium, 0 generic medium, 1 emulated medium. +*/ +int isoburn_find_emulator(struct isoburn **pt, + struct burn_drive *drive, int flag) +{ + int ret; + + ret= isoburn_find_by_drive(pt, drive, 0); + if(ret<=0) + return(0); + if((*pt)->emulation_mode==-1) { + isoburn_msgs_submit(*pt, 0x00060000, + "Unsuitable drive and medium state", 0, "FAILURE", 0); + return(-1); + } + if((*pt)->emulation_mode==0) + return(0); + return(1); +} + + +enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, drive, 0); + if(ret<0) + return(BURN_DISC_UNSUITABLE); + if(o!=NULL) + if(o->fabricated_disc_status!=BURN_DISC_UNREADY) + return(o->fabricated_disc_status); + if(ret==0) + return(burn_disc_get_status(drive)); + + /* emulated status */ + if(o->emulation_mode==-1) + return(BURN_DISC_UNSUITABLE); + if(o->nwa>o->zero_nwa) + return(BURN_DISC_APPENDABLE); + return(BURN_DISC_BLANK); +} + + +int isoburn_disc_erasable(struct burn_drive *d) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret>0) + if(o->emulation_mode==1) + return(1); + return burn_disc_erasable(d); +} + + +void isoburn_disc_erase(struct burn_drive *drive, int fast) +{ + int ret, do_pseudo_blank= 0, role; + struct isoburn *o; + enum burn_disc_status s; + char *zero_buffer= NULL; + struct burn_multi_caps *caps= NULL; + + zero_buffer= calloc(1, Libisoburn_target_head_sizE); + if(zero_buffer == NULL) { + /* To cause a negative reply with burn_drive_wrote_well() */ + burn_drive_cancel(drive); + goto ex; + } + + ret= isoburn_find_emulator(&o, drive, 0); + if(ret>0) { + if(o->emulation_mode==-1) { + /* To cause a negative reply with burn_drive_wrote_well() */ + burn_drive_cancel(drive); + goto ex; + } + role = burn_drive_get_drive_role(drive); + if (role == 5) { + /* libburn will truncate the random-access write-only file + to zero size and change its state */ + burn_disc_erase(drive, fast); + o->fabricated_disc_status= burn_disc_get_status(drive); + o->nwa= o->zero_nwa= 0; + goto ex; + } + if(o->emulation_mode > 0) { /* might be readonly with emulated sessions */ + ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0); + if(ret > 0 && caps->start_adr) + do_pseudo_blank= 1; + } + if(do_pseudo_blank) { + s= isoburn_disc_get_status(drive); + if(s==BURN_DISC_FULL) { /* unknown data format in first 64 kB */ + memset(zero_buffer, 0, Libisoburn_target_head_sizE); + ret= burn_random_access_write(drive, (off_t) 0, zero_buffer, + (off_t) Libisoburn_target_head_sizE, 1); + } else { + ret= isoburn_invalidate_iso(o, 0); + } + if(ret<=0) + burn_drive_cancel(drive); /* mark run as failure */ + goto ex; + } + } + burn_disc_erase(drive, fast); +ex:; + if(caps!=NULL) + burn_disc_free_multi_caps(&caps); + if(zero_buffer != NULL) + free(zero_buffer); +} + + +off_t isoburn_disc_available_space(struct burn_drive *d, + struct burn_write_opts *opts) +{ + int ret; + struct isoburn *o; + struct burn_write_opts *eff_opts= NULL, *local_opts= NULL; + enum burn_disc_status s; + off_t avail; + + eff_opts= opts; + ret= isoburn_find_emulator(&o, d, 0); + if(ret>0 && o!=NULL) + if(o->emulation_mode!=0) { + s= isoburn_disc_get_status(d); + if(s==BURN_DISC_FULL) /* unknown data format in first 64 kB */ + return((off_t) 0); + local_opts= burn_write_opts_new(d); + eff_opts= local_opts; + burn_write_opts_set_start_byte(eff_opts, ((off_t) o->nwa) * (off_t) 2048); + } + avail= burn_disc_available_space(d, eff_opts); + if(local_opts!=NULL) + burn_write_opts_free(local_opts); + local_opts= NULL; + return(avail); +} + + +int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba) +{ + int ret; + struct isoburn *o; + +#ifdef Hardcoded_cd_rW + /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */ + *start_lba= Hardcoded_cd_rw_c1; + return(1); +#endif + + if(isoburn_disc_get_status(d)!=BURN_DISC_APPENDABLE && + isoburn_disc_get_status(d)!=BURN_DISC_FULL) { + isoburn_msgs_submit(NULL, 0x00060000, + "Medium contains no recognizable data", 0, "SORRY", 0); + return(0); + } + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(0); + if(o->fabricated_msc1>=0) { + *start_lba= o->fabricated_msc1; + return(1); + } + if(ret>0) if(o->emulation_mode>0) { + *start_lba= 0; + return(1); + } + return(burn_disc_get_msc1(d, start_lba)); +} + + +int isoburn_disc_track_lba_nwa(struct burn_drive *d, + struct burn_write_opts *opts, + int trackno, int *lba, int *nwa) +{ + int ret; + struct isoburn *o; + enum burn_disc_status s; + +#ifdef Hardcoded_cd_rW + /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */ + *lba= Hardcoded_cd_rw_c1; + *nwa= Hardcoded_cd_rw_nwA; + return(1); +#endif + + *nwa= *lba= 0; + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(0); + if(ret>0) if(o->emulation_mode>0) { + *lba= 0; + *nwa= o->nwa; + return(1); + } + if(burn_drive_get_drive_role(d) != 1) + return(1); + + s= isoburn_disc_get_status(d); + if(s == BURN_DISC_BLANK) /* We do not believe in anything but nwa = lba = 0 */ + return(1); + return(burn_disc_track_lba_nwa(d, opts, trackno, lba, nwa)); +} + + +int isoburn_get_msc2(struct isoburn *o, + struct burn_write_opts *opts, int *msc2, int flag) +{ + int ret, lba, nwa; + + if(o->fabricated_msc2>=0) + *msc2= o->fabricated_msc2; + else { + ret= isoburn_disc_track_lba_nwa(o->drive, opts, 0, &lba, &nwa); + if(ret<=0) + return(ret); + *msc2= nwa; + } + return(1); +} + +/* @param flag bit0= truncate (else do not truncate) + bit1= do not warn if call is inappropriate to drive + bit2= only set if truncation is currently enabled +*/ +int isoburn_set_truncate(struct burn_drive *drive, int flag) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, drive, 0); + if(ret < 0) + return ret; + if(o == NULL) { + if(!(flag & (2 | 4))) + isoburn_msgs_submit(o, 0x00060000, + "Drive type or role is inappropriate for truncation", 0, "WARNING", 0); + return(0); + } + if(o->truncate || !(flag & 4)) + o->truncate= flag & 1; + return(1); +} + + +void isoburn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc) +{ + int ret; + off_t nwa= 0; + struct isoburn *o; + struct burn_drive *drive; + char *reasons= NULL, *msg= NULL, *adr= NULL; + enum burn_write_types write_type; + struct stat stbuf; + + drive= burn_write_opts_get_drive(opts); + + reasons= calloc(1, BURN_REASONS_LEN); + msg= calloc(1, 160+BURN_REASONS_LEN); + adr= calloc(1, BURN_DRIVE_ADR_LEN); + if(reasons == NULL || msg == NULL || adr == NULL) { + /* To cause a negative reply with burn_drive_wrote_well() */ + burn_drive_cancel(drive); + goto ex; + } + + ret= isoburn_find_emulator(&o, drive, 0); + if(ret<0) + goto ex; + if(o!=NULL) { + o->wrote_well= -1; + if(o->emulation_mode!=0) { + burn_write_opts_set_multi(opts, 0); + if(o->emulation_mode>0 && o->nwa >= 0) { + nwa= o->nwa; + + /* This caters for unwritten formatted DVD-RW. They need to be written + sequentially on the first use. Only written areas are random access. + If the first session is not written to LBA 0, then re-opening of + formatting and padding is needed. + This can be done. But when the track gets closed after padding, + this lasts a long time. There is a high risk that an app will not + poll the message queue while waiting for isoburn_disc_write() to + return. The pacifier loop usually happens only afterwards. + So automatic formatting might cause a nervous clueless user. + */ + ret= isoburn_is_intermediate_dvd_rw(drive, 0); + if(ret>0 && nwa>0 && nwa <= o->zero_nwa) { + /* actually this should not happen since such media get recognized + by isoburn_welcome_media and o->zero_nwa gets set to 0 + */ + sprintf(msg, + "DVD-RW insufficiently formatted. (Intermediate State, size unknown)"); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); + sprintf(msg, + "It might help to first deformat it and then format it again"); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "HINT", 0); + burn_drive_cancel(drive); /* mark run as failure */ + goto ex; + } + /* end of DVD-RW oriented check */ + burn_write_opts_set_start_byte(opts, nwa * (off_t) 2048); + } + } + } + + write_type= burn_write_opts_auto_write_type(opts, disc, reasons, 0); + if (write_type == BURN_WRITE_NONE) { + sprintf(msg, "Failed to find a suitable write mode:\n%s", reasons); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); + if(o!=NULL) + o->wrote_well= 0; + /* To cause a negative reply with burn_drive_wrote_well() */ + burn_drive_cancel(drive); + goto ex; + } + + sprintf(reasons, "%d", (int) write_type); + sprintf(msg, "Write_type = %s\n", + (write_type == BURN_WRITE_SAO ? "SAO" : + (write_type == BURN_WRITE_TAO ? "TAO" : reasons))); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "DEBUG", 0); + +#ifdef Hardcoded_cd_rW + /* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */ + fprintf(stderr, "Setting write address to LBA %d\n", Hardcoded_cd_rw_nwA); + burn_write_opts_set_start_byte(opts, + ((off_t) Hardcoded_cd_rw_nwA) * (off_t) 2048); +#endif + + if(o->truncate) { + ret= burn_drive_get_drive_role(drive); + if(ret == 2 || ret == 5) { + ret= burn_drive_d_get_adr(drive, adr); + if(ret>0) { + ret= lstat(adr, &stbuf); + if(ret!=-1) + if(S_ISREG(stbuf.st_mode)) + ret= truncate(adr, nwa * (off_t) 2048); + /* (result of truncate intentionally ignored) */ + } + } + } + + burn_disc_write(opts, disc); +ex:; + if(reasons != NULL) + free(reasons); + if(msg != NULL) + free(msg); + if(adr != NULL) + free(adr); +} + + +void isoburn_drive_release(struct burn_drive *drive, int eject) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, drive, 0); + if(ret<0) + return; + if(o!=NULL) { + isoburn_destroy(&o, 0); + } + burn_drive_release(drive, eject); +} + + +void isoburn_finish(void) +{ + isoburn_destroy_all(&isoburn_list_start, 0); + burn_finish(); + iso_finish(); +} + + +int isoburn_needs_emulation(struct burn_drive *drive) +{ + int ret; + struct isoburn *o; + enum burn_disc_status s; + + s= isoburn_disc_get_status(drive); + if(s!=BURN_DISC_BLANK && s!=BURN_DISC_APPENDABLE) + return(-1); + ret= isoburn_find_emulator(&o, drive, 0); + if(ret<0) + return(-1); + if(ret>0) + if(o->emulation_mode>0) + return(1); + return(0); +} + + +int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag) +{ + int ret; + struct burn_drive *drive = o->drive; + struct burn_multi_caps *caps= NULL; + + ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0); + if(ret<=0) + goto ex; + if(!caps->start_adr) { + isoburn_msgs_submit(o, 0x00060000, + "Cannot set start byte address with this type of media", + 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + o->min_start_byte= value; + if(value % caps->start_alignment) + value+= caps->start_alignment - (value % caps->start_alignment); + o->nwa= value/2048; + if(o->nwa < o->zero_nwa) + o->zero_nwa= 0; + /* If suitable for media alignment, round up to Libisoburn_nwa_alignemenT */ + if((o->nwa % Libisoburn_nwa_alignemenT) && + ((Libisoburn_nwa_alignemenT*2048) % caps->start_alignment)==0 ) + o->nwa+= Libisoburn_nwa_alignemenT - (o->nwa % Libisoburn_nwa_alignemenT); + ret= 1; +ex: + if(caps!=NULL) + burn_disc_free_multi_caps(&caps); + return(ret); +} + + +int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, + int flag) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(-1); + if(ret==0) + return(0); + *start_byte= o->min_start_byte; + if(o->min_start_byte<=0) + return(0); + return(1); +} + + +int isoburn_drive_wrote_well(struct burn_drive *d) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(-1); + if(o!=NULL) + if(o->wrote_well>=0) + return(o->wrote_well); + ret= burn_drive_wrote_well(d); + return ret; +} + + +int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes, + char **status_text) +{ + int ret; + struct isoburn *o; + size_t hsize= 0, hfree_bytes= 0; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(-1); + + if(o==NULL) + return(-1); + if(o->iso_source==NULL) + return(-1); + ret= iso_ring_buffer_get_status(o->iso_source, &hsize, &hfree_bytes); + if(hsize > 1024*1024*1024) + *size= 1024*1024*1024; + else + *size= hsize; + if(hfree_bytes > 1024*1024*1024) + *free_bytes= 1024*1024*1024; + else + *free_bytes= hfree_bytes; + *status_text= ""; + if(ret==0) + *status_text= "standby"; + else if(ret==1) + *status_text= "active"; + else if(ret==2) + *status_text= "ending"; + else if(ret==3) + *status_text= "failing"; + else if(ret==4) + *status_text= "unused"; + else if(ret==5) + *status_text= "abandoned"; + else if(ret==6) + *status_text= "ended"; + else if(ret==7) + *status_text= "aborted"; + return(ret); +} + + +/* @param flag bit0= -reserved- + bit1= this is a libburn severity +*/ +int isoburn__sev_to_text(int severity, char **severity_name, + int flag) +{ + int ret; + + ret= iso_sev_to_text(severity, severity_name); + if(ret>0) + return(ret); + ret= burn_sev_to_text(severity, severity_name, 0); + return(ret); +} + + +int isoburn__text_to_sev(char *severity_name, int *severity_number, int flag) +{ + int ret= 1; + + ret= iso_text_to_sev(severity_name, severity_number); + if(ret>0) + return(ret); + ret= burn_text_to_sev(severity_name, severity_number, 0); + return(ret); +} + + +int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno, + char min_severity[], int flag) +{ + int error_code, iso_sev, min_sev, ret; + char *sev_text_pt, *msg_text_pt= NULL; + + error_code= iso_error_get_code(iso_error_code); + if(error_code < 0x00030000 || error_code >= 0x00040000) + error_code= (error_code & 0xffff) | 0x00050000; + + if(iso_error_code<0) + msg_text_pt= (char *) iso_error_to_msg(iso_error_code); + if(msg_text_pt==NULL) + msg_text_pt= msg_text; + iso_sev= iso_error_get_severity(iso_error_code); + sev_text_pt= min_severity; + isoburn__text_to_sev(min_severity, &min_sev, 0); + if(min_sev < iso_sev) + isoburn__sev_to_text(iso_sev, &sev_text_pt, 0); + ret= iso_msgs_submit(error_code, msg_text_pt, os_errno, sev_text_pt, 0); + return(ret); +} + + +/* @param flag bit0-7: info return mode + 0= do not return anything in info (do not even touch it) + 1= copy volume id to info (info needs 33 bytes) + 2= do not touch info (caller will copy 64 kB header to it) + bit14= -reserved - + bit15= -reserved- + @return 1 seems to be a valid ISO image , 0 format not recognized, <0 error +*/ +int isoburn_read_iso_head_parse(struct burn_drive *d, unsigned char *data, + int *image_blocks, char *info, int flag) +{ + int i, info_mode; + + /* is this an ISO image ? */ + if(data[0]!=1) + return(0); + if(strncmp((char *) (data+1),"CD001",5)!=0) + return(0); + /* believe so */ + + *image_blocks= data[80] | (data[81]<<8) | (data[82]<<16) | (data[83]<<24); + info_mode= flag&255; + if(info_mode==0) { + ; + } else if(info_mode==1) { + strncpy(info, (char *) (data+40), 32); + info[32]= 0; + for(i= strlen(info)-1; i>=0; i--) + if(info[i]!=' ') + break; + else + info[i]= 0; + } else if(info_mode==2) { + ; + } else { + isoburn_msgs_submit(NULL, 0x00060000, + "Program error: Unknown info mode with isoburn_read_iso_head()", + 0, "FATAL", 0); + return(-1); + } + return(1); +} + + +/* API + @param flag bit0-7: info return mode + 0= do not return anything in info (do not even touch it) + 1= copy volume id to info (info needs 33 bytes) + 2= copy 64 kB header to info (needs 65536 bytes) + bit13= do not read head from media but use first 64 kB from info + bit14= check both half buffers (not only second) + return 2 if found in first block + bit15= return-1 on read error + @return 1 seems to be a valid ISO image , 2 found in first half buffer, + 0 format not recognized, <0 error +*/ +int isoburn_read_iso_head(struct burn_drive *d, int lba, + int *image_blocks, char *info, int flag) +{ + unsigned char *buffer= NULL; + int ret, info_mode, capacity, role; + off_t data_count, to_read; + struct isoburn *o; + + buffer= calloc(1, 64 * 1024); + if(buffer == NULL) + {ret= -1; goto ex;} + + info_mode= flag&255; + *image_blocks= 0; + if(flag&(1<<13)) { + memcpy(buffer, info, 64*1024); + } else { + memset(buffer, 0, 64 * 1024); + role = burn_drive_get_drive_role(d); + if (role == 3 || role == 5) + + /* >>> ??? return always 0 ? */ + {ret= (-1*!!(flag&(1<<15))); goto ex;} + + ret = burn_get_read_capacity(d, &capacity, 0); + if (ret <= 0 && (role == 2 || role == 4)) { + /* Might be a block device on a system where libburn cannot determine its + size. Try to read anyway. */ + capacity = 0x7ffffff0; + ret = 1; + } + to_read= (off_t) capacity * ((off_t) 2048); + if(ret > 0 && to_read >= (off_t) (36 * 1024)) { + ret= isoburn_find_emulator(&o, d, 0); + if(ret > 0) + if(o->media_read_error) + {ret= (-1 * !!(flag & (1 << 15))); goto ex;} + if(to_read >= (off_t) (64 * 1024)) + to_read= 64 * 1024; + ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer, + to_read, &data_count, 2); /* no error messages */ + } else + ret= 0; + if(ret<=0) + {ret= (-1*!!(flag&(1<<15))); goto ex;} + if(info_mode==2) + memcpy(info, buffer, 64*1024); + } + + if(flag&(1<<14)) { + ret= isoburn_read_iso_head_parse(d, buffer, image_blocks, info, info_mode); + if(ret<0) + goto ex; + if(ret>0) + {ret= 2; goto ex;} + } + ret= isoburn_read_iso_head_parse(d, buffer+32*1024, image_blocks, info, + info_mode); + if(ret<=0) + goto ex; + ret= 1; +ex:; + if(buffer != NULL) + free(buffer); + return(ret); +} + + +int isoburn_make_toc_entry(struct isoburn *o, int *session_count, int lba, + int track_blocks, char *volid, int flag) +{ + int ret; + struct isoburn_toc_entry *item; + + ret= isoburn_toc_entry_new(&item, o->toc, 0); + if(ret<=0) { +no_memory:; + isoburn_msgs_submit(o, 0x00060000, + "Not enough memory for emulated TOC entry object", + 0, "FATAL", 0); + return(-1); + } + if(o->toc==NULL) + o->toc= item; + (*session_count)++; + item->session= *session_count; + item->track_no= *session_count; + item->start_lba= lba; + item->track_blocks= track_blocks; + if(volid != NULL) { + item->volid= strdup(volid); + if(item->volid == NULL) + goto no_memory; + } + return(1); +} + + +/* @param flag bit0= allow unemulated media + bit1= free scanning without enclosing LBA-0-header + bit4= represent emulated media as one single session + (not with bit1) + @return -1 severe error, 0= no neat header chain, 1= credible chain read +*/ +int isoburn_emulate_toc(struct burn_drive *d, int flag) +{ + int ret, image_size= 0, lba, track_blocks, session_count= 0, read_flag= 0; + int scan_start= 0, scan_count= 0, probe_minus_16= 0, growisofs_nwa, role; + int with_enclosure= 0, readable_blocks= -1; + struct isoburn *o; + char *msg= NULL, *size_text= NULL, *sev, volid[33], *volid_pt= NULL; + time_t start_time, last_pacifier, now; + + msg= calloc(1, 160); + size_text= calloc(1, 80); + if(msg == NULL || size_text == NULL) + {ret= -1; goto ex;} + + /* is the medium emulated multi-session ? */ + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + {ret= -1; goto ex;} + if(o==NULL) + {ret= -1; goto ex;} + if(o->emulation_mode<=0 && !(flag&1)) + {ret= 0; goto ex;} + + ret= burn_get_read_capacity(d, &readable_blocks, 0); + if(ret <= 0) { + role = burn_drive_get_drive_role(d); + if (role == 2 || role == 4) + /* Might be a block device on a system where libburn cannot determine its + size. Try to read anyway. */ + readable_blocks= 0x7ffffff0; /* try to read anyway */ + else + readable_blocks= -1; + } + if(o->fabricated_disc_status == BURN_DISC_BLANK) + {ret= 0; goto failure;} + + start_time= last_pacifier= time(NULL); + lba= 0; + if(!(flag&2)) { + ret= isoburn_read_iso_head(d, lba, &image_size, NULL, 0); + if(ret<=0) + {ret= 0; goto failure;} + lba= o->target_iso_head_size / 2048; + with_enclosure= 1; + if((flag & 16) && o->emulation_mode == 1) { + ret= 1; + goto failure; /* This will represent the medium as single session */ + } + } + while(lba= 5) { + last_pacifier= now; + if(scan_count>=10*512) + sprintf(size_text, "%.f MB", ((double) scan_count) / 512.0); + else + sprintf(size_text, "%.f kB", 2 * (double) scan_count); + sprintf(msg, "Found %d ISO sessions by scanning %s in %.f seconds", + session_count, size_text, (double) (now - start_time)); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "UPDATE", 0); + } + read_flag= 1; + if(flag&2) + read_flag|= (1<<15)|((session_count>0)<<14); + else { + + /* growisofs aligns to 16 rather than 32. Overwriteable TOC emulation + relies on not accidentially seeing inter-session trash data. + But one can safely access 16 blocks earlier because a xorriso header + would have been overwritten with the unused 16 blocks at its start. + If libisoburn alignment would increase, then this would not be + possible any more. + */ + + if(probe_minus_16) + read_flag|= (1<<14); + probe_minus_16= 0; + } + + ret= isoburn_read_iso_head(d, lba, &track_blocks, volid, read_flag); + if(ret > 0) { + volid_pt= volid; + } else { + volid_pt= NULL; + if(session_count>0) { + if(flag&2) { + if(ret==0) { + /* try at next 64 k block (check both 32 k halves) */ + lba+= 32; + scan_count+= 32; + if(lba-scan_start <= Libisoburn_toc_scan_max_gaP) + continue; + } + break; + } + sprintf(msg, + "Chain of ISO session headers broken at #%d, LBA %ds", + session_count+1, lba); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "WARNING", 0); + + if(with_enclosure) { + ret= isoburn_make_toc_entry(o, &session_count, 0, image_size, NULL,0); + if(ret<=0) + goto failure; + } + break; /* do not return failure */ + + } + {ret= 0; goto failure;} + } + if(ret==2) /* ISO header was found in first half block */ + lba-= 16; + + if(readable_blocks >= 0 && lba + track_blocks > readable_blocks) { + sprintf(msg, "ISO image size %ds larger than readable size %ds", + lba + track_blocks, readable_blocks); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "WARNING", 0); + track_blocks= readable_blocks - lba; + } + ret= isoburn_make_toc_entry(o, &session_count, lba, track_blocks, volid_pt, + 0); + if(ret<=0) + goto failure; + lba+= track_blocks; + scan_count+= 32; + + /* growisofs aligns to 16 rather than 32 */ + growisofs_nwa= lba; + if(growisofs_nwa % 16) + growisofs_nwa+= 16 - (growisofs_nwa % 16); + if(lba % Libisoburn_nwa_alignemenT) + lba+= Libisoburn_nwa_alignemenT - (lba % Libisoburn_nwa_alignemenT); + scan_start= lba; + if(lba - growisofs_nwa == 16) + probe_minus_16= 1; + } + if(last_pacifier != start_time) + sev= "UPDATE"; + else + sev= "DEBUG"; + now= time(NULL); + if(scan_count>=10*512) + sprintf(size_text, "%.f MB", ((double) scan_count) / 512.0); + else + sprintf(size_text, "%.f kB", 2 * (double) scan_count); + sprintf(msg, "Found %d ISO sessions by scanning %s in %.f seconds", + session_count, size_text, (double) (now - start_time)); + isoburn_msgs_submit(o, 0x00060000, msg, 0, sev, 0); + {ret= 1; goto ex;} +failure:; + isoburn_toc_entry_destroy(&(o->toc), 1); + if(with_enclosure && o->emulation_mode == 1) { + if(readable_blocks >= 0 && image_size > readable_blocks) { + sprintf(msg, "ISO image size %ds larger than readable size %ds", + image_size, readable_blocks); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "WARNING", 0); + image_size= readable_blocks; + } + session_count= 0; + ret= isoburn_make_toc_entry(o, &session_count, 0, image_size, NULL, 0); + } +ex:; + if(msg != NULL) + free(msg); + if(size_text != NULL) + free(size_text); + return(ret); +} + + +int isoburn_toc_new_arrays(struct isoburn_toc_disc *o, + int session_count, int track_count, int flag) +{ + int i; + int isoburn_toc_destroy_arrays(struct isoburn_toc_disc *o, int flag); + + o->sessions= calloc(session_count, sizeof(struct isoburn_toc_session)); + o->session_pointers= + calloc(session_count, sizeof(struct isoburn_toc_session *)); + o->tracks= calloc(track_count, sizeof(struct isoburn_toc_track)); + o->track_pointers= calloc(track_count, sizeof(struct isoburn_toc_track *)); + if(o->sessions!=NULL && o->session_pointers!=NULL && + o->tracks!=NULL && o->track_pointers!=NULL) { + for(i= 0; isessions[i].session= NULL; + o->sessions[i].track_pointers= NULL; + o->sessions[i].track_count= 0; + o->sessions[i].toc_entry= NULL; + o->session_pointers[i]= NULL; + } + for(i= 0; itracks[i].track= NULL; + o->tracks[i].toc_entry= NULL; + o->track_pointers[i]= NULL; + } + return(1); + } + /* failed */ + isoburn_toc_destroy_arrays(o, 0); + return(-1); +} + + +int isoburn_toc_destroy_arrays(struct isoburn_toc_disc *o, int flag) +{ + if(o->sessions!=NULL) + free((char *) o->sessions); + o->sessions= NULL; + if(o->session_pointers!=NULL) + free((char *) o->session_pointers); + o->session_pointers= NULL; + if(o->tracks!=NULL) + free((char *) o->tracks); + o->tracks= NULL; + if(o->track_pointers!=NULL) + free((char *) o->track_pointers); + o->track_pointers= NULL; + return(1); +} + + +struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d) +{ + int ret, session_count= 0, track_count= 0, num_tracks= 0, i, j; + struct isoburn *o; + struct isoburn_toc_entry *t; + struct isoburn_toc_disc *toc_disc= NULL; + struct burn_session **s; + struct burn_track **tracks; + + toc_disc= calloc(1, sizeof(struct isoburn_toc_disc)); + if(toc_disc==NULL) + return(NULL); + toc_disc->disc= NULL; + toc_disc->sessions= NULL; + toc_disc->session_pointers= NULL; + toc_disc->tracks= NULL; + toc_disc->track_pointers= NULL; + toc_disc->session_count= 0; + toc_disc->track_count= 0; + toc_disc->toc= NULL; + + /* is the medium emulated multi-session ? */ + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + goto libburn; + if(o->toc==NULL) + goto libburn; + + /* This is an emulated TOC */ + toc_disc->toc= o->toc; + for(t= toc_disc->toc; t!=NULL; t= t->next) + session_count++; + ret= isoburn_toc_new_arrays(toc_disc, session_count, session_count, 0); + if(ret<=0) + goto failure; + t= toc_disc->toc; + for(i= 0; isessions[i].track_pointers= toc_disc->track_pointers+i; + toc_disc->sessions[i].track_count= 1; + toc_disc->sessions[i].toc_entry= t; + toc_disc->session_pointers[i]= toc_disc->sessions+i; + toc_disc->tracks[i].toc_entry= t; + toc_disc->track_pointers[i]= toc_disc->tracks+i; + t= t->next; + } + toc_disc->session_count= session_count; + toc_disc->track_count= session_count; + return(toc_disc); + +libburn:; + /* This is a libburn provided TOC */ + toc_disc->disc= burn_drive_get_disc(d); + if(toc_disc->disc == NULL) { +failure:; + free((char *) toc_disc); + return(NULL); + } + s= burn_disc_get_sessions(toc_disc->disc, &session_count); + for(i= 0; isessions[i].session= s[i]; + toc_disc->sessions[i].track_pointers= toc_disc->track_pointers+track_count; + toc_disc->sessions[i].track_count= num_tracks; + toc_disc->session_pointers[i]= toc_disc->sessions+i; + for(j= 0; jtracks[track_count+j].track= tracks[j]; + toc_disc->track_pointers[track_count+j]= toc_disc->tracks+(track_count+j); + } + track_count+= num_tracks; + } + toc_disc->session_count= session_count; + toc_disc->track_count= track_count; + return(toc_disc); +} + + +int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc) +{ + struct isoburn_toc_entry *t; + int ret= 0, num_sessions, num_tracks; + struct burn_session **sessions; + struct burn_track **tracks; + struct burn_toc_entry entry; + + if(disc==NULL) + return(0); + if(disc->toc!=NULL) { + for(t= disc->toc; t!=NULL; t= t->next) + ret= t->start_lba + t->track_blocks; + } else if(disc->disc!=NULL) { + sessions= burn_disc_get_sessions(disc->disc, &num_sessions); + if(num_sessions > 0) { + tracks = burn_session_get_tracks(sessions[num_sessions - 1], + &num_tracks); + if(num_tracks > 0) { + burn_track_get_entry(tracks[num_tracks - 1], &entry); + if(entry.extensions_valid & 1) + ret= entry.start_lba + entry.track_blocks; + } + } +/* + ret= burn_disc_get_sectors(disc->disc); +*/ + } + return(ret); +} + + +struct isoburn_toc_session **isoburn_toc_disc_get_sessions( + struct isoburn_toc_disc *disc, int *num) +{ + *num= disc->session_count; + return(disc->session_pointers); +} + + +int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s) +{ + struct isoburn_toc_entry *t; + int count= 0, i; + + if(s==NULL) + return(0); + if(s->toc_entry!=NULL) { + t= s->toc_entry; + for(i= 0; itrack_count; i++) { + count+= t->track_blocks; + t= t->next; + } + } else if(s->session!=NULL) + count= burn_session_get_sectors(s->session); + return(count); +} + + +int isoburn_toc_entry_finish(struct burn_toc_entry *entry, + int session_no, int track_no, int flag) +{ + int pmin, psec, pframe; + + entry->extensions_valid= 1; + entry->adr= 1; + entry->control= 4; + entry->session= session_no & 255; + entry->session_msb= (session_no >> 8) & 255; + entry->point= track_no & 255; + entry->point_msb= (track_no >> 8) & 255; + + burn_lba_to_msf(entry->start_lba, &pmin, &psec, &pframe); + if(pmin<=255) + entry->pmin= pmin; + else + entry->pmin= 255; + entry->psec= psec; + entry->pframe= pframe; + return(1); +} + + +void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s, + struct burn_toc_entry *entry) +{ + struct isoburn_toc_track *t; + + if(s==NULL) + return; + if(s->session!=NULL && s->toc_entry==NULL) { + burn_session_get_leadout_entry(s->session, entry); + return; + } + if(s->track_count<=0 || s->track_pointers==NULL || s->toc_entry==NULL) + return; + t= s->track_pointers[s->track_count-1]; + entry->start_lba= t->toc_entry->start_lba + t->toc_entry->track_blocks; + entry->track_blocks= 0; + isoburn_toc_entry_finish(entry, s->toc_entry->session, t->toc_entry->track_no, + 0); +} + + +struct isoburn_toc_track **isoburn_toc_session_get_tracks( + struct isoburn_toc_session *s, int *num) +{ + *num= s->track_count; + return(s->track_pointers); +} + + +void isoburn_toc_track_get_entry(struct isoburn_toc_track *t, + struct burn_toc_entry *entry) +{ + if(t==0) + return; + if(t->track!=NULL && t->toc_entry==NULL) { + burn_track_get_entry(t->track, entry); + return; + } + if(t->toc_entry==NULL) + return; + entry->start_lba= t->toc_entry->start_lba; + entry->track_blocks= t->toc_entry->track_blocks; + isoburn_toc_entry_finish(entry, t->toc_entry->session, t->toc_entry->track_no, + 0); +} + + +int isoburn_toc_track_get_emul(struct isoburn_toc_track *t, int *start_lba, + int *image_blocks, char volid[33], int flag) +{ + if(t->toc_entry == NULL) + return(0); + if(t->toc_entry->volid == NULL) + return(0); + *start_lba= t->toc_entry->start_lba; + *image_blocks= t->toc_entry->track_blocks; + strncpy(volid, t->toc_entry->volid, 32); + volid[32]= 0; + return(1); +} + + +void isoburn_toc_disc_free(struct isoburn_toc_disc *d) +{ + if(d->disc!=NULL) + burn_disc_free(d->disc); + isoburn_toc_destroy_arrays(d, 0); + free((char *) d); +} + + +int isoburn_get_track_lba(struct isoburn_toc_track *track, int *lba, int flag) +{ + struct burn_toc_entry entry; + + isoburn_toc_track_get_entry(track, &entry); + if (entry.extensions_valid & 1) + *lba= entry.start_lba; + else + *lba= burn_msf_to_lba(entry.pmin, entry.psec, entry.pframe); + return(1); +} + + +int isoburn_drive_set_msgs_submit(struct burn_drive *d, + int (*msgs_submit)(void *handle, int error_code, + char msg_text[], int os_errno, + char severity[], int flag), + void *submit_handle, int submit_flag, int flag) +{ + struct isoburn *o; + int ret; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0 || o==NULL) + return(-1); + o->msgs_submit= msgs_submit; + o->msgs_submit_handle= submit_handle; + o->msgs_submit_flag= submit_flag; + return(1); +} + + +/* @param flag bit0= with adr_mode 3: adr_value might be 16 blocks too high + bit1= insist in seeing a disc object with at least one session + bit2= with adr_mode 4: use adr_value as regular expression +*/ +int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, + int flag) +{ + int ret, num_sessions= 0, num_tracks, adr_num, i, j, total_tracks; + int lba, best_lba, size, re_valid= 0, track_count= 0; + time_t start_time= 0, last_pacifier= 0, now; + char volid[33], *msg= NULL; + struct isoburn *o; + struct isoburn_toc_disc *disc= NULL; + struct isoburn_toc_session **sessions= NULL; + struct isoburn_toc_track **tracks= NULL; + static char mode_names[][20]= {"auto", "session", "track", "lba", "volid"}; + static int max_mode_names= 4; + regex_t re; + regmatch_t match[1]; + enum burn_disc_status s; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(-1); + if(o==NULL) + return(-1); + + msg= calloc(1, 160); + if(msg == NULL) + {ret= -1; goto ex;} + + start_time= last_pacifier= time(NULL); + adr_num= atoi(adr_value); + if(adr_mode!=3 || (flag & 2)) { + disc= isoburn_toc_drive_get_disc(d); + if(disc==NULL) { +not_found:; + if(adr_mode<0 || adr_mode>max_mode_names) + goto unknown_mode; + sprintf(msg, "Failed to find %s %s", mode_names[adr_mode], + strlen(adr_value)<=80 ? adr_value : "-oversized-string-"); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); + ret= 0; goto ex; + } + sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); + if(sessions==NULL || num_sessions<=0) + goto not_found; + } + if(adr_mode==0) { + /* Set fabricated_msc1 to last session in TOC */ + tracks= isoburn_toc_session_get_tracks(sessions[num_sessions-1], + &num_tracks); + if(tracks==NULL || num_tracks<=0) + goto not_found; + isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0); + + } else if(adr_mode==1) { + /* Use adr_num as session index (first session is 1, not 0) */ + if(adr_num<1 || adr_num>num_sessions) + goto not_found; + tracks= isoburn_toc_session_get_tracks(sessions[adr_num-1], &num_tracks); + if(tracks==NULL || num_tracks<=0) + goto not_found; + isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0); + + } else if(adr_mode==2) { + /* use adr_num as track index */ + total_tracks= 0; + for(i=0; ifabricated_msc1), 0); + ret= 1; goto ex; + } + } + } + goto not_found; + + } else if(adr_mode==3) { + o->fabricated_msc1= adr_num; + s= isoburn_disc_get_status(d); + if(o->fabricated_msc1 > 0 && s != BURN_DISC_FULL + && s != BURN_DISC_APPENDABLE) { + isoburn_msgs_submit(o, 0x00060000, + "Non-zero load offset given with blank input media", + 0, "FAILURE", 0); + ret= 0; goto ex; + } + if((flag & 1) && o->fabricated_msc1 >= 16) { + /* adr_num is possibly 16 blocks too high */ + ret= isoburn_read_iso_head(d, o->fabricated_msc1, &size,volid, 1|(1<<14)); + if(ret==2) + o->fabricated_msc1-= 16; + } + } else if(adr_mode==4) { + /* search for volume id that is equal to adr_value */ + if(flag & 4) { + ret= regcomp(&re, adr_value, 0); + if(ret != 0) + flag&= ~4; + else + re_valid= 1; + } + best_lba= -1; + for(i=0; i= 5 && track_count > 0) { + last_pacifier= now; + sprintf(msg, + "Scanned %d tracks for matching volid in %.f seconds", + track_count, (double) (now - start_time)); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "UPDATE", 0); + } + track_count++; + ret= isoburn_toc_track_get_emul(tracks[0], &lba, &size, volid, 0); + if(ret < 0) + continue; + if(ret == 0) { + isoburn_get_track_lba(tracks[0], &lba, 0); + ret= isoburn_read_iso_head(d, lba, &size, volid, 1); + if(ret<=0) + continue; + } + if(flag & 4) { + ret= regexec(&re, volid, 1, match, 0); + if(ret != 0) + continue; + } else { + if(strcmp(volid, adr_value)!=0) + continue; + } + best_lba= lba; + } + } + if(best_lba<0) + goto not_found; + o->fabricated_msc1= best_lba; + + } else { +unknown_mode:; + sprintf(msg, "Program error: Unknown msc1 address mode %d", adr_mode); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FATAL", 0); + ret= 0; goto ex; + } + ret= 1; +ex:; + if(start_time != last_pacifier && track_count > 0) { + now= time(NULL); + sprintf(msg, + "Scanned %d tracks for matching volid in %.f seconds", + track_count, (double) (now - start_time)); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "UPDATE", 0); + } + if(disc!=NULL) + isoburn_toc_disc_free(disc); + if((flag & 4) && re_valid) + regfree(&re); + if(msg != NULL) + free(msg); + return(ret); +} + + +int isoburn_get_mount_params(struct burn_drive *d, + int adr_mode, char *adr_value, + int *lba, int *track, int *session, + char volid[33], int flag) +{ + int msc1_mem, ret, total_tracks, num_sessions, num_tracks, i, j, track_lba; + int size, is_iso= 0; + struct isoburn *o; + struct isoburn_toc_disc *disc= NULL; + struct isoburn_toc_session **sessions= NULL; + struct isoburn_toc_track **tracks= NULL; + + *lba= *track= *session= -1; + volid[0]= 0; + ret= isoburn_find_emulator(&o, d, 0); + if(ret < 0 || o == NULL) + return(-1); + msc1_mem= o->fabricated_msc1; + ret= isoburn_set_msc1(d, adr_mode, adr_value, 2 | (flag & 4)); + if(ret <= 0) + return(ret); + *lba= o->fabricated_msc1; + + disc= isoburn_toc_drive_get_disc(d); + if(disc==NULL) + {ret= -1; goto ex;} /* cannot happen because checked by isoburn_set_msc1 */ + sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); + if(sessions==NULL || num_sessions<=0) + {ret= -1; goto ex;} /* cannot happen because checked by isoburn_set_msc1 */ + total_tracks= 0; + for(i=0; ifabricated_msc1= msc1_mem; + if(disc != NULL) + isoburn_toc_disc_free(disc); + return(2 - is_iso); +} + + diff --git a/libisoburn/branches/1.1.8/libisoburn/data_source.c b/libisoburn/branches/1.1.8/libisoburn/data_source.c new file mode 100644 index 00000000..f478265f --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/data_source.c @@ -0,0 +1,285 @@ +/* + data source for libisoburn. + + Copyright 2007 - 2010 Vreixo Formoso Lopes + and Thomas Schmitt + Provided under GPL version 2 or later. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include + +#include + + +#ifndef Xorriso_standalonE + +#include + +#include + +#else /* ! Xorriso_standalonE */ + +#include "../libisofs/libisofs.h" +#include "../libburn/libburn.h" + +#endif /* Xorriso_standalonE */ + + +#include "isoburn.h" + + +/* Cached reading of image tree data */ +/* Multi tile: 32 * 64 kB */ + +/* The size of a single tile. + Powers of 2 only ! Less than 16 makes not much sense. +*/ +#define Libisoburn_tile_blockS 32 + +/* The number of tiles in the cache +*/ +#define Libisoburn_cache_tileS 32 + + +/* Debugging only: This reports cache loads on stderr. +#define Libisoburn_read_cache_reporT 1 +*/ + + +struct isoburn_cache_tile { + char cache_data[Libisoburn_tile_blockS * 2048]; + uint32_t cache_lba; + uint32_t last_error_lba; + uint32_t last_aligned_error_lba; + int cache_hits; + int age; +}; + +struct isoburn_cached_drive { + struct burn_drive *drive; + struct isoburn_cache_tile tiles[Libisoburn_cache_tileS]; + int current_age; + + /** + Offset to be applied to all block addresses to compensate for an + eventual displacement of the block addresses relative to the image + start block address that was assumed when the image was created. + E.g. if track number 2 gets copied into a disk file and shall then + be loaded as ISO filesystem. + If displacement_sign is 1 then the displacement number will be + added to .read_block() addresses, if -1 it will be subtracted. + Else it will be ignored. + */ + uint32_t displacement; + int displacement_sign; + +}; + +#define Libisoburn_max_agE 2000000000 + +static int ds_inc_age(struct isoburn_cached_drive *icd, int idx, int flag); + + +int ds_read_block(IsoDataSource *src, uint32_t lba, uint8_t *buffer) +{ + int ret, i, oldest, oldest_age; + struct burn_drive *d; + off_t count; + uint32_t aligned_lba; + char msg[80]; + struct isoburn_cache_tile *tiles; + struct isoburn_cached_drive *icd; + + if(src == NULL || buffer == NULL) + /* It is not required by the specs of libisofs but implicitely assumed + by its current implementation that a data source read result <0 is + a valid libisofs error code. + */ + return ISO_NULL_POINTER; + + icd = (struct isoburn_cached_drive *) src->data; + d = (struct burn_drive*) icd->drive; + + if(d == NULL) { + /* This would happen if libisoburn saw output data in the fifo and + performed early drive release and afterwards libisofs still tries + to read data. + That would constitute a bad conceptual problem in libisoburn. + */ + isoburn_msgs_submit(NULL, 0x00060000, + "Programming error: Drive released while libisofs still attempts to read", + 0, "FATAL", 0); + return ISO_ASSERT_FAILURE; + } + + tiles = (struct isoburn_cache_tile *) icd->tiles; + + if(icd->displacement_sign == 1) { + if(lba + icd->displacement < lba) { +address_rollover:; + return ISO_DISPLACE_ROLLOVER; + } else + lba += icd->displacement; + } else if(icd->displacement_sign == -1) { + if(lba < icd->displacement ) + goto address_rollover; + else + lba -= icd->displacement; + } + + aligned_lba= lba & ~(Libisoburn_tile_blockS - 1); + + for(i=0; i 0) + return 1; + tiles[oldest].last_error_lba = lba; + sprintf(msg, "ds_read_block(%lu) returns %lX", + (unsigned long) lba, (unsigned long) ret); + isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "DEBUG", 0); + return ISO_DATA_SOURCE_MISHAP; + } + +#ifdef Libisoburn_read_cache_reporT + fprintf(stderr, "Tile %2.2d : After %3d hits, new load from %8x , count= %d\n", + oldest, tiles[oldest].cache_hits, aligned_lba, (int) count); +#endif + + tiles[oldest].cache_lba= aligned_lba; + tiles[oldest].cache_hits= 1; + ds_inc_age(icd, oldest, 0); + + memcpy(buffer, tiles[oldest].cache_data + (lba - aligned_lba) * 2048, 2048); + count= 2048; + + return 1; +} + + +static int ds_open(IsoDataSource *src) +{ + /* nothing to do, device is always grabbed */ + return 1; +} + +static int ds_close(IsoDataSource *src) +{ + /* nothing to do, device is always grabbed */ + return 1; +} + +static void ds_free_data(IsoDataSource *src) +{ + /* nothing to do */; + if(src->data != NULL) + free(src->data); + src->data= NULL; +} + + +int isoburn_data_source_shutdown(IsoDataSource *src, int flag) +{ + struct isoburn_cached_drive *icd; + + if(src==NULL) + return(0); + icd= (struct isoburn_cached_drive *) src->data; + icd->drive= NULL; + return(1); +} + + +IsoDataSource *isoburn_data_source_new(struct burn_drive *d, + uint32_t displacement, int displacement_sign) +{ + IsoDataSource *ret; + struct isoburn_cached_drive *icd= NULL; + int i; + + if (d==NULL) + return NULL; + ret = malloc(sizeof(IsoDataSource)); + icd = calloc(1,sizeof(struct isoburn_cached_drive)); + if (ret == NULL || icd == NULL) + return NULL; + ret->version = 0; + ret->refcount = 1; + ret->read_block = ds_read_block; + ret->open = ds_open; + ret->close = ds_close; + ret->free_data = ds_free_data; + ret->data = icd; + icd->drive = d; + icd->current_age= 0; + for(i= 0; itiles[i].cache_lba = 0xffffffff; + icd->tiles[i].cache_hits = 0; + icd->tiles[i].last_error_lba = 0xffffffff; + icd->tiles[i].last_aligned_error_lba = 0xffffffff; + icd->tiles[i].age= 0; + } + icd->displacement = displacement; + icd->displacement_sign = displacement_sign; + return ret; +} + + +static int ds_inc_age(struct isoburn_cached_drive *icd, int idx, int flag) +{ + int i; + + (icd->current_age)++; + if(icd->current_age>=Libisoburn_max_agE) { /* reset all ages (allow waste) */ + for(i= 0; itiles)[i].age= 0; + icd->current_age= 1; + } + (icd->tiles)[idx].age= icd->current_age; + return(1); +} + + diff --git a/libisoburn/branches/1.1.8/libisoburn/isoburn.c b/libisoburn/branches/1.1.8/libisoburn/isoburn.c new file mode 100644 index 00000000..1722d8b0 --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/isoburn.c @@ -0,0 +1,1452 @@ + +/* + cc -g -c isoburn.c +*/ + +/* + Class core of libisoburn. + + Copyright 2007 - 2010 Vreixo Formoso Lopes + Thomas Schmitt + + Provided under GPL version 2 or later. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +/* ( derived from stub generated by CgeN on Sat, 01 Sep 2007 12:04:36 GMT ) */ + +#include +#include +#include +#include +#include +#include + +#ifndef Xorriso_standalonE + +#include + +#include + +#else /* ! Xorriso_standalonE */ + +#include "../libisofs/libisofs.h" +#include "../libburn/libburn.h" + +#endif /* Xorriso_standalonE */ + + +#include "libisoburn.h" + +#include "isoburn.h" + + +/* Default values for application provided msgs_submit methods. + To be attached to newly aquired drives. +*/ +int (*libisoburn_default_msgs_submit) + (void *handle, int error_code, char msg_text[], + int os_errno, char severity[], int flag)= NULL; +void *libisoburn_default_msgs_submit_handle= NULL; +int libisoburn_default_msgs_submit_flag= 0; + + +/* ----------------------- isoburn_toc_entry ---------------------- */ + + +int isoburn_toc_entry_new(struct isoburn_toc_entry **objpt, + struct isoburn_toc_entry *boss, int flag) +{ + struct isoburn_toc_entry *o, *s; + + *objpt= o= (struct isoburn_toc_entry *) + malloc(sizeof(struct isoburn_toc_entry)); + if(o==NULL) { + isoburn_msgs_submit(NULL, 0x00060000, + "Cannot allocate memory for isoburn toc entry", + 0, "FATAL", 0); + return(-1); + } + o->session= 0; + o->track_no= 0; + o->start_lba= -1; + o->track_blocks= 0; + o->volid= NULL; + o->next= NULL; + if(boss!=NULL) { + for(s= boss; s->next!=NULL; s= s->next); + s->next= o; + } + return(1); +} + + +/* @param flag bit0= delete all subordinates too +*/ +int isoburn_toc_entry_destroy(struct isoburn_toc_entry **o, int flag) +{ + if(*o==NULL) + return(0); + if(flag&1) + isoburn_toc_entry_destroy(&((*o)->next), flag); + if((*o)->volid != NULL) + free((*o)->volid); + free((char *) (*o)); + *o= NULL; + return(1); +} + + +/* --------------------- end isoburn_toc_entry -------------------- */ + +/* -------------------------- isoburn ----------------------- */ + + +/* The global list of isoburn objects. Usually there is only one. + >>> we are not ready for multiple control threads yet. See >>> mutex . + Multiple burns under one control thread should work. +*/ +struct isoburn *isoburn_list_start= NULL; + + +int isoburn_new(struct isoburn **objpt, int flag) +{ + struct isoburn *o; + int ret; + + *objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn)); + if(o==NULL) { + isoburn_msgs_submit(NULL, 0x00060000, + "Cannot allocate memory for isoburn control object", + 0, "FATAL", 0); + return(-1); + } + + o->drive= NULL; + o->emulation_mode= 0; + o->fabricated_msc1= -1; + o->fabricated_msc2= -1; + o->zero_nwa= Libisoburn_overwriteable_starT; + o->min_start_byte= o->zero_nwa * 2048; + o->nwa= o->zero_nwa; + o->truncate= 0; + o->iso_source= NULL; + o->fabricated_disc_status= BURN_DISC_UNREADY; + o->media_read_error= 0; + o->toc= NULL; + o->wrote_well= -1; + o->loaded_partition_offset= 0; + o->target_iso_head_size= Libisoburn_target_head_sizE; + o->target_iso_head= NULL; + o->image= NULL; + o->iso_data_source= NULL; + o->read_pacifier= NULL; + o->read_pacifier_handle= NULL; + o->msgs_submit= NULL; + o->msgs_submit_handle= NULL; + o->msgs_submit_flag= 0; + o->prev= NULL; + o->next= NULL; + o->target_iso_head= calloc(1, o->target_iso_head_size); + if(o->target_iso_head == NULL) { + isoburn_report_iso_error(ISO_OUT_OF_MEM, "Cannot allocate overwrite buffer", + 0, "FATAL", 0); + goto failed; + } + ret= iso_image_new("ISOIMAGE", &o->image); + if(ret<0) { + isoburn_report_iso_error(ret, "Cannot create image object", 0, "FATAL", 0); + goto failed; + } + isoburn_link(o, isoburn_list_start, 1); + return(1); +failed:; + isoburn_destroy(objpt, 0); + return(-1); +} + + +int isoburn_destroy(struct isoburn **objpt, int flag) +{ + struct isoburn *o; + + o= *objpt; + if(o==NULL) + return(0); + + /* >>> mutex */ + + if(o==isoburn_list_start) + isoburn_list_start= o->next; + if(o->prev!=NULL) + o->prev->next= o->next; + if(o->next!=NULL) + o->next->prev= o->prev; + + /* >>> end mutex */ + + if(o->image!=NULL) + iso_image_unref(o->image); + if(o->toc!=NULL) + isoburn_toc_entry_destroy(&(o->toc), 1); /* all */ + if(o->iso_source!=NULL) + burn_source_free(o->iso_source); + if(o->iso_data_source!=NULL) + iso_data_source_unref(o->iso_data_source); + if(o->target_iso_head != NULL) + free(o->target_iso_head); + free((char *) o); + *objpt= NULL; + return(1); +} + + +int isoburn_destroy_all(struct isoburn **objpt, int flag) +{ + struct isoburn *o,*n; + + o= *objpt; + if(o==NULL) + return(0); + for(;o->prev!=NULL;o= o->prev); + for(;o!=NULL;o= n) { + n= o->next; + isoburn_destroy(&o,0); + } + *objpt= NULL; + return(1); +} + + +int isoburn_get_target_image(struct isoburn *o, IsoImage **pt, int flag) +{ + *pt= o->image; + return(1); +} + + +int isoburn_get_prev(struct isoburn *o, struct isoburn **pt, int flag) +{ + *pt= o->prev; + return(1); +} + + +int isoburn_get_next(struct isoburn *o, struct isoburn **pt, int flag) +{ + *pt= o->next; + return(1); +} + + +int isoburn_link(struct isoburn *o, struct isoburn *link, int flag) +/* + bit0= insert as link->prev rather than as link->next +*/ +{ + + /* >>> mutex */ + + if(isoburn_list_start==NULL || + (isoburn_list_start==link && (flag&1))) + isoburn_list_start= o; + if(o->prev!=NULL) + o->prev->next= o->next; + if(o->next!=NULL) + o->next->prev= o->prev; + o->prev= o->next= NULL; + if(link==NULL) + return(1); + if(flag&1) { + o->next= link; + o->prev= link->prev; + if(o->prev!=NULL) + o->prev->next= o; + link->prev= o; + } else { + o->prev= link; + o->next= link->next; + if(o->next!=NULL) + o->next->prev= o; + link->next= o; + } + + /* >>> end mutex */ + + return(1); +} + + +int isoburn_count(struct isoburn *o, int flag) +/* flag: bit1= count from start of list */ +{ + int counter= 0; + + if(flag&2) + for(;o->prev!=NULL;o= o->prev); + for(;o!=NULL;o= o->next) + counter++; + return(counter); +} + + +int isoburn_by_idx(struct isoburn *o, int idx, struct isoburn **pt, int flag) +/* flag: bit0= fetch first (idx<0) or last (idx>0) item in list + bit1= address from start of list */ +{ + int i,abs_idx; + struct isoburn *npt; + + if(flag&2) + for(;o->prev!=NULL;o= o->prev); + abs_idx= (idx>0?idx:-idx); + *pt= o; + for(i= 0;(i0) + npt= o->next; + else + npt= o->prev; + if(npt==NULL && (flag&1)) + break; + *pt= npt; + } + return(*pt!=NULL); +} + + +int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag) +{ + struct isoburn *o; + + *pt= NULL; + for(o= isoburn_list_start;o!=NULL;o= o->next) + if(o->drive==d) { + *pt= o; + return(1); + } + return(0); +} + + +int isoburn_msgs_submit(struct isoburn *o, int error_code, char msg_text[], + int os_errno, char severity[], int flag) +{ + int ret, use_drive_method= 0; + + if(o!=NULL) + if(o->msgs_submit!=NULL) + use_drive_method= 1; + if(use_drive_method) { + ret= o->msgs_submit(o->msgs_submit_handle, error_code, msg_text, os_errno, + severity, o->msgs_submit_flag); + return(ret); + } + if(libisoburn_default_msgs_submit != NULL) { + ret= libisoburn_default_msgs_submit(libisoburn_default_msgs_submit_handle, + error_code, msg_text, os_errno, severity, + libisoburn_default_msgs_submit_flag); + return(ret); + } + /* Fallback: use message queue of libburn */ + burn_msgs_submit(error_code, msg_text, os_errno, severity, NULL); + return(1); +} + + +/** Check whether the size of target_iso_head matches the given partition + offset. Eventually adjust size. +*/ +int isoburn_adjust_target_iso_head(struct isoburn *o, + uint32_t offst, int flag) +{ + uint8_t *new_buf; + uint32_t new_size; + + if((uint32_t) o->target_iso_head_size == + Libisoburn_target_head_sizE + 2048 * offst) + return(1); + new_size= Libisoburn_target_head_sizE + 2048 * offst; + new_buf= calloc(1, new_size); + if(new_buf == NULL) { + isoburn_msgs_submit(o, 0x00060000, + "Cannot re-allocate overwrite buffer", 0, "FATAL", 0); + return(-1); + } + memcpy(new_buf, o->target_iso_head, + (uint32_t) o->target_iso_head_size < new_size ? + (uint32_t) o->target_iso_head_size : new_size); + free(o->target_iso_head); + o->target_iso_head= new_buf; + o->target_iso_head_size= new_size; + if(o->nwa == o->zero_nwa) + o->nwa= Libisoburn_overwriteable_starT + offst; + o->zero_nwa= Libisoburn_overwriteable_starT + offst; + return(1); +} + + +/* @param flag bit0= modifying rather than growing + bit1= prepare for early release of input drive: + wait until input and then disable image data source +*/ +static +int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d, + struct burn_disc **disc, + struct isoburn_imgen_opts *opts, int flag) +{ + struct burn_source *wsrc; + struct burn_session *session; + struct burn_track *track; + struct isoburn *in_o, *out_o; + IsoWriteOpts *wopts= NULL; + enum burn_disc_status state; + int ret, fifo_chunks, lba, nwa, i, new_img, early_indev_release; + uint32_t data_start= -1; + size_t buffer_size= 0, buffer_free= 0; + char *msg= NULL; + + msg= calloc(1, 160); + if(msg == NULL) + {ret= -1; goto ex;} + + new_img= flag&1; + early_indev_release= flag&2; + + ret= isoburn_find_emulator(&in_o, in_d, 0); + if(ret<0 || in_o==NULL) + {ret= -1; goto ex;} + ret= isoburn_find_emulator(&out_o, out_d, 0); + if(ret<0 || out_o==NULL) + {ret= -1; goto ex;} + /* early end will be registered as failure */ + in_o->wrote_well= out_o->wrote_well= 0; + + if(new_img && early_indev_release) { + isoburn_msgs_submit(in_o, 0x00060000, + "Programming error: Wrong session setup: new_img && early_indev_release", + 0, "FATAL", 0); + {ret= -4; goto ex;} + } + + state = isoburn_disc_get_status(in_d); + if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE && + state != BURN_DISC_FULL) { + isoburn_msgs_submit(in_o, 0x00060000, "Unsuitable source media state", + 0, "FAILURE", 0); + {ret= -2; goto ex;} + } + state = isoburn_disc_get_status(out_d); + if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) { + isoburn_msgs_submit(out_o, 0x00060000, "Unsuitable target media state", + 0, "FAILURE", 0); + {ret= -2; goto ex;} + } + if (state != BURN_DISC_BLANK && opts->libjte_handle != NULL) { + isoburn_msgs_submit(out_o, 0x00060000, + "Jigdo Template Extraction works only on blank target media", + 0, "FAILURE", 0); + {ret= -2; goto ex;} + } + + fifo_chunks= 32; + if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){ + fifo_chunks= opts->fifo_size/2048; + if(fifo_chunks*2048 < opts->fifo_size) + fifo_chunks++; + } + + ret = iso_write_opts_new(&wopts, 0); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot create iso_write_opts", 0, "FATAL",0); + goto ex; + } + iso_write_opts_set_will_cancel(wopts, opts->will_cancel); + iso_write_opts_set_iso_level(wopts, opts->level); + iso_write_opts_set_rockridge(wopts, opts->rockridge); + iso_write_opts_set_joliet(wopts, opts->joliet); + iso_write_opts_set_iso1999(wopts, opts->iso1999); + iso_write_opts_set_hardlinks(wopts, opts->hardlinks); + if(opts->hardlinks) + iso_write_opts_set_rrip_1_10_px_ino(wopts, 1); + iso_write_opts_set_aaip(wopts, opts->aaip); + iso_write_opts_set_old_empty(wopts, !!opts->old_empty); + iso_write_opts_set_untranslated_name_len(wopts, opts->untranslated_name_len); + iso_write_opts_set_allow_dir_id_ext(wopts, opts->allow_dir_id_ext); + iso_write_opts_set_omit_version_numbers(wopts, opts->omit_version_numbers); + iso_write_opts_set_allow_deep_paths(wopts, opts->allow_deep_paths); + iso_write_opts_set_allow_longer_paths(wopts, opts->allow_longer_paths); + iso_write_opts_set_max_37_char_filenames(wopts, opts->max_37_char_filenames); + iso_write_opts_set_no_force_dots(wopts, opts->no_force_dots); + iso_write_opts_set_allow_lowercase(wopts, opts->allow_lowercase); + iso_write_opts_set_allow_full_ascii(wopts, opts->allow_full_ascii); + iso_write_opts_set_relaxed_vol_atts(wopts, 1); + iso_write_opts_set_joliet_longer_paths(wopts, opts->joliet_longer_paths); + iso_write_opts_set_joliet_long_names(wopts, opts->joliet_long_names); + iso_write_opts_set_always_gmt(wopts, opts->always_gmt); + iso_write_opts_set_rrip_version_1_10(wopts, opts->rrip_version_1_10); + iso_write_opts_set_dir_rec_mtime(wopts, opts->dir_rec_mtime); + iso_write_opts_set_aaip_susp_1_10(wopts, opts->aaip_susp_1_10); + iso_write_opts_set_sort_files(wopts, opts->sort_files); + iso_write_opts_set_record_md5(wopts, opts->session_md5, opts->file_md5 & 3); + if(opts->scdbackup_tag_name[0] && opts->scdbackup_tag_time[0]) + iso_write_opts_set_scdbackup_tag(wopts, opts->scdbackup_tag_name, + opts->scdbackup_tag_time, + opts->scdbackup_tag_written); + iso_write_opts_set_replace_mode(wopts, opts->replace_dir_mode, + opts->replace_file_mode, opts->replace_uid, opts->replace_gid); + iso_write_opts_set_default_dir_mode(wopts, opts->dir_mode); + iso_write_opts_set_default_file_mode(wopts, opts->file_mode); + iso_write_opts_set_default_uid(wopts, opts->uid); + iso_write_opts_set_default_gid(wopts, opts->gid); + iso_write_opts_set_output_charset(wopts, opts->output_charset); + iso_write_opts_set_fifo_size(wopts, fifo_chunks); + ret = iso_write_opts_set_system_area(wopts, opts->system_area_data, + opts->system_area_options, 0); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot set content of System Area", + 0, "FAILURE", 0); + {ret= -1; goto ex;} + } + iso_write_opts_set_pvd_times(wopts, + opts->vol_creation_time, opts->vol_modification_time, + opts->vol_expiration_time, opts->vol_effective_time, + opts->vol_uuid); + iso_write_opts_attach_jte(wopts, opts->libjte_handle); + + ret= isoburn_adjust_target_iso_head(out_o, opts->partition_offset, 0); + if(ret <= 0) + {ret= -1; goto ex;} + if(out_o->nwa < out_o->zero_nwa) + out_o->zero_nwa= 0; + if(opts->no_emul_toc || opts->libjte_handle != NULL) { + if(out_o->nwa == out_o->zero_nwa && + out_o->zero_nwa == Libisoburn_overwriteable_starT + + opts->partition_offset + && out_o->emulation_mode == 1) { + out_o->nwa= 0; + out_o->zero_nwa= 0; + out_o->min_start_byte= 0; + } + } + ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa); + opts->effective_lba= nwa; + ret= isoburn_get_msc2(out_o, NULL, &nwa, 0); + if (ret != 1) { + isoburn_msgs_submit(out_o, 0x00060000, + "Cannot determine next writeable address", 0, "FAILURE", 0); + + /* >>> NWA_V : If burn_next_track_damaged: + ??? Close track and session ? + ??? Issue a hint for a repair command ? + */; + + {ret= -3; goto ex;} + } + iso_write_opts_set_ms_block(wopts, nwa); + iso_write_opts_set_appendable(wopts, !new_img); + iso_write_opts_set_overwrite_buf(wopts, + nwa>0 ? out_o->target_iso_head : NULL); + iso_write_opts_set_part_offset(wopts, opts->partition_offset, + opts->partition_secs_per_head, + opts->partition_heads_per_cyl); + iso_write_opts_set_tail_blocks(wopts, opts->tail_blocks); + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { + if(opts->appended_partitions[i] == NULL) + continue; + ret= iso_write_opts_set_partition_img(wopts, i + 1, + opts->appended_part_types[i], + opts->appended_partitions[i], 0); + if(ret < 0) { + isoburn_report_iso_error(ret, "Cannot set path for appended partition", + 0, "FAILURE", 0); + {ret= -1; goto ex;} + } + } + iso_write_opts_set_disc_label(wopts, opts->ascii_disc_label); + + ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot create burn source", 0, "FAILURE", 0); + {ret= -1; goto ex;} + } + if (early_indev_release) { + for(i= 0; i<300; i++) { + + /* <<< ??? */ + if((i%30) == 0) { + sprintf(msg, "Waiting for data in fifo since %d seconds", i/30); + isoburn_msgs_submit(in_o, 0x00060000, msg, 0, "DEBUG", 0); + } + + usleep(100000); + ret= iso_ring_buffer_get_status(wsrc, &buffer_size, &buffer_free); + if(ret >0 && buffer_size != buffer_free) + break; + } + + /* <<< ??? */ + sprintf(msg, + "After %.1f seconds: %d bytes of output available (fifo state=%d)", + ((double) i+1) / 10.0, (int) (buffer_size - buffer_free), ret); + isoburn_msgs_submit(in_o, 0x00060000, msg, 0, "DEBUG", 0); + + if(in_o->iso_data_source!=NULL) + isoburn_data_source_shutdown(in_o->iso_data_source, 0); + } + + ret= iso_write_opts_get_data_start(wopts, &data_start, 0); + opts->data_start_lba= -1; + if(ret > 0 && data_start <= 0x7FFFFFFF) + opts->data_start_lba= data_start; + + /* TODO check return values for failure. propertly clean-up on error */ + + out_o->iso_source= wsrc; + + *disc = burn_disc_create(); + session = burn_session_create(); + burn_disc_add_session(*disc, session, BURN_POS_END); + track = burn_track_create(); + burn_track_set_source(track, out_o->iso_source); + burn_session_add_track(session, track, BURN_POS_END); + + /* give up local references */ + burn_track_free(track); + burn_session_free(session); + + in_o->wrote_well= out_o->wrote_well= -1; /* neutral */ + ret= 1; +ex: + if(wopts!=NULL) + {iso_write_opts_free(wopts); wopts= NULL;} + if(msg != NULL) + free(msg); + return ret; +} + + +int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc, + struct isoburn_imgen_opts *opts) +{ + return isoburn_prepare_disc_aux(d, d, disc, opts, 0); +} + + +int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc, + struct isoburn_imgen_opts *opts, + struct burn_drive *out_drive) +{ + int ret; + + ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 1); + if (ret<=0) + return ret; + return 1; +} + + +/* API since 0.2.2 */ +int isoburn_prepare_blind_grow(struct burn_drive *d, struct burn_disc **disc, + struct isoburn_imgen_opts *opts, + struct burn_drive *out_drive, int nwa) +{ + int ret; + struct isoburn *o= NULL; + + ret= isoburn_find_emulator(&o, out_drive, 0); + if(ret<0 || o==NULL) + return(-1); + if(nwa >= 0) + o->fabricated_msc2= nwa; + if(o->nwa == o->zero_nwa) + o->nwa= o->zero_nwa= 0; + else + o->zero_nwa= 0; + o->min_start_byte= 0; + ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 2); + if (ret<=0) + return ret; + return(1); +} + + +/* API @since 0.1.0 + @param flag bit0= this is a regular end, not an abort + give up source reference +*/ +int isoburn_cancel_prepared_write(struct burn_drive *d, + struct burn_drive *output_drive, int flag) +{ + int ret; + struct isoburn *o= NULL; + + if(output_drive!=NULL) { + ret= isoburn_find_emulator(&o, output_drive, 0); + if(ret<0 || o==NULL) + o= NULL; + else if(o->iso_source==NULL) + o= NULL; + } + if(o==NULL) { + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0) + return(-1); + if(o==NULL) + return(0); + if(o->iso_source==NULL) + return(0); + } + if(o->iso_source->read!=NULL) + return(0); + if(o->iso_source->version<1) + return(0); + o->iso_source->cancel(o->iso_source); + burn_source_free(o->iso_source); + o->iso_source= NULL; + return(1); +} + + +/* API @since 0.1.0 */ +int isoburn_sync_after_write(struct burn_drive *d, + struct burn_drive *output_drive, int flag) +{ + return isoburn_cancel_prepared_write(d, output_drive, 1); +} + + +void isoburn_version(int *major, int *minor, int *micro) +{ + *major= isoburn_header_version_major; + *minor= isoburn_header_version_minor; + *micro= isoburn_header_version_micro; + +/* No more: values from version.h generated from version.h.in and + macro values defined in configure.ac + + *major = ISOBURN_MAJOR_VERSION; + *minor = ISOBURN_MINOR_VERSION; + *micro = ISOBURN_MICRO_VERSION; +*/ +} + + +int isoburn_is_compatible(int major, int minor, int micro, int flag) +{ + int own_major, own_minor, own_micro; + + isoburn_version(&own_major, &own_minor, &own_micro); + return(own_major > major || + (own_major == major && (own_minor > minor || + (own_minor == minor && own_micro >= micro)))); +} + + +/* ----------------------------------------------------------------------- */ +/* + Options for image reading. +*/ +/* ----------------------------------------------------------------------- */ + + +int isoburn_ropt_new(struct isoburn_read_opts **new_o, int flag) +{ + struct isoburn_read_opts *o; + + o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts)); + if(o==NULL) { + isoburn_msgs_submit(NULL, 0x00060000, + "Cannot allocate memory for read options", 0, "FATAL", 0); + return(-1); + } + o->norock= 0; + o->nojoliet= 0; + o->noiso1999= 1; + o->noaaip= 1; + o->noacl= 1; + o->noea= 1; + o->noino= 1; + o->nomd5= 1; + o->preferjoliet= 0; + o->uid= geteuid(); + o->gid= getegid(); + o->mode= 0444; + o->dirmode= 0555; + o->input_charset= NULL; + o->hasRR= 0; + o->hasJoliet= 0; + o->hasIso1999= 0; + o->hasElTorito= 0; + o->size= 0; + o->pretend_blank= 1; + o->displacement= 0; + o->displacement_sign= 0; + return(1); +} + + +int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag) +{ + if(*o==NULL) + return(0); + free(*o); + *o= NULL; + return(1); +} + + +int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext) +{ + o->norock= !!(ext&1); + o->nojoliet= !!(ext&2); + o->noiso1999= !!(ext&4); + o->preferjoliet= !!(ext&8); + o->pretend_blank= !!(ext&16); + o->noaaip= !!(ext & 32); + o->noacl= !!(ext & 64); + o->noea= !!(ext & 128); + o->noino= !!(ext & 256); + o->nomd5= (ext >> 9) & 3; + return(1); +} + + +int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext) +{ + *ext= (!!o->norock) | ((!!o->nojoliet)<<1) | ((!!o->noiso1999)<<2) | + ((!!o->preferjoliet)<<3) | ((!!o->pretend_blank)<<4) | + ((!!o->noaaip) << 5) | ((!!o->noacl) << 6) | ((!!o->noea) << 7) | + ((!!o->noino) << 8) | ((o->nomd5 & 3) << 9); + return(1); +} + + +int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o, + uid_t uid, gid_t gid, mode_t mode) +{ + mode_t dirmode; + + o->uid= uid; + o->gid= gid; + o->mode= mode; + dirmode= mode; + if(dirmode & S_IRUSR) + dirmode|= S_IXUSR; + if(dirmode & S_IRGRP) + dirmode|= S_IXGRP; + if(dirmode & S_IROTH) + dirmode|= S_IXOTH; + o->dirmode= dirmode; + return(1); +} + + +int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o, + uid_t *uid, gid_t *gid, mode_t *mode) +{ + *uid= o->uid; + *gid= o->gid; + *mode= o->mode; + return(1); +} + + +int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o, + mode_t mode) +{ + o->dirmode= mode; + return(1); +} + + +int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o, + mode_t *mode) +{ + *mode= o->dirmode; + return(1); +} + + +int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o, + char *input_charset) +{ + o->input_charset= input_charset; + return(1); +} + + +int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o, + char **input_charset) +{ + *input_charset= o->input_charset; + return(1); +} + + +int isoburn_ropt_set_auto_incharset(struct isoburn_read_opts *o, int mode) +{ + o->auto_input_charset= mode & 1; + return(1); +} + + +int isoburn_ropt_get_auto_incharset(struct isoburn_read_opts *o, int *mode) +{ + *mode= o->auto_input_charset; + return(1); +} + + +int isoburn_ropt_set_displacement(struct isoburn_read_opts *o, + uint32_t displacement, int displacement_sign) +{ + o->displacement= displacement; + o->displacement_sign= displacement_sign; + return(1); +} + + +int isoburn_ropt_get_displacement(struct isoburn_read_opts *o, + uint32_t *displacement, int *displacement_sign) +{ + *displacement= o->displacement; + *displacement_sign= o->displacement_sign; + return(1); +} + + +int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, + uint32_t *size, int *has_what) +{ + *size= o->size; + *has_what= (!!o->hasRR) | ((!!o->hasJoliet)<<1) | + ((!!o->hasIso1999)<<2) | ((!!o->hasElTorito)<<3); + return(1); +} + + +/* ----------------------------------------------------------------------- */ +/* + Options for image generation by libisofs and image transport to libburn. +*/ +/* ----------------------------------------------------------------------- */ + + +int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag) +{ + struct isoburn_imgen_opts *o; + int i; + + o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts)); + if(o==NULL) { + isoburn_msgs_submit(NULL, 0x00060000, + "Cannot allocate memory for image generation options", + 0, "FATAL", 0); + return(-1); + } + o->level= 2; + o->rockridge= 1; + o->joliet= 0; + o->iso1999= 0; + o->hardlinks= 0; + o->aaip = 0; + o->session_md5= 0; + o->file_md5= 0; + o->no_emul_toc= 0; + o->old_empty= 0; + o->untranslated_name_len = 0; + o->allow_dir_id_ext = 0; + o->omit_version_numbers= 0; + o->allow_deep_paths= 1; + o->allow_longer_paths= 0; + o->max_37_char_filenames= 0; + o->no_force_dots= 0; + o->allow_lowercase= 0; + o->allow_full_ascii= 0; + o->joliet_longer_paths= 0; + o->joliet_long_names= 0; + o->always_gmt= 0; + o->rrip_version_1_10= 0; + o->dir_rec_mtime= 0; + o->aaip_susp_1_10= 0; + o->sort_files= 0; + o->replace_dir_mode= 0; + o->replace_file_mode= 0; + o->replace_uid= 0; + o->replace_gid= 0; + o->dir_mode= 0555; + o->file_mode= 0444; + o->uid= 0; + o->gid= 0; + o->output_charset= NULL; + o->fifo_size= 4*1024*1024; + o->effective_lba= -1; + o->data_start_lba= -1; + o->system_area_data= NULL; + o->system_area_options= 0; + o->partition_offset= 0; + o->partition_secs_per_head= 0; + o->partition_heads_per_cyl= 0; + o->vol_creation_time= 0; + o->vol_modification_time= 0; + o->vol_expiration_time= 0; + o->vol_effective_time= 0; + o->libjte_handle= NULL; + o->tail_blocks= 0; + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { + o->appended_partitions[i]= NULL; + o->appended_part_types[i]= 0; + } + return(1); +} + + +int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag) +{ + int i; + + if(*o==NULL) + return(0); + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) + if((*o)->appended_partitions[i] != NULL) + free((*o)->appended_partitions[i]); + free(*o); + *o= NULL; + return(1); +} + + +int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level) +{ + o->level= level; + return(1); +} + + +int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level) +{ + *level= o->level; + return(1); +} + + +int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext) +{ + o->rockridge= !!(ext&1); + o->joliet= !!(ext&2); + o->iso1999= !!(ext&4); + o->hardlinks= !!(ext & 8); + o->aaip= !!(ext & 32); + o->session_md5= !!(ext & 64); + o->file_md5= (ext & (128 | 256)) >> 7; + o->no_emul_toc= !!(ext & 512); + o->will_cancel= !!(ext & 1024); + o->old_empty= !!(ext & 2048); + return(1); +} + + +int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext) +{ + *ext= (!!o->rockridge) | ((!!o->joliet)<<1) | ((!!o->iso1999)<<2) | + ((!!o->hardlinks) << 3) | ((!!o->aaip) << 5) | + ((!!o->session_md5) << 6) | ((o->file_md5 & 3) << 7) | + ((!!o->no_emul_toc) << 9) | ((o->will_cancel) << 10) | + ((!!o->old_empty) << 11); + return(1); +} + + +int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax) +{ + o->omit_version_numbers= (!!(relax&1)) | + (2 * !!(relax & isoburn_igopt_only_iso_versions)); + o->allow_deep_paths= !!(relax&2); + o->allow_longer_paths= !!(relax&4); + o->max_37_char_filenames= !!(relax&8); + o->no_force_dots= (!!(relax&16)) | + (2 * !!(relax & isoburn_igopt_no_j_force_dots)); + o->allow_lowercase= !!(relax&32); + o->allow_full_ascii= !!(relax&64); + o->joliet_longer_paths= !!(relax&128); + o->always_gmt= !!(relax & isoburn_igopt_always_gmt); + o->rrip_version_1_10= !!(relax & isoburn_igopt_rrip_version_1_10); + o->dir_rec_mtime= !!(relax & isoburn_igopt_dir_rec_mtime); + o->aaip_susp_1_10= !!(relax & isoburn_igopt_aaip_susp_1_10); + o->allow_dir_id_ext= !!(relax & isoburn_igopt_allow_dir_id_ext); + o->joliet_long_names= !!(relax & isoburn_igopt_joliet_long_names); + return(1); +} + + +int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax) +{ + *relax= (!!o->omit_version_numbers) | ((!!o->allow_deep_paths)<<1) | + ((!!o->allow_longer_paths)<<2) | ((!!o->max_37_char_filenames)<<3) | + ((!!(o->no_force_dots & 1))<<4)| ((!!o->allow_lowercase)<<5) | + ((!!o->allow_full_ascii)<<6) | ((!!o->joliet_longer_paths)<<7) | + ((!!o->always_gmt)<<8) | ((!!o->rrip_version_1_10)<<9) | + ((!!o->dir_rec_mtime)<<10) | ((!!o->aaip_susp_1_10)<<11) | + ((!!(o->omit_version_numbers & 2))<<12) | + ((!!(o->no_force_dots & 2))<<13) | + ((!!o->allow_dir_id_ext) << 14) | + ((!!o->joliet_long_names) << 15); + return(1); +} + +int isoburn_igopt_set_untranslated_name_len(struct isoburn_imgen_opts *o, + int len) +{ + int ret; + IsoWriteOpts *opts = NULL; + char *msg= NULL; + + msg= calloc(1, 160); + if(msg == NULL) + {ret= -1; goto ex;} + + ret= iso_write_opts_new(&opts, 0); + if(ret < 0) { + isoburn_msgs_submit(NULL, 0x00060000, + "Cannot create libisofs write options object", 0, "FATAL", 0); + {ret= 0; goto ex;} + } + ret= iso_write_opts_set_untranslated_name_len(opts, len); + if(ret < 0) { + ret= iso_write_opts_set_untranslated_name_len(opts, -1); + sprintf(msg, + "Improper value for maximum length of untranslated names (%d <-> -1 ... %d)", + len, ret); + isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "FAILURE", 0); + iso_write_opts_free(opts); + {ret= 0; goto ex;} + } + o->untranslated_name_len= ret; /* Normalized len value */ + iso_write_opts_free(opts); + ret= 1; +ex:; + if(msg != NULL) + free(msg); + return(ret); +} + + +int isoburn_igopt_get_untranslated_name_len(struct isoburn_imgen_opts *o, + int *len) +{ + *len = o->untranslated_name_len; + return(1); +} + + +int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value) +{ + o->sort_files= !!(value&1); + return(1); +} + + +int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value) +{ + *value= !!o->sort_files; + return(1); +} + + +int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o, + int replace_dir_mode, int replace_file_mode, + mode_t dir_mode, mode_t file_mode) +{ + o->replace_dir_mode= replace_dir_mode%3; + o->replace_file_mode= replace_file_mode%3; + o->dir_mode= dir_mode; + o->file_mode= file_mode; + return(1); +} + + +int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o, + int *replace_dir_mode, int *replace_file_mode, + mode_t *dir_mode, mode_t *file_mode) +{ + *replace_dir_mode= o->replace_dir_mode%3; + *replace_file_mode= o->replace_file_mode%3; + *dir_mode= o->dir_mode; + *file_mode= o->file_mode; + return(1); +} + + +int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o, + int replace_uid, int replace_gid, + uid_t uid, gid_t gid) +{ + o->replace_uid= replace_uid%3; + o->replace_gid= replace_gid%3; + o->uid= uid; + o->gid= gid; + return(1); +} + +int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o, + int *replace_uid, int *replace_gid, + uid_t *uid, gid_t *gid) +{ + *replace_uid= o->replace_uid%3; + *replace_gid= o->replace_gid%3; + *uid= o->uid; + *gid= o->gid; + return(1); +} + + +int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o, + char *output_charset) +{ + o->output_charset= output_charset; + return(1); +} + + +int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o, + char **output_charset) +{ + *output_charset= o->output_charset; + return(1); +} + + +int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size) +{ + o->fifo_size= fifo_size; + return(1); +} + + +int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size) +{ + *fifo_size= o->fifo_size; + return(1); +} + + +int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba) +{ + *lba= o->effective_lba; + return(1); +} + + +int isoburn_igopt_get_data_start(struct isoburn_imgen_opts *o, int *lba) +{ + *lba= o->data_start_lba; + return(1); +} + + +int isoburn_igopt_set_scdbackup_tag(struct isoburn_imgen_opts *o, char *name, + char *timestamp, char *tag_written) +{ + strncpy(o->scdbackup_tag_name, name, 80); + o->scdbackup_tag_name[80]= 0; + strncpy(o->scdbackup_tag_time, timestamp, 18); + o->scdbackup_tag_time[18]= 0; + o->scdbackup_tag_written = tag_written; + if(tag_written != NULL) + tag_written[0]= 0; + return(1); +} + + +int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o, + char name[81], char timestamp[19], + char **tag_written) +{ + strncpy(name, o->scdbackup_tag_name, 80); + name[80]= 0; + strncpy(timestamp, o->scdbackup_tag_time, 18); + timestamp[18]= 0; + *tag_written= o->scdbackup_tag_written; + return(1); +} + + +int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *opts, + char data[32768], int options) +{ + if (data == NULL) { /* Disable */ + if (opts->system_area_data != NULL) + free(opts->system_area_data); + opts->system_area_data = NULL; + } else { + if (opts->system_area_data == NULL) { + opts->system_area_data = calloc(32768, 1); + if (opts->system_area_data == NULL) + return(-1); + } + memcpy(opts->system_area_data, data, 32768); + } + opts->system_area_options = options & 0x3ff; + return(1); +} + + +int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *opts, + char data[32768], int *options) +{ + *options= opts->system_area_options; + if(opts->system_area_data == NULL) + return(0); + memcpy(data, opts->system_area_data, 32768); + return(1); +} + + +int isoburn_igopt_set_pvd_times(struct isoburn_imgen_opts *opts, + time_t vol_creation_time, time_t vol_modification_time, + time_t vol_expiration_time, time_t vol_effective_time, + char *vol_uuid) +{ + opts->vol_creation_time = vol_creation_time; + opts->vol_modification_time = vol_modification_time; + opts->vol_expiration_time = vol_expiration_time; + opts->vol_effective_time = vol_effective_time; + strncpy(opts->vol_uuid, vol_uuid, 16); + opts->vol_uuid[16] = 0; + return(1); +} + + +int isoburn_igopt_get_pvd_times(struct isoburn_imgen_opts *opts, + time_t *vol_creation_time, time_t *vol_modification_time, + time_t *vol_expiration_time, time_t *vol_effective_time, + char vol_uuid[17]) +{ + *vol_creation_time = opts->vol_creation_time; + *vol_modification_time = opts->vol_modification_time; + *vol_expiration_time = opts->vol_expiration_time; + *vol_effective_time = opts->vol_effective_time; + strcpy(vol_uuid, opts->vol_uuid); + return(1); +} + + +int isoburn_igopt_set_part_offset(struct isoburn_imgen_opts *opts, + uint32_t block_offset_2k, + int secs_512_per_head, int heads_per_cyl) +{ + if (block_offset_2k > 0 && block_offset_2k < 16) + return(0); + opts->partition_offset = block_offset_2k; + opts->partition_secs_per_head = secs_512_per_head; + opts->partition_heads_per_cyl = heads_per_cyl; + return(1); +} + + +int isoburn_igopt_get_part_offset(struct isoburn_imgen_opts *opts, + uint32_t *block_offset_2k, + int *secs_512_per_head, int *heads_per_cyl) +{ + *block_offset_2k = opts->partition_offset; + *secs_512_per_head = opts->partition_secs_per_head; + *heads_per_cyl = opts->partition_heads_per_cyl; + return 1; +} + + +int isoburn_igopt_attach_jte(struct isoburn_imgen_opts *opts, + void *libjte_handle) +{ + opts->libjte_handle = libjte_handle; + return 1; +} + + +int isoburn_igopt_detach_jte(struct isoburn_imgen_opts *opts, + void **libjte_handle) +{ + if(libjte_handle != NULL) + *libjte_handle = opts->libjte_handle; + opts->libjte_handle = NULL; + return 1; +} + + +int isoburn_igopt_set_tail_blocks(struct isoburn_imgen_opts *opts, + uint32_t num_blocks) +{ + opts->tail_blocks = num_blocks; + return 1; +} + +int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts, + uint32_t *num_blocks) +{ + *num_blocks = opts->tail_blocks; + return 1; +} + + +int isoburn_igopt_set_partition_img(struct isoburn_imgen_opts *opts, + int partition_number, uint8_t partition_type, + char *image_path) +{ + char msg[80]; + + if (partition_number < 1 || + partition_number > Libisoburn_max_appended_partitionS) { + sprintf(msg, "Partition number is out of range (1 ... %d)", + Libisoburn_max_appended_partitionS); + isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "FAILURE", 0); + return(0); + } + if (opts->appended_partitions[partition_number - 1] != NULL) + free(opts->appended_partitions[partition_number - 1]); + opts->appended_partitions[partition_number - 1] = strdup(image_path); + if (opts->appended_partitions[partition_number - 1] == NULL) + return(-1); + opts->appended_part_types[partition_number - 1] = partition_type; + return(1); +} + + +int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts, + int num_entries, + uint8_t partition_types[], + char *image_paths[]) +{ + int i, max_entry= 0; + + for(i= 0; i < num_entries; i++) + image_paths[i]= NULL; + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { + if(opts->appended_partitions[i] == NULL) + continue; + if(i < num_entries) { + image_paths[i]= opts->appended_partitions[i]; + partition_types[i]= opts->appended_part_types[i]; + } + max_entry= i + 1; + } + return(max_entry); +} + + +int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label) +{ + strncpy(opts->ascii_disc_label, label, Libisoburn_disc_label_sizE - 1); + opts->ascii_disc_label[Libisoburn_disc_label_sizE - 1] = 0; + return(1); +} + + +int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts, char **label) +{ + *label= opts->ascii_disc_label; + return(1); +} + diff --git a/libisoburn/branches/1.1.8/libisoburn/isoburn.h b/libisoburn/branches/1.1.8/libisoburn/isoburn.h new file mode 100644 index 00000000..c065121d --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/isoburn.h @@ -0,0 +1,697 @@ + +/* + Class struct of libisoburn. + + Copyright 2007 - 2011 Vreixo Formoso Lopes + and Thomas Schmitt + Provided under GPL version 2 or later. +*/ + +#ifndef Isoburn_includeD +#define Isoburn_includeD + + +/* for uint8_t */ +#ifdef HAVE_STDINT_H +#include +#else +#ifdef HAVE_INTTYPES_H +#include +#endif +#endif + +/* For emulated TOC of overwriteable media. + Provides minimal info for faking a struct burn_toc_entry. +*/ +struct isoburn_toc_entry { + int session; + int track_no; /* point */ + int start_lba; + int track_blocks; + + char *volid; /* For caching a volume id from emulated toc on overwriteables */ + + struct isoburn_toc_entry *next; +}; + +int isoburn_toc_entry_new(struct isoburn_toc_entry **objpt, + struct isoburn_toc_entry *boss, int flag); + +/* @param flag bit0= delete all subordinates too +*/ +int isoburn_toc_entry_destroy(struct isoburn_toc_entry **o, int flag); + + +/* Minimal size of target_iso_head which is to be written during + isoburn_activate_session(). + Within this size there is everything that is needed for image access with + no partition offset. The actual target_iso_head buffer must be larger by + the evential partition offset. +*/ +#define Libisoburn_target_head_sizE (32*2048) + + +/* Maximum number of appended partitions. Effectively usable number depends + on system area type. +*/ +#define Libisoburn_max_appended_partitionS 8 + +/* + Maximum length of a disc label text plus 1. +*/ +#define Libisoburn_disc_label_sizE 129 + + +struct isoburn { + + + /* The libburn drive to which this isoburn object is related + Most isoburn calls will use a burn_drive as object handle */ + struct burn_drive *drive; + + /* -1= inappropriate medium state detected + 0= libburn multi-session medium, resp. undecided yet + 1= random access medium */ + int emulation_mode; + + /* Although rarely used, libburn can operate on several + drives simultaneously. */ + struct isoburn *prev; + struct isoburn *next; + + + /* If >= 0, this address is used as reply for isoburn_disc_get_msc1() + */ + int fabricated_msc1; + + /* If >= 0, this address is used in isoburn_disc_track_lba_nwa() + as reply parameter nwa. + (The other nwa parameters below apply only to the effective write address + on random access media. msc2 is handed to libisofs but not to libburn.) + */ + int fabricated_msc2; + + + /* The nwa to be used for a first session on the present kind of overwriteable + media (usually Libisoburn_overwriteable_starT, but might be forced to 0) + */ + int zero_nwa; + + /* Start address as given by image examination (bytes, not blocks) */ + off_t min_start_byte; + + /* Aligned start address to be used for processing (counted in blocks) */ + int nwa; + + + /* Truncate to .nwa an eventual regular file serving as output drive */ + int truncate; + + /* Eventual freely fabricated isoburn_disc_get_status(). + BURN_DISC_UNREADY means that this variable is disabled + and normally emulated status is in effect. + */ + enum burn_disc_status fabricated_disc_status; + + /* To be set if read errors occured during media evaluation. + */ + int media_read_error; + + /* Eventual emulated table of content read from the chain of ISO headers + on overwriteable media. + */ + struct isoburn_toc_entry *toc; + + /* Indicator wether the most recent burn run worked : + -1 = undetermined, ask libburn , 0 = failure , 1 = success + To be inquired by isoburn_drive_wrote_well() + */ + int wrote_well; + + + /* ISO head buffer to be filled by write run */ + int target_iso_head_size; + uint8_t *target_iso_head; + + /* The 2k offset which was read from a loaded image. + */ + uint32_t loaded_partition_offset; + + + /* Libisofs image context */ + IsoImage *image; + + /* The block data source from which the existing image is read. + */ + IsoDataSource *iso_data_source; + + /* The burn source which transfers data from libisofs to libburn. + It has its own fifo. + */ + struct burn_source *iso_source; + + /* For iso_tree_set_report_callback() */ + int (*read_pacifier)(IsoImage*, IsoFileSource*); + + /* For iso_image_attach_data() */ + void *read_pacifier_handle; + + /* An application provided method to immediately deliver messages */ + int (*msgs_submit)(void *handle, int error_code, char msg_text[], + int os_errno, char severity[], int flag); + void *msgs_submit_handle; /* specific to application method */ + int msgs_submit_flag; /* specific to application method */ + +}; + + +/* Creation and disposal function */ +int isoburn_new(struct isoburn **objpt, int flag); +int isoburn_destroy(struct isoburn **objpt, int flag); + +/* Eventual readers for public attributes */ +/* ( put into separate .h file then ) */ +int isoburn_get_emulation_mode(struct isoburn *o, int *pt, int flag); +int isoburn_get_target_volset(struct isoburn *o, IsoImage **pt, int flag); + +/* List management */ +int isoburn_get_prev(struct isoburn *o, struct isoburn **pt, int flag); +int isoburn_get_next(struct isoburn *o, struct isoburn **pt, int flag); +int isoburn_destroy_all(struct isoburn **objpt, int flag); +int isoburn_link(struct isoburn *o, struct isoburn *link, int flag); +int isoburn_count(struct isoburn *o, int flag); +int isoburn_by_idx(struct isoburn *o, int idx, struct isoburn **pt, int flag); +int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag); + + +/* Non API inner interfaces */ + +/* Submit a libisofs error to the libburn messenger. An application message + reader shall recognize the error code range and attribute it to the + libisofs message channel to which one cannot submit via API. + @param iso_error_code return value <= 0 from a libisofs API call. + @param default_msg_text is to be put out if iso_error_code leads to no + error message + @param os_errno operating system errno, submit 0 if none is known + @param min_severity minimum severity, might be be increased if libisofs + error severity surpasses min_severity. + @param flag Bitfield, submit 0 for now +*/ +int isoburn_report_iso_error(int iso_error_code, char default_msg_text[], + int os_errno, char min_severity[], int flag); + +/* Calls from burn_wrap.c into isofs_wrap.c */ + +int isoburn_start_emulation(struct isoburn *o, int flag); +int isoburn_invalidate_iso(struct isoburn *o, int flag); + + +/* Calls from isofs_wrap.c into burn_wrap.c */ + +/** Get an eventual isoburn object which is wrapped around the drive. + @param pt Eventually returns a pointer to the found object. + It is allowed to become NULL if return value is -1 or 0. + In this case, the drive is a genuine libburn drive + with no emulation activated by isoburn. + @param drive The drive to be searched for + @param flag unused yet + @return -1 unsuitable medium, 0 generic medium, 1 emulated medium. +*/ +int isoburn_find_emulator(struct isoburn **pt, + struct burn_drive *drive, int flag); + +/* Deliver an event message. Either via a non-NULL o->msgs_submit() method + or via burn_msgs_submit() of libburn. +*/ +int isoburn_msgs_submit(struct isoburn *o, int error_code, char msg_text[], + int os_errno, char severity[], int flag); + +/** Set the start address for an emulated add-on session. The value will + be rounded up to the alignment necessary for the medium. The aligned + value will be divided by 2048 and then put into o->nwa . + @param o The isoburn object to be programmed. + @param value The start address in bytes + @param flag unused yet + @return <=0 is failure , >0 success +*/ +int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag); + +/** Obtains the image address offset to be used with image generation. + This is either the (emulated) drive nwa or a value set by + isoburn_prepare_blind_grow(). + In any case this is the address to tell to iso_write_opts_set_ms_block(). + @param o The isoburn object to be inquired + @param opts If not NULL: write parameters to be set on drive before query + @param msc2 The value to be used with iso_write_opts_set_ms_block() + @param flag unused yet + @return <=0 is failure , >0 success +*/ +int isoburn_get_msc2(struct isoburn *o, + struct burn_write_opts *opts, int *msc2, int flag); + +/** Get a data source suitable for read from a drive using burn_read_data() + function. + @param d drive to read from. Must be grabbed. + @param displacement will be added or subtracted to any block address + @param displacement_sign +1 = add , -1= subtract , else keep unaltered + @return the data source, NULL on error. Must be freed with libisofs + iso_data_source_unref() function. Note: this doesn't release + the drive. +*/ +IsoDataSource * +isoburn_data_source_new(struct burn_drive *d, + uint32_t displacement, int displacement_sign); + +/** Disable read capabilities of a data source which was originally created + by isoburn_data_source_new(). After this any attempt to read will yield + a FATAL programming error event. + This is usually done to allow libburn to release the drive while libisofs + still holds a reference to the data source object. libisofs is not supposed + to use this object for reading any more, nevertheless. The disabled state + of the data source is a safety fence around this daring situation. + @param src The data source to be disabled + @param flag unused yet + @return <=0 is failure , >0 success +*/ +int isoburn_data_source_shutdown(IsoDataSource *src, int flag); + + +/** Check whether the size of target_iso_head matches the given partition + offset. Eventually adjust size. +*/ +int isoburn_adjust_target_iso_head(struct isoburn *o, + uint32_t offst, int flag); + +/** + * Options for image reading. + (Comments here may be outdated. API getter/setter function descriptions + may override the descriptions here. Any difference is supposed to be a + minor correction only.) + */ +struct isoburn_read_opts { + unsigned int norock:1; /*< Do not read Rock Ridge extensions */ + unsigned int nojoliet:1; /*< Do not read Joliet extensions */ + unsigned int noiso1999:1; /*< Do not read ISO 9660:1999 enhanced tree */ + + /* ts A90121 */ + unsigned int noaaip:1; /* Do not read AAIP for ACL and EA */ + unsigned int noacl:1; /* Do not read ACL from external file objects */ + unsigned int noea:1; /* Do not read XFS-style EA from externals */ + + /* ts A90508 */ + unsigned int noino:1; /* Discard eventual PX inode numbers */ + + /* ts A90810 */ + unsigned int nomd5:2; /* Do not read eventual MD5 array */ + + unsigned int preferjoliet:1; + /*< When both Joliet and RR extensions are present, the RR + * tree is used. If you prefer using Joliet, set this to 1. */ + uid_t uid; /**< Default uid when no RR */ + gid_t gid; /**< Default uid when no RR */ + mode_t mode; /**< Default mode when no RR (only permissions) */ + mode_t dirmode; /**< Default mode for directories + when no RR (only permissions) */ + + /** + * Input charset for RR file names. NULL to use default locale charset. + */ + char *input_charset; + + /** + * Enable or disable methods to automatically choose an input charset. + * This eventually overrides input_charset. + * + * bit0= allow to set the input character set automatically from + * attribute "isofs.cs" of root directory + */ + int auto_input_charset; + + /* modified by the function isoburn_read_image */ + unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present, + to 0 if not. */ + unsigned int hasJoliet:1; /*< It will be set to 1 if Joliet extensions are + present, to 0 if not. */ + + /** + * It will be set to 1 if the image is an ISO 9660:1999, i.e. it has + * a version 2 Enhanced Volume Descriptor. + */ + unsigned int hasIso1999:1; + + /** It will be set to 1 if El-Torito boot record is present, to 0 if not.*/ + unsigned int hasElTorito:1; + + uint32_t size; /**< Will be filled with the size (in 2048 byte block) of + * the image, as reported in the PVM. */ + unsigned int pretend_blank:1; /* always create empty image */ + + uint32_t displacement; + int displacement_sign; +}; + + +/** + * Options for image generation by libisofs and image transport to libburn. + (Comments here may be outdated. API getter/setter function descriptions + may override the descriptions here. Any difference is supposed to be a + minor correction only.) + */ +struct isoburn_imgen_opts { + + /* Options for image generation */ + + int will_cancel :1; + + int level; /**< ISO level to write at. */ + + /** Which extensions to support. */ + unsigned int rockridge :1; + unsigned int joliet :1; + unsigned int iso1999 :1; + + /* Whether to mark suitable IsoNode as hardlinks in RRIP PX */ + unsigned int hardlinks :1; + + /* Write eventual AAIP info containing ACL and EA */ + unsigned int aaip :1; + + /* Produce and write a MD5 checksum of the whole session stream. */ + unsigned int session_md5 :1; + + /* Produce and write MD5 checksums for each single IsoFile. + See parameter "files" of iso_write_opts_set_record_md5(). + */ + unsigned int file_md5 :2; + + /* On overwriteable media or random access files do not write the first + session to LBA 32, but rather to LBA 0 directly. + */ + unsigned int no_emul_toc :1; + + /* For empty files, symbolic links, and devices use the old ECMA-119 block + addresses in the range [0,31] rather than the address of the dedicated + empty block. + */ + unsigned int old_empty :1; + + + /* relaxed constraints */ + + /* + * Relaxed constraints. Setting any of these to 1 break the specifications, + * but it is supposed to work on most moderns systems. Use with caution. + */ + + /* + * Extra Caution: This option breaks any assumptions about names that + * are supported by ECMA-119 specifications. + * Omit any translation which would make a file name compliant to the + * ECMA-119 rules. This includes and exceeds omit_version_numbers, + * max_37_char_filenames, no_force_dots bit0, allow_lowercase. + */ + unsigned int untranslated_name_len; + + /* + * Convert directory names for ECMA-119 similar to other file names, but do + * not force a dot or add a version number. + * This violates ECMA-119 by allowing one "." and especially ISO level 1 + * by allowing DOS style 8.3 names rather than only 8 characters. + * (mkisofs and its clones seem to do this violation.) + */ + unsigned int allow_dir_id_ext :1; + + /** + * Omit the version number (";1") at the end of the ISO-9660 identifiers. + * Version numbers are usually not used. + * bit0= omit version number with ECMA-119 and Joliet + * bit1= omit version number with Joliet alone + */ + unsigned int omit_version_numbers :2; + + /** + * Allow ISO-9660 directory hierarchy to be deeper than 8 levels. + */ + unsigned int allow_deep_paths :1; + + /** + * Allow path in the ISO-9660 tree to have more than 255 characters. + */ + unsigned int allow_longer_paths :1; + + /** + * Allow a single file or directory hierarchy to have up to 37 characters. + * This is larger than the 31 characters allowed by ISO level 2, and the + * extra space is taken from the version number, so this also forces + * omit_version_numbers. + */ + unsigned int max_37_char_filenames :1; + + /** + * ISO-9660 forces filenames to have a ".", that separates file name from + * extension. libisofs adds it if original filename doesn't has one. Set + * this to 1 to prevent this behavior + * bit0= no forced dot with ECMA-119 + * bit1= no forced dot with Joliet + */ + unsigned int no_force_dots :2; + + /** + * Allow lowercase characters in ISO-9660 filenames. By default, only + * uppercase characters, numbers and a few other characters are allowed. + */ + unsigned int allow_lowercase :1; + + /** + * Allow all ASCII characters to be appear on an ISO-9660 filename. Note + * that "/" and "\0" characters are never allowed, even in RR names. + */ + unsigned int allow_full_ascii :1; + + /** + * Allow paths in the Joliet tree to have more than 240 characters. + */ + unsigned int joliet_longer_paths :1; + + /** + * Allow leaf names in the Joliet tree to have up to 103 characters + * rather than 64. + */ + unsigned int joliet_long_names :1; + + /** + * Store timestamps as GMT rather than in local time. + */ + unsigned int always_gmt :1; + + /** + * Write Rock Ridge info as of specification RRIP-1.10 rather than + * RRIP-1.12: signature "RRIP_1991A" rather than "IEEE_1282", + * field PX without file serial number + */ + unsigned int rrip_version_1_10 :1; + + /** + * Store as ECMA-119 Directory Record timestamp the mtime + * of the source rather than the image creation time. + */ + unsigned int dir_rec_mtime :1; + + /** + * Write AAIP as extension according to SUSP 1.10 rather than SUSP 1.12. + * I.e. without announcing it by an ER field and thus without the need + * to preceed the RRIP fields by an ES and to preceed the AA field by ES. + */ + unsigned int aaip_susp_1_10 :1; + + unsigned int sort_files:1; + /**< If files should be sorted based on their weight. */ + + /** + * The following options set the default values for files and directory + * permissions, gid and uid. All these take one of three values: 0, 1 or 2. + * If 0, the corresponding attribute will be kept as set in the IsoNode. + * Unless you have changed it, it corresponds to the value on disc, so it + * is suitable for backup purposes. If set to 1, the corresponding attrib. + * will be changed by a default suitable value. Finally, if you set it to + * 2, the attrib. will be changed with the value specified in the options + * below. Note that for mode attributes, only the permissions are set, the + * file type remains unchanged. + */ + unsigned int replace_dir_mode :2; + unsigned int replace_file_mode :2; + unsigned int replace_uid :2; + unsigned int replace_gid :2; + + mode_t dir_mode; /** Mode to use on dirs when replace_dir_mode == 2. */ + mode_t file_mode; /** Mode to use on files when replace_file_mode == 2. */ + uid_t uid; /** uid to use when replace_uid == 2. */ + gid_t gid; /** gid to use when replace_gid == 2. */ + + char *output_charset; /**< NULL to use default charset */ + + + /* Options for image transport */ + + /** The number of bytes to be used for the fifo which decouples libisofs + and libburn for better throughput and for reducing the risk of + interrupting signals hitting the libburn thread which operates the + MMC drive. + The size will be rounded up to the next full 2048. + Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway). + */ + int fifo_size; + + + /** Output value: Block address of session start as evaluated from medium + and other options by libisoburn and libburn. + If <0 : Invalid + If >=0: Valid block number. Block size is always 2 KiB. + */ + int effective_lba; + + /** Output value: Block address of data section start as predicted by + libisofs. + If < 16: Invalid + If >=16: Valid block number. Block size is always 2 KiB. + */ + int data_start_lba; + + /** + * If not empty: Parameters "name" and "timestamp" for a scdbackup stream + * checksum tag. See scdbackup/README appendix VERIFY. + * It makes sense only for single session images which start at LBA 0. + * Such a tag may be part of a libisofs checksum tag block after the + * session tag line. It then covers the whole session up to its own start + * position. + * If scdbackup_tag_written is not NULL then it is a pointer to an + * application provided array with at least 512 characters. The effectively + * written scdbackup tag will be copied to this memory location. + */ + char scdbackup_tag_name[81]; + char scdbackup_tag_time[19]; + char *scdbackup_tag_written; + + + /* Content of an embedded boot image. Valid if not NULL. + * In that case it must point to a memory buffer at least 32 kB. + */ + char *system_area_data; + /* + * bit0= make bytes 446 - 512 of the system area a partition + * table which reserves partition 1 from byte 63*512 to the + * end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl. + * (GRUB protective msdos label.) + * This works with and without system_area_data. + */ + int system_area_options; + + /* User settable PVD time stamps */ + time_t vol_creation_time; + time_t vol_modification_time; + time_t vol_expiration_time; + time_t vol_effective_time; + /* To eventually override vol_modification_time by unconverted string + and timezone 0 */ + char vol_uuid[17]; + + /* The number of unclaimed 2K blocks before start of partition 1 as of + the MBR in system area. If not 0 this will cause double volume + descriptor sets and double tree. + */ + uint32_t partition_offset; + /* Partition table parameter: 1 to 63, 0= disabled/default */ + int partition_secs_per_head; + /* 1 to 255, 0= disabled/default */ + int partition_heads_per_cyl; + + /* Parameters and state of Jigdo Template Export environment. + */ + void *libjte_handle; + + /* A trailing padding of zero bytes which belongs to the image + */ + uint32_t tail_blocks; + + /* Eventual disk file paths of prepared images which shall be appended + after the ISO image and described by partiton table entries in a MBR. + */ + char *appended_partitions[Libisoburn_max_appended_partitionS]; + uint8_t appended_part_types[Libisoburn_max_appended_partitionS]; + + /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label. + */ + char ascii_disc_label[Libisoburn_disc_label_sizE]; +}; + + +/* Alignment for session starts on overwriteable media. + (Increased from 16 to 32 blocks for aligning to BD-RE clusters.) +*/ +#define Libisoburn_nwa_alignemenT 32 + + +/* Alignment for outer session scanning with -ROM drives. + (E.g. my DVD-ROM drive shows any DVD type as 0x10 "DVD-ROM" with + more or less false capacity and TOC.) +*/ +#define Libisoburn_toc_scan_alignemenT 16 + +/* Maximum gap to be bridged during a outer TOC scan. Gaps appear between the + end of a session and the start of the next session. + The longest gap found so far was about 38100 after the first session of a + DVD-R. +*/ +#define Libisoburn_toc_scan_max_gaP 65536 + + +/* Creating a chain of image headers which form a TOC: + + The header of the first session is written after the LBA 0 header. + So it persists and can give the end of its session. By help of + Libisoburn_nwa_alignemenT it should be possible to predict the start + of the next session header. + The LBA 0 header is written by isoburn_activate_session() already + with the first session. So the medium is mountable. + A problem arises with DVD-RW in Intermediate State. They cannot be + written by random access before they were written sequentially. + In this case, no copy of the session 1 header is maintained and no TOC + will be possible. Thus writing begins sequentially at LBA 0. + + IMPORTANT: This macro gives the minimal size of an image header. + It has to be enlarged by the eventual partition offset. +*/ +#define Libisoburn_overwriteable_starT \ + ((off_t) (Libisoburn_target_head_sizE/2048)) + + +/* Wrappers for emulation of TOC on overwriteable media */ + +struct isoburn_toc_track { + /* Either track or toc_entry are supposed to be NULL */ + struct burn_track *track; + struct isoburn_toc_entry *toc_entry; +}; + +struct isoburn_toc_session { + /* Either session or tracks and toc_entry are supposed to be NULL */ + struct burn_session *session; + struct isoburn_toc_track **track_pointers; + int track_count; + struct isoburn_toc_entry *toc_entry; +}; + +struct isoburn_toc_disc { + /* Either disc or sessions and toc are supposed to be NULL */ + struct burn_disc *disc; + struct isoburn_toc_session *sessions; /* storage array */ + struct isoburn_toc_session **session_pointers; /* storage array */ + struct isoburn_toc_track *tracks; /* storage array */ + struct isoburn_toc_track **track_pointers; /* storage array */ + int session_count; + int track_count; + struct isoburn_toc_entry *toc; +}; + +#endif /* Isoburn_includeD */ + diff --git a/libisoburn/branches/1.1.8/libisoburn/isofs_wrap.c b/libisoburn/branches/1.1.8/libisoburn/isofs_wrap.c new file mode 100644 index 00000000..842b37d5 --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/isofs_wrap.c @@ -0,0 +1,624 @@ + +/* + cc -g -c isofs_wrap.c +*/ + +/* + libisofs related functions of libisoburn. + + Copyright 2007 - 2011 Vreixo Formoso Lopes + Thomas Schmitt + Provided under GPL version 2 or later. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include + +#ifndef Xorriso_standalonE + +#include + +#include + +#else /* ! Xorriso_standalonE */ + +#include "../libisofs/libisofs.h" +#include "../libburn/libburn.h" + +#endif /* Xorriso_standalonE */ + +#include "libisoburn.h" +#include "isoburn.h" + +#define BP(a,b) [(b) - (a) + 1] + +struct ecma119_pri_vol_desc +{ + uint8_t vol_desc_type BP(1, 1); + uint8_t std_identifier BP(2, 6); + uint8_t vol_desc_version BP(7, 7); + uint8_t unused1 BP(8, 8); + uint8_t system_id BP(9, 40); + uint8_t volume_id BP(41, 72); + uint8_t unused2 BP(73, 80); + uint8_t vol_space_size BP(81, 88); + uint8_t unused3 BP(89, 120); + uint8_t vol_set_size BP(121, 124); + uint8_t vol_seq_number BP(125, 128); + uint8_t block_size BP(129, 132); + uint8_t path_table_size BP(133, 140); + uint8_t l_path_table_pos BP(141, 144); + uint8_t opt_l_path_table_pos BP(145, 148); + uint8_t m_path_table_pos BP(149, 152); + uint8_t opt_m_path_table_pos BP(153, 156); + uint8_t root_dir_record BP(157, 190); + uint8_t vol_set_id BP(191, 318); + uint8_t publisher_id BP(319, 446); + uint8_t data_prep_id BP(447, 574); + uint8_t application_id BP(575, 702); + uint8_t copyright_file_id BP(703, 739); + uint8_t abstract_file_id BP(740, 776); + uint8_t bibliographic_file_id BP(777, 813); + uint8_t vol_creation_time BP(814, 830); + uint8_t vol_modification_time BP(831, 847); + uint8_t vol_expiration_time BP(848, 864); + uint8_t vol_effective_time BP(865, 881); + uint8_t file_structure_version BP(882, 882); + uint8_t reserved1 BP(883, 883); + uint8_t app_use BP(884, 1395); + uint8_t reserved2 BP(1396, 2048); +}; + +static +uint32_t iso_read_lsb(const uint8_t *buf, int bytes) +{ + int i; + uint32_t ret = 0; + + for (i=0; iimage); + return o->image; +} + + +static void isoburn_idle_free_function(void *ignored) +{ + return; +} + + +/* API function. See libisoburn.h +*/ +int isoburn_read_image(struct burn_drive *d, + struct isoburn_read_opts *read_opts, + IsoImage **image) +{ + int ret, int_num, dummy; + IsoReadOpts *ropts= NULL; + IsoReadImageFeatures *features= NULL; + uint32_t ms_block; + char *msg= NULL; + enum burn_disc_status status= BURN_DISC_BLANK; + IsoDataSource *ds= NULL; + struct isoburn *o= NULL; + + msg= calloc(1, 160); + + if(d != NULL) { + ret = isoburn_find_emulator(&o, d, 0); + if (ret < 0 || o == NULL) + {ret= 0; goto ex;} + status = isoburn_disc_get_status(d); + } + if(read_opts==NULL) { + isoburn_msgs_submit(o, 0x00060000, + "Program error: isoburn_read_image: read_opts==NULL", + 0, "FATAL", 0); + {ret= -1; goto ex;} + } + if (d == NULL || status == BURN_DISC_BLANK || read_opts->pretend_blank) { +create_blank_image:; + /* + * Blank disc, we create a new image without files. + */ + + if (d == NULL) { + /* New empty image without relation to a drive */ + if (image==NULL) { + isoburn_msgs_submit(o, 0x00060000, + "Program error: isoburn_read_image: image==NULL", + 0, "FATAL", 0); + {ret= -1; goto ex;} + } + /* create a new image */ + ret = iso_image_new("ISOIMAGE", image); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot create image", 0, "FATAL", 0); + goto ex; + } + iso_image_set_ignore_aclea(*image, + (!!(read_opts->noacl)) | ((!!read_opts->noea) << 1) ); + } else { + /* Blank new image for the drive */ + iso_image_unref(o->image); + ret = iso_image_new("ISOIMAGE", &o->image); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot create image", 0, "FATAL", 0); + goto ex; + } + if (image != NULL) { + *image = o->image; + iso_image_ref(*image); /*protects object from premature free*/ + } + iso_image_set_ignore_aclea(o->image, + (!!(read_opts->noacl)) | ((!!read_opts->noea) << 1) ); + } + {ret= 1; goto ex;} + } + + if (status != BURN_DISC_APPENDABLE && status != BURN_DISC_FULL) { + isoburn_msgs_submit(o, 0x00060000, + "Program error: isoburn_read_image: incorrect disc status", + 0, "FATAL", 0); + {ret= -4; goto ex;} + } + + memset((char *) &ropts, 0, sizeof(ropts)); + + ret = isoburn_disc_get_msc1(d, &int_num); + if (ret <= 0) + {ret= -2; goto ex;} + ms_block= int_num; + ret = isoburn_read_iso_head(d, int_num, &dummy, NULL, 0); + if (ret <= 0) { + sprintf(msg, "No ISO 9660 image at LBA %d. Creating blank image.", int_num); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "WARNING", 0); + goto create_blank_image; + } + + if(read_opts->displacement != 0 && abs(read_opts->displacement_sign) == 1) { + /* Apply reverse displacement to session start */ + if(read_opts->displacement_sign == -1) { + if(ms_block+ read_opts->displacement < ms_block) { +displacement_rollover:; + sprintf(msg, "Displacement offset leads outside 32 bit range."); + isoburn_msgs_submit(o, 0x00060000, msg, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ms_block+= read_opts->displacement; + } else { + if(ms_block < read_opts->displacement) + goto displacement_rollover; + ms_block-= read_opts->displacement; + } + } + + + /* create the data source */ + ret = iso_read_opts_new(&ropts, 0); + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot create write opts", 0, "FATAL", 0); + goto ex; + } + + /* Important: do not return until iso_read_opts_free() */ + + iso_read_opts_set_start_block(ropts, ms_block); + iso_read_opts_set_no_rockridge(ropts, read_opts->norock); + iso_read_opts_set_no_aaip(ropts, read_opts->noaaip); + if(read_opts->nomd5 == 2) + int_num= 2; + else if(read_opts->nomd5 == 1) + int_num= 1; + else + int_num= 0; + iso_read_opts_set_no_md5(ropts, int_num); + iso_read_opts_set_new_inos(ropts, read_opts->noino); + + iso_read_opts_set_no_joliet(ropts, read_opts->nojoliet); + iso_read_opts_set_no_iso1999(ropts, read_opts->noiso1999); + iso_read_opts_set_preferjoliet(ropts, read_opts->preferjoliet); + iso_read_opts_set_default_permissions(ropts, + read_opts->mode, read_opts->dirmode); + iso_read_opts_set_default_uid(ropts, read_opts->uid); + iso_read_opts_set_default_gid(ropts, read_opts->gid); + iso_read_opts_set_input_charset(ropts, read_opts->input_charset); + iso_read_opts_auto_input_charset(ropts, read_opts->auto_input_charset); + iso_read_opts_load_system_area(ropts, 1); + + ds = isoburn_data_source_new(d, read_opts->displacement, + read_opts->displacement_sign); + if (ds == NULL) { + isoburn_report_iso_error(ret, "Cannot create IsoDataSource object", 0, + "FATAL", 0); + goto ex; + } + if(o->iso_data_source!=NULL) + iso_data_source_unref(o->iso_data_source); + o->iso_data_source= ds; + iso_image_attach_data(o->image, o->read_pacifier_handle, + isoburn_idle_free_function); + if(o->read_pacifier_handle==NULL) + iso_tree_set_report_callback(o->image, NULL); + else + iso_tree_set_report_callback(o->image, o->read_pacifier); + ret = iso_image_import(o->image, ds, ropts, &features); + iso_tree_set_report_callback(o->image, NULL); + iso_read_opts_free(ropts); + + if (ret < 0) { + isoburn_report_iso_error(ret, "Cannot import image", 0, "FAILURE", 0); + goto ex; + } + /* Important: do not return until free(features) */ + if (image!=NULL) { + *image = o->image; + iso_image_ref(*image); /*protects object from premature free*/ + } + read_opts->hasRR = iso_read_image_features_has_rockridge(features); + read_opts->hasJoliet = iso_read_image_features_has_joliet(features); + read_opts->hasIso1999 = iso_read_image_features_has_iso1999(features); + read_opts->hasElTorito = iso_read_image_features_has_eltorito(features); + read_opts->size = iso_read_image_features_get_size(features); + iso_read_image_features_destroy(features); + ret= 1; +ex:; + if(msg != NULL) + free(msg); + return(ret); +} + + +/* API function. See libisoburn.h +*/ +int isoburn_attach_image(struct burn_drive *d, IsoImage *image) +{ + int ret; + struct isoburn *o; + + ret = isoburn_find_emulator(&o, d, 0); + if (ret < 0 || o == NULL) + return 0; + if (image == NULL) { + isoburn_msgs_submit(o, 0x00060000, + "Program error: isoburn_attach_image: image==NULL", + 0, "FATAL", 0); + return -1; + } + if(o->image != NULL) + iso_image_unref(o->image); + o->image = image; + return(1); +} + + +/* API function. See libisoburn.h +*/ +int isoburn_activate_session(struct burn_drive *drive) +{ + int ret; + struct isoburn *o; + + ret = isoburn_find_emulator(&o, drive, 0); + if (ret < 0) + return -1; + + if (o->emulation_mode != 1) + return 1; /* don't need to activate session */ + if (o->fabricated_msc2 >= 0) + return 1; /* blind growing: do not alter anything outside the session */ + + if (!(o->fabricated_disc_status == BURN_DISC_APPENDABLE || + (o->fabricated_disc_status == BURN_DISC_BLANK && + o->zero_nwa > 0))) + return 1; + + ret = burn_random_access_write(drive, (off_t) 0, (char*)o->target_iso_head, + o->target_iso_head_size, 1); + + return ret; +} + + +/** API @since 0.6.2 +*/ +int isoburn_get_img_partition_offset(struct burn_drive *drive, + uint32_t *block_offset_2k) +{ + int ret; + struct isoburn *o; + + ret = isoburn_find_emulator(&o, drive, 0); + if(ret < 0 || o == NULL) + return -1; + *block_offset_2k= o->loaded_partition_offset; + if(o->loaded_partition_offset == 0) + return(0); + if(o->target_iso_head_size == (off_t) Libisoburn_target_head_sizE + + (off_t) 2048 * (off_t) o->loaded_partition_offset) + return(1); + return(2); +} + + +/* Check for MBR signature and a first partition that starts at a 2k block + and ends where the image ends. + If not too large or too small, accept its start as partition offset. +*/ +static int isoburn_inspect_partition(struct isoburn *o, uint32_t img_size, + int flag) +{ + uint8_t *mbr, *part, *buf= NULL; + uint32_t offst, numsec; + struct ecma119_pri_vol_desc *pvm; + off_t data_count; + int ret; + char *msg= NULL; + static int max_offst= 512 - 32; + + buf= (uint8_t *) calloc(1, 2048); + msg= calloc(1, 160); + if(buf == NULL || msg == NULL) + {ret= -1; goto ex;} + + mbr= o->target_iso_head; + part= mbr + 446; + if(mbr[510] != 0x55 || mbr[511] != 0xAA) + {ret= 2; goto ex;} /* not an MBR */ + + /* Does the first partition entry look credible ? */ + if(part[0] != 0x80 && part[0] != 0x00) + {ret= 2; goto ex;} /* Invalid partition status */ + if(part[1] == 0 && part[2] == 0 && part[3] == 0) + {ret= 2; goto ex;} /* Zero C/H/S start address */ + + /* Does it match the normal ISO image ? */ + offst= iso_read_lsb(part + 8, 4); + numsec= iso_read_lsb(part + 12, 4); + if(offst < 64) + {ret= 2; goto ex;} /* Zero or unusably small partition start */ + if((offst % 4) || (numsec % 4)) + {ret= 2; goto ex;} /* Not aligned to 2k */ + if(numsec < 72) + {ret= 2; goto ex;} /* No room for volume descriptors */ + offst/= 4; + numsec/= 4; + if(offst + numsec != img_size) + {ret= 2; goto ex;} /* Partition end does not match image end */ + + /* Is there a PVD at the partition start ? */ + ret = burn_read_data(o->drive, (off_t) (offst + 16) * (off_t) 2048, + (char*) buf, 2048, &data_count, 2); + if(ret <= 0) + {ret= 2; goto ex;} + pvm = (struct ecma119_pri_vol_desc *) buf; + if (strncmp((char*) pvm->std_identifier, "CD001", 5) != 0) + {ret= 2; goto ex;} /* not a PVD */ + if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1 + || pvm->file_structure_version[0] != 1 ) + {ret= 2; goto ex;} /* failed sanity check */ + + if(iso_read_lsb(pvm->vol_space_size, 4) + offst != img_size) + {ret= 2; goto ex;} /* Image ends do not match */ + + /* Now it is credible. Not yet clear is whether it is acceptable. */ + o->loaded_partition_offset= offst; + + /* If the partition start is too large: Report but do not accept. */ + if(offst > (uint32_t) max_offst) {/* Not more than 1 MB of .target_iso_head */ + sprintf(msg, + "Detected partition offset of %.f blocks. Maximum for load buffer is %d", + (double) offst, max_offst); + isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "WARNING", 0); + {ret= 3; goto ex;} + } + + /* Accept partition start and adjust buffer size */ + ret= isoburn_adjust_target_iso_head(o, offst, 0); + if(ret <= 0) + goto ex; + + ret= 1; +ex:; + if(buf != NULL) + free(buf); + if(msg != NULL) + free(msg); + return(ret); +} + + +/** Initialize the emulation of multi-session on random access media. + The need for emulation is confirmed already. + @param o A freshly created isoburn object. isoburn_create_data_source() was + already called, nevertheless. + @param flag bit0= read-only + @return <=0 error , 1 = success +*/ +int isoburn_start_emulation(struct isoburn *o, int flag) +{ + int ret, i, capacity = -1, role, dummy; + off_t data_count, to_read; + struct burn_drive *drive; + struct ecma119_pri_vol_desc *pvm; + enum burn_disc_status s; + char *path= NULL, *msg= NULL; + + path= calloc(1, BURN_DRIVE_ADR_LEN); + msg= calloc(1, 2 * BURN_DRIVE_ADR_LEN); + if(path == NULL || msg == NULL) + {ret= -1; goto ex;} + + if(o==NULL) { + isoburn_msgs_submit(NULL, 0x00060000, + "Program error: isoburn_start_emulation: o==NULL", + 0, "FATAL", 0); + {ret= -1; goto ex;} + } + + drive= o->drive; + + if(flag & 1) + o->fabricated_disc_status= BURN_DISC_FULL; + + /* We can assume 0 as start block for image. + The data there point to the most recent session. + */ + role = burn_drive_get_drive_role(drive); + ret = burn_get_read_capacity(drive, &capacity, 0); + if (ret <= 0) + capacity = -1; + if (role == 5) { /* random access write-only medium */ + s = burn_disc_get_status(drive); + o->fabricated_disc_status= s; + burn_disc_track_lba_nwa(drive, NULL, 0, &dummy, &(o->nwa)); + if(o->nwa < o->zero_nwa) + o->zero_nwa= 0; + {ret= 1; goto ex;} + } else if (capacity > 0 || role == 2 || role == 4) { + /* Might be a block device on a system where libburn cannot determine its + size. Try to read anyway. */ + to_read = o->target_iso_head_size; + memset(o->target_iso_head, 0, to_read); + if(capacity > 0 && (off_t) capacity * (off_t) 2048 < to_read) + to_read = (off_t) capacity * (off_t) 2048; + ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head, + to_read, &data_count, 2 | 8); + if (ret <= 0) { + /* an error means a disc with no ISO image */ + o->media_read_error= 1; + if (ret == -2) { + path[0]= 0; + burn_drive_d_get_adr(drive, path); + sprintf(msg, "Pseudo drive '%s' does not allow reading", path); + isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "NOTE", 0); + o->fabricated_disc_status= BURN_DISC_BLANK; + } else if (capacity > 0) + o->fabricated_disc_status= BURN_DISC_FULL; + else if(!(flag & 1)) + o->fabricated_disc_status= BURN_DISC_BLANK; + {ret= 1; goto ex;} + } + } else { + /* No read capacity means blank medium */ + if(!(flag & 1)) + o->fabricated_disc_status= BURN_DISC_BLANK; + {ret= 1; goto ex;} + } + + /* check first 64K. If 0's, the disc is treated as a blank disc, and thus + overwritten without extra check. */ + i = Libisoburn_target_head_sizE; + while (i && !o->target_iso_head[i-1]) + --i; + + if (!i) { + if(!(flag & 1)) + o->fabricated_disc_status= BURN_DISC_BLANK; + {ret= 1; goto ex;} + } + + pvm = (struct ecma119_pri_vol_desc *)(o->target_iso_head + 16 * 2048); + + if (strncmp((char*)pvm->std_identifier, "CD001", 5) == 0) { + off_t size; + + /* sanity check */ + if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1 + || pvm->file_structure_version[0] != 1 ) { + /* TODO for now I treat this as a full disc */ + o->fabricated_disc_status= BURN_DISC_FULL; + {ret= 1; goto ex;} + } + + /* ok, PVM found, set size */ + size = (off_t) iso_read_lsb(pvm->vol_space_size, 4); + ret= isoburn_inspect_partition(o, (uint32_t) size, 0); + if (ret <= 0) + goto ex; + size *= (off_t) 2048; /* block size in bytes */ + isoburn_set_start_byte(o, size, 0); + if(!(flag & 1)) + o->fabricated_disc_status= BURN_DISC_APPENDABLE; + } else if (strncmp((char*)pvm->std_identifier, "CDXX1", 5) == 0 || + (strncmp((char*)pvm->std_identifier, "CDxx1", 5) == 0 && + pvm->vol_desc_type[0] == 'x')) { + + /* empty image */ + isoburn_set_start_byte(o, o->zero_nwa * 2048, 0); + if(!(flag & 1)) + o->fabricated_disc_status= BURN_DISC_BLANK; + } else { + /* treat any disc in an unknown format as full */ + o->fabricated_disc_status= BURN_DISC_FULL; + } + + ret= 1; +ex:; + if(path != NULL) + free(path); + if(msg != NULL) + free(msg); + return(ret); +} + + +/** Alters and writes the first 64 kB of a "medium" to invalidate + an ISO image. (It shall stay restorable by skilled humans, though). + The result shall especially keep libisoburn from accepting the medium + image as ISO filesystem. + @param o A fully activated isoburn object. isoburn_start_emulation() + was already called. + @return <=0 error , 1 = success +*/ +int isoburn_invalidate_iso(struct isoburn *o, int flag) +{ + /* + * replace CD001 with CDXX1 in PVM. + * I think this is enought for invalidating an iso image + */ + strncpy((char*)o->target_iso_head + 16 * 2048 + 1, "CDXX1", 5); + return isoburn_activate_session(o->drive); +} + + +/* API @since 0.1.0 */ +int isoburn_set_read_pacifier(struct burn_drive *drive, + int (*read_pacifier)(IsoImage*, IsoFileSource*), + void *read_handle) +{ + int ret; + struct isoburn *o; + + ret = isoburn_find_emulator(&o, drive, 0); + if(ret < 0 || o == NULL) + return -1; + o->read_pacifier_handle= read_handle; + o->read_pacifier= read_pacifier; + return(1); +} + diff --git a/libisoburn/branches/1.1.8/libisoburn/libisoburn.h b/libisoburn/branches/1.1.8/libisoburn/libisoburn.h new file mode 100644 index 00000000..2a2281da --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/libisoburn.h @@ -0,0 +1,2007 @@ + +/* + Lower level API definition of libisoburn. + + Copyright 2007-2011 Vreixo Formoso Lopes + and Thomas Schmitt + Provided under GPL version 2 or later. +*/ + +/** Overview + +libisoburn is a frontend for libraries libburn and libisofs which enables +creation and expansion of ISO-9660 filesystems on all CD/DVD/BD media supported +by libburn. This includes media like DVD+RW, which do not support multi-session +management on media level and even plain disk files or block devices. + +The price for that is thorough specialization on data files in ISO-9660 +filesystem images. So libisoburn is not suitable for audio (CD-DA) or any +other CD layout which does not entirely consist of ISO-9660 sessions. + +Note that there is a higher level of API: xorriso.h. One should not mix it +with the API calls of libisoburn.h, libisofs.h, and libburn.h. + + + Connector functions + +libisofs and libburn do not depend on each other but share some interfaces +by which they can cooperate. +libisoburn establishes the connection between both modules by creating the +necessary interface objects and attaching them to the right places. + + + Wrapper functions + +The priciple of this frontend is that you may use any call of libisofs or +libburn unless it has a isoburn_*() wrapper listed in the following function +documentation. + +E.g. call isoburn_initialize() rather than iso_init(); burn_initialize(); +and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab(). +But you may call burn_disc_get_profile() directly if you want to display +the media type. + +The wrappers will transparently provide the necessary emulations which +are appropriate for particular target drives and media states. +To learn about them you have to read both API descriptions: the one of +the wrapper and the one of the underlying libburn or libisofs call. + +Macros BURN_* and functions burn_*() are documented in +Macros ISO_* and functions iso_*() are documented in + + + Usage model + +There may be an input drive and an output drive. Either of them may be missing +with the consequence that no reading resp. writing is possible. +Both drive roles can be fulfilled by the same drive. + +Input can be a random access readable libburn drive: + optical media, regular files, block devices. +Output can be any writeable libburn drive: + writeable optical media in burner, writeable file objects (no directories). + +libburn demands rw-permissions to drive device file resp. file object. + +If the input drive provides a suitable ISO RockRidge image, then its tree +may be loaded into memory and can then be manipulated by libisofs API calls. +The loading is done by isoburn_read_image() under control of +struct isoburn_read_opts which the application obtains from libisoburn +and manipulates by the family of isoburn_ropt_set_*() functions. + +Writing of result images is controlled by libisofs related parameters +in a struct isoburn_imgen_opts which the application obtains from libisoburn +and manipulates by the family of isoburn_igopt_set_*() functions. + +All multi-session aspects are handled by libisoburn according to these +settings. The application does not have to analyze media state and write +job parameters. It rather states its desires which libisoburn tries to +fulfill, or else will refuse to start the write run. + + + Setup for Growing, Modifying or Blind Growing + +The connector function family offers alternative API calls for performing +the setup for several alternative image generation strategies. + +Growing: +If input and output drive are the same, then isoburn_prepare_disc() is to +be used. It will lead to an add-on session on appendable or overwriteable +media with existing ISO image. With blank media it will produce a first +session. + +Modifying: +If the output drive is not the input drive, and if it bears blank media +or overwriteable without a valid ISO image, then one may produce a consolidated +image with old and new data. This will copy file data from an eventual input +drive with valid image, add any newly introduced data from the local +filesystem, and produce a first session on output media. +To prepare for such an image generation run, use isoburn_prepare_new_image(). + +Blind Growing: +This method reads the old image from one drive and writes the add-on session +to a different drive. That output drive is nevertheless supposed to +finally lead to the same medium from where the session was loaded. Usually it +will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program +like with this classic gesture: + mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev +Blind growing is prepared by the call isoburn_prepare_blind_grow(). +The input drive should be released immediately after this call in order +to allow the consumer of the output stream to access that drive for writing. + +After either of these setups, some peripheral libburn drive parameter settings +like burn_write_opts_set_simulate(), burn_write_opts_set_multi(), + burn_drive_set_speed(), burn_write_opts_set_underrun_proof() should be made. +Do not set the write mode. It will be chosen by libisoburn so it matches job +and media state. + + Writing the image + +Then one may start image generation and write threads by isoburn_disc_write(). +Progress may be watched at the output drive by burn_drive_get_status() and +isoburn_get_fifo_status(). + +At some time, the output drive will be BURN_DRIVE_IDLE indicating that +writing has ended. +One should inquire isoburn_drive_wrote_well() to learn about overall success. + +Finally one must call isoburn_activate_session() which will complete any +eventual multi-session emulation. + + + Application Constraints + +Applications shall include libisofs/libisofs.h , libburn/libburn.h and this +file itself: libisoburn/libisoburn.h . +They shall link with -lisofs -lburn -lisoburn or with the .o files emerging +from building those libraries from their sources. + +Applications must use 64 bit off_t. +E.g. on 32-bit GNU/Linux by defining + #define _LARGEFILE_SOURCE + #define _FILE_OFFSET_BITS 64 +The minimum requirement is to interface with the library by 64 bit signed +integers where libisofs.h or libisoburn.h prescribe off_t. +Failure to do so may result in surprising malfunction or memory faults. + +Application files which include libisofs/libisofs.h or libisoburn/libisoburn.h +must provide definitions for uint32_t and uint8_t. +This can be achieved either: +- by using autotools which will define HAVE_STDINT_H or HAVE_INTTYPES_H + according to its ./configure tests, +- or by defining the macros HAVE_STDINT_H resp. HAVE_INTTYPES_H according + to the local situation, +- or by appropriately defining uint32_t and uint8_t by other means, + e.g. by including inttypes.h before including libisofs.h and libisoburn.h + +*/ +#ifdef HAVE_STDINT_H +#include +#else +#ifdef HAVE_INTTYPES_H +#include +#endif +#endif + + +/* Important: If you add a public API function then add its name to file + libisoburn/libisoburn.ver +*/ + + + /* API functions */ + + +/** Initialize libisoburn, libisofs and libburn. + Wrapper for : iso_init() and burn_initialize() + @since 0.1.0 + @param msg A character array for eventual messages (e.g. with errors) + @param flag Bitfield for control purposes (unused yet, submit 0) + @return 1 indicates success, 0 is failure +*/ +int isoburn_initialize(char msg[1024], int flag); + + +/** Check whether all features of header file libisoburn.h from the given + major.minor.micro revision triple can be delivered by the library version + which is performing this call. + An application of libisoburn can easily memorize the version of the + libisoburn.h header in its own code. Immediately after isoburn_initialize() + it should simply do this check: + if (! isoburn_is_compatible(isoburn_header_version_major, + isoburn_header_version_minor, + isoburn_header_version_micro, 0)) + ...refuse to start the program with this dynamic library version... + @since 0.1.0 + @param major obtained at build time + @param minor obtained at build time + @param micro obtained at build time + @param flag Bitfield for control purposes. Unused yet. Submit 0. + @return 1= library can work for caller + 0= library is not usable in some aspects. Caller must restrict + itself to an earlier API version or must not use this libray + at all. +*/ +int isoburn_is_compatible(int major, int minor, int micro, int flag); + + +/** Obtain the three release version numbers of the library. These are the + numbers encountered by the application when linking with libisoburn, + i.e. possibly not before run time. + Better do not base the fundamental compatibility decision of an application + on these numbers. For a reliable check use isoburn_is_compatible(). + @since 0.1.0 + @param major The maturity version (0 for now, as we are still learning) + @param minor The development goal version. + @param micro The development step version. This has an additional meaning: + + Pare numbers indicate a version with frozen API. I.e. you can + rely on the same set of features to be present in all + published releases with that major.minor.micro combination. + Features of a pare release will stay available and ABI + compatible as long as the SONAME of libisoburn stays "1". + Currently there are no plans to ever change the SONAME. + + Odd numbers indicate that API upgrades are in progress. + I.e. new features might be already present or they might + be still missing. Newly introduced features may be changed + incompatibly or even be revoked before release of a pare + version. + So micro revisions {1,3,5,7,9} should never be used for + dynamic linking unless the proper library match can be + guaranteed by external circumstances. + + @return 1 success, <=0 might in future become an error indication +*/ +void isoburn_version(int *major, int *minor, int *micro); + + +/** The minimum version of libisofs to be used with this version of libisoburn + at compile time. + @since 0.1.0 +*/ +#define isoburn_libisofs_req_major 1 +#define isoburn_libisofs_req_minor 1 +#define isoburn_libisofs_req_micro 6 + +/** The minimum version of libburn to be used with this version of libisoburn + at compile time. + @since 0.1.0 +*/ +#define isoburn_libburn_req_major 1 +#define isoburn_libburn_req_minor 1 +#define isoburn_libburn_req_micro 7 + +/** The minimum compile time requirements of libisoburn towards libjte are + the same as of a suitable libisofs towards libjte. + So use these macros from libisofs.h : + iso_libjte_req_major + iso_libjte_req_minor + iso_libjte_req_micro + @since 0.6.4 +*/ + +/** The minimum version of libisofs to be used with this version of libisoburn + at runtime. This is checked already in isoburn_initialize() which will + refuse on outdated version. So this call is for information purposes after + successful startup only. + @since 0.1.0 + @param major isoburn_libisofs_req_major as seen at build time + @param minor as seen at build time + @param micro as seen at build time + @return 1 success, <=0 might in future become an error indication +*/ +int isoburn_libisofs_req(int *major, int *minor, int *micro); + + +/** The minimum version of libjte to be used with this version of libisoburn + at runtime. The use of libjte is optional and depends on configure + tests. It can be prevented by ./configure option --disable-libjte . + This is checked already in isoburn_initialize() which will refuse on + outdated version. So this call is for information purposes after + successful startup only. + @since 0.6.4 +*/ +int isoburn_libjte_req(int *major, int *minor, int *micro); + + +/** The minimum version of libburn to be used with this version of libisoburn + at runtime. This is checked already in isoburn_initialize() which will + refuse on outdated version. So this call is for information purposes after + successful startup only. + @since 0.1.0 + @param major isoburn_libburn_req_major as seen at build time + @param minor as seen at build time + @param micro as seen at build time + @return 1 success, <=0 might in future become an error indication +*/ +int isoburn_libburn_req(int *major, int *minor, int *micro); + + +/** These three release version numbers tell the revision of this header file + and of the API it describes. They are memorized by applications at build + time. + @since 0.1.0 +*/ +#define isoburn_header_version_major 1 +#define isoburn_header_version_minor 1 +#define isoburn_header_version_micro 7 +/** Note: + Above version numbers are also recorded in configure.ac because libtool + wants them as parameters at build time. + For the library compatibility check, ISOBURN_*_VERSION in configure.ac + are not decisive. Only the three numbers here do matter. +*/ +/** Usage discussion: + +Some developers of the libburnia project have differing +opinions how to ensure the compatibility of libaries +and applications. + +It is about whether to use at compile time and at runtime +the version numbers isoburn_header_version_* provided here. +Thomas Schmitt advises to use them. +Vreixo Formoso advises to use other means. + +At compile time: + +Vreixo Formoso advises to leave proper version matching +to properly programmed checks in the the application's +build system, which will eventually refuse compilation. + +Thomas Schmitt advises to use the macros defined here +for comparison with the application's requirements of +library revisions and to eventually break compilation. + +Both advises are combinable. I.e. be master of your +build system and have #if checks in the source code +of your application, nevertheless. + +At runtime (via *_is_compatible()): + +Vreixo Formoso advises to compare the application's +requirements of library revisions with the runtime +library. This is to allow runtime libraries which are +young enough for the application but too old for +the lib*.h files seen at compile time. + +Thomas Schmitt advises to compare the header +revisions defined here with the runtime library. +This is to enforce a strictly monotonous chain +of revisions from app to header to library, +at the cost of excluding some older libraries. + +These two advises are mutually exclusive. + +----------------------------------------------------- + +For an implementation of the Thomas Schmitt approach, +see libisoburn/burn_wrap.c : isoburn_initialize() +This connects libisoburn as "application" with libisofs +as "library". + +The compatible part of Vreixo Formoso's approach is implemented +in configure.ac LIBBURN_REQUIRED, LIBISOFS_REQUIRED. +In isoburn_initialize() it would rather test by + iso_lib_is_compatible(isoburn_libisofs_req_major,... +than by + iso_lib_is_compatible(iso_lib_header_version_major,... +and would leave out the ugly compile time traps. + +*/ + + +/** Announce to the library an application provided method for immediate + delivery of messages. It is used when no drive is affected directly or + if the drive has no own msgs_submit() method attached by + isoburn_drive_set_msgs_submit. + If no method is preset or if the method is set to NULL then libisoburn + delivers its messages through the message queue of libburn. + @param msgs_submit The function call which implements the method + @param submit_handle Handle to be used as first argument of msgs_submit + @param submit_flag Flag to be used as last argument of msgs_submit + @param flag Unused yet, submit 0 + @since 0.2.0 +*/ +int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code, + char msg_text[], int os_errno, + char severity[], int flag), + void *submit_handle, int submit_flag, int flag); + + +/** Aquire a target drive by its filesystem path resp. libburn persistent + address. + Wrapper for: burn_drive_scan_and_grab() + @since 0.1.0 + @param drive_infos On success returns a one element array with the drive + (cdrom/burner). Thus use with driveno 0 only. On failure + the array has no valid elements at all. + The returned array should be freed via burn_drive_info_free() + when the drive is no longer needed. But before this is done + one has to call isoburn_drive_release(drive_infos[0].drive). + @param adr The persistent address of the desired drive. + @param load 1 attempt to load the disc tray. 0 no attempt,rather failure. + @return 1 = success , 0 = drive not found , <0 = other error +*/ +int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], + char* adr, int load); + + +/** Aquire a target drive by its filesystem path resp. libburn persistent + address. This is a modern successor of isoburn_drive_scan_and_grab(). + Wrapper for: burn_drive_scan_and_grab() + @since 0.1.2 + @param drive_infos On success returns a one element array with the drive + (cdrom/burner). Thus use with driveno 0 only. On failure + the array has no valid elements at all. + The returned array should be freed via burn_drive_info_free() + when the drive is no longer needed. But before this is done + one has to call isoburn_drive_release(drive_infos[0].drive). + @param adr The persistent address of the desired drive. + @param flag bit0= attempt to load the disc tray. + Else: failure if not loaded. + bit1= regard overwriteable media as blank + bit2= if the drive is a regular disk file: + truncate it to the write start address when writing + begins + bit3= if the drive reports a read-only profile try to read + table of content by scanning for ISO image headers. + (depending on media type and drive this might + help or it might make the resulting toc even worse) + bit4= do not emulate table of content on overwriteable media + bit5= ignore ACL from external filesystems + bit6= ignore POSIX Extended Attributes from external + filesystems + bit7= pretend read-only profile and scan for table of content + bit8= re-assess already aquired (*drive_infos)[0] rather + than aquiring adr + @since 1.1.8 + @return 1 = success , 0 = drive not found , <0 = other error +*/ +int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], + char* adr, int flag); + +/** Aquire a drive from the burn_drive_info[] array which was obtained by + a previous call of burn_drive_scan(). + Wrapper for: burn_drive_grab() + @since 0.1.0 + @param drive The drive to grab. E.g. drive_infos[1].drive . + Call isoburn_drive_release(drive) when it it no longer needed. + @param load 1 attempt to load the disc tray. 0 no attempt, rather failure. + @return 1 success, <=0 failure +*/ +int isoburn_drive_grab(struct burn_drive *drive, int load); + + +/** Attach to a drive an application provided method for immediate + delivery of messages. + If no method is set or if the method is set to NULL then libisoburn + delivers messages of the drive through the global msgs_submit() method + set by isoburn_set_msgs_submiti() or by the message queue of libburn. + @since 0.2.0 + @param d The drive to which this function, handle and flag shall apply + @param msgs_submit The function call which implements the method + @param submit_handle Handle to be used as first argument of msgs_submit + @param submit_flag Flag to be used as last argument of msgs_submit + @param flag Unused yet, submit 0 +*/ +int isoburn_drive_set_msgs_submit(struct burn_drive *d, + int (*msgs_submit)(void *handle, int error_code, + char msg_text[], int os_errno, + char severity[], int flag), + void *submit_handle, int submit_flag, int flag); + + +/** Inquire the medium status. Expect the whole spectrum of libburn BURN_DISC_* + with multi-session media. Emulated states with random access media are + BURN_DISC_BLANK and BURN_DISC_APPENDABLE. + Wrapper for: burn_disc_get_status() + @since 0.1.0 + @param drive The drive to inquire. + @return The status of the drive, or what kind of disc is in it. + Note: BURN_DISC_UNGRABBED indicates wrong API usage +*/ +#ifdef __cplusplus +enum burn::burn_disc_status isoburn_disc_get_status(struct burn_drive *drive); +#else +enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive); +#endif + + +/** Tells whether the medium can be treated by isoburn_disc_erase(). + Wrapper for: burn_disc_erasable() + @since 0.1.0 + @param d The drive to inquire. + @return 0=not erasable , else erasable +*/ +int isoburn_disc_erasable(struct burn_drive *d); + + +/** Mark the medium as blank. With multi-session media this will call + burn_disc_erase(). With random access media, an eventual ISO-9660 + filesystem will get invalidated by altering its start blocks on the medium. + In case of success, the medium is in status BURN_DISC_BLANK afterwards. + Wrapper for: burn_disc_erase() + @since 0.1.0 + @param drive The drive with the medium to erase. + @param fast 1=fast erase, 0=thorough erase + With DVD-RW, fast erase yields media incapable of multi-session. +*/ +void isoburn_disc_erase(struct burn_drive *drive, int fast); + + +/** Set up isoburn_disc_get_msc1() to return a fabricated value. + This makes only sense between aquiring the drive and reading the + image. After isoburn_read_image() it will confuse the coordination + of libisoburn and libisofs. + Note: Sessions and tracks are counted beginning with 1, not with 0. + @since 0.1.6 + @param d The drive where msc1 is to be set + @param adr_mode Determines how to interpret adr_value and to set msc1. + If adr_value shall represent a number then decimal ASCII + digits are expected. + 0= start lba of last session in TOC, ignore adr_value + 1= start lba of session number given by adr_value + 2= start lba of track given number by adr_value + 3= adr_value itself is the lba to be used + 4= start lba of last session with volume id + given by adr_value + @param adr_value A string describing the value to be eventually used. + @param flag Bitfield for control purposes. + bit0= @since 0.2.2 + with adr_mode 3: adr_value might be 16 blocks too high + (e.g. -C stemming from growisofs). Probe for ISO head + at adr_value-16 and eventually adjust setting. + bit1= insist in seeing a disc object with at least one session + bit2= with adr_mode 4: use adr_value as regular expression +*/ +int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, + int flag); + + +/* ----------------------------------------------------------------------- */ +/* + + Wrappers for emulation of TOC on overwriteable media + + Media which match the overwriteable usage model lack of a history of sessions + and tracks. libburn will not even hand out a burn_disc object for them and + always declare them blank. libisoburn checks for a valid ISO filesystem + header at LBA 0 and eventually declares them appendable. + Nevertheless one can only determine an upper limit of the size of the overall + image (by isoburn_get_min_start_byte()) but not a list of stored sessions + and their LBAs, as it is possible with true multi-session media. + + The following wrappers add the capability to obtain a session and track TOC + from emulated multi-session images on overwriteables if the first session + was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32). + + Be aware that the structs emitted by these isoburn calls are not compatible + with the libburn structs. I.e. you may use them only with isoburn_toc_* + calls. + isoburn_toc_disc needs to be freed after use. isoburn_toc_session and + isoburn_toc_track vanish together with their isoburn_toc_disc. +*/ + +/* Opaque handles to media, session, track */ +struct isoburn_toc_disc; +struct isoburn_toc_session; +struct isoburn_toc_track; + + +/** Obtain a master handle for the table of content. + This handle governs allocated resources which have to be released by + isoburn_toc_disc_free() when no longer needed. + Wrapper for: burn_drive_get_disc() + @since 0.1.6 + @param d The drive with the medium to inspect + @return NULL in case there is no content info, else it is a valid handle +*/ +struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d); + + +/** Tell the number of 2048 byte blocks covered by the table of content. + This number includes the eventual gaps between sessions and tracks. + So this call is not really a wrapper for burn_disc_get_sectors(). + @since 0.1.6 + @param disc The master handle of the medium + @return Number of blocks, <=0 indicates unknown or unreadable state +*/ +int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc); + + +/** Get the array of session handles from the table of content. + Wrapper for: burn_disc_get_sessions() + @since 0.1.6 + @param disc The master handle of the medium + @param num returns the number of sessions in the array + @return the address of the array of session handles +*/ +struct isoburn_toc_session **isoburn_toc_disc_get_sessions( + struct isoburn_toc_disc *disc, int *num); + + +/** Tell the number of 2048 byte blocks covered by a particular session. + Wrapper for: burn_session_get_sectors() + @since 0.1.6 + @param s The session handle + @return number of blocks, <=0 indicates unknown or unreadable state +*/ +int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s); + + +/** Obtain a copy of the entry which describes the end of a particular session. + Wrapper for: burn_session_get_leadout_entry() + @since 0.1.6 + @param s The session handle + @param entry A pointer to memory provided by the caller. It will be filled + with info according to struct burn_toc_entry as defined + in libburn.h +*/ +void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s, + struct burn_toc_entry *entry); + + +/** Get the array of track handles from a particular session. + Wrapper for: burn_session_get_tracks() + @since 0.1.6 + @param s The session handle + @param num returns the number of tracks in the array + @return the address of the array of track handles, + NULL if no tracks are registered with session s +*/ +struct isoburn_toc_track **isoburn_toc_session_get_tracks( + struct isoburn_toc_session *s, int *num); + + +/** Obtain a copy of the entry which describes a particular track. + Wrapper for: burn_track_get_entry() + @since 0.1.6 + @param t The track handle + @param entry A pointer to memory provided by the caller. It will be filled + with info according to struct burn_toc_entry as defined + in libburn.h +*/ +void isoburn_toc_track_get_entry(struct isoburn_toc_track *t, + struct burn_toc_entry *entry); + + +/** Obtain eventual ISO image parameters of an emulated track. This info was + gained with much effort and thus gets cached in the track object. + If this call returns 1 then one can save a call of isoburn_read_iso_head() + with return mode 1 which could cause an expensive read operation. + @since 0.4.0 + @param t The track handle + @param start_lba Returns the start address of the ISO session + @param image_blocks Returns the number of 2048 bytes blocks + @param volid Caller provided memory for the volume id + @param flag unused yet, submit 0 + @return 0= not an emulated ISO session , 1= reply is valid +*/ +int isoburn_toc_track_get_emul(struct isoburn_toc_track *t, int *start_lba, + int *image_blocks, char volid[33], int flag); + + + +/** Release the memory associated with a master handle of a medium. + The handle is invalid afterwards and may not be used any more. + Wrapper for: burn_disc_free() + @since 0.1.6 + @param disc The master handle of the medium +*/ +void isoburn_toc_disc_free(struct isoburn_toc_disc *disc); + + +/** Try whether the data at the given address look like a ISO 9660 + image header and obtain its alleged size. Depending on the info mode + one other string of text information can be retrieved too. + @since 0.1.6 + @param d The drive with the medium to inspect + @param lba The block number from where to read + @param image_blocks Returns the number of 2048 bytes blocks in the session + @param info Caller provided memory, enough to take eventual info reply + @param flag bit0-7: info return mode + 0= do not return anything in info (do not even touch it) + 1= copy volume id to info (info needs 33 bytes) + 2= @since 0.2.2 : + copy 64 kB header to info (needs 65536 bytes) + bit13= @since 0.2.2: + do not read head from medium but use first 64 kB from + info + bit14= check both half buffers (not only second) + return 2 if found in first block + bit15= return -1 on read error + @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error +*/ +int isoburn_read_iso_head(struct burn_drive *d, int lba, + int *image_blocks, char *info, int flag); + + +/** Try to convert the given entity address into various entity addresses + which would describe it. + Note: Sessions and tracks are counted beginning with 1, not with 0. + @since 0.3.2 + @param d The drive where msc1 is to be set + @param adr_mode Determines how to interpret the input adr_value. + If adr_value shall represent a number then decimal ASCII + digits are expected. + 0= start lba of last session in TOC, ignore adr_value + 1= start lba of session number given by adr_value + 2= start lba of track given number by adr_value + 3= adr_value itself is the lba to be used + 4= start lba of last session with volume id + given by adr_value + @param adr_value A string describing the value to be eventually used. + @param lba returns the block address of the entity, -1 means invalid + @param track returns the track number of the entity, -1 means invalid + @param session returns the session number of the entity, -1 means invalid + @param volid returns the volume id of the entity if it is a ISO session + @param flag Bitfield for control purposes. + bit2= with adr_mode 4: use adr_value as regular expression + @return <=0 error , 1 ok, ISO session, 2 ok, not an ISO session +*/ +int isoburn_get_mount_params(struct burn_drive *d, + int adr_mode, char *adr_value, + int *lba, int *track, int *session, + char volid[33], int flag); + + +/* ----------------------------------------------------------------------- */ +/* + + Options for image reading. + + An application shall create an option set object by isoburn_ropt_new(), + program it by isoburn_ropt_set_*(), use it with isoburn_read_image(), + and finally delete it by isoburn_ropt_destroy(). + +*/ +/* ----------------------------------------------------------------------- */ + +struct isoburn_read_opts; + +/** Produces a set of image read options, initialized with default values. + @since 0.1.0 + @param o the newly created option set object + @param flag Bitfield for control purposes. Submit 0 for now. + @return 1=ok , <0 = failure +*/ +int isoburn_ropt_new(struct isoburn_read_opts **o, int flag); + + +/** Deletes an option set which was created by isoburn_ropt_new(). + @since 0.1.0 + @param o The option set to work on + @param flag Bitfield for control purposes. Submit 0 for now. + @return 1= **o destroyed , 0= *o was already NULL (harmless) +*/ +int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag); + + +/** Which existing ISO 9660 extensions in the image to read or not to read. + Whether to read the content of an existing image at all. + The bits can be combined by | resp. inquired by &. + @since 0.1.0 + @param ext Bitfield: + bit0= norock + Do not read Rock Ridge extensions + bit1= nojoliet + Do not read Joliet extensions + bit2= noiso1999 + Do not read ISO 9660:1999 enhanced tree + bit3= preferjoliet + When both Joliet and RR extensions are present, the RR + tree is used. If you prefer using Joliet, set this to 1. + bit4= pretend_blank + Always create empty image.Ignore any image on input drive. + bit5= noaaip + @since 0.3.4 + Do not load AAIP information from image. This information + eventually contains ACL or XFS-style Extended Attributes. + bit6= noacl + @since 0.3.4 + Do not obtain ACL from external filesystem objects (e.g. + local filesystem files). + bit7= noea + @since 0.3.4 + Do not obtain XFS-style Extended Attributes from external + filesystem objects (e.g. local filesystem files). + bit8= noino + @since 0.4.0 + Do not load eventual inode numbers from RRIP entry PX, + but generate a new unique inode number for each imported + IsoNode object. + PX inode numbers allow to mark families of hardlinks by + giving all family members the same inode number. libisofs + keeps the PX inode numbers unaltered when IsoNode objects + get written into an ISO image. + bit9= nomd5 + @since 0.4.2 + Do not load the eventual MD5 checksum array. + Do not check eventual session_md5 tags. + bit10= nomd5tag + @since 1.0.4 + Do not check eventual session_md5 tags although bit9 + is not set. + @return 1 success, <=0 failure +*/ +#define isoburn_ropt_norock 1 +#define isoburn_ropt_nojoliet 2 +#define isoburn_ropt_noiso1999 4 +#define isoburn_ropt_preferjoliet 8 +#define isoburn_ropt_pretend_blank 16 +#define isoburn_ropt_noaaip 32 +#define isoburn_ropt_noacl 64 +#define isoburn_ropt_noea 128 +#define isoburn_ropt_noino 256 +#define isoburn_ropt_nomd5 512 +#define isoburn_ropt_nomd5tag 1024 + +int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext); +int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext); + + +/** Default attributes to use if no RockRidge extension gets loaded. + @since 0.1.0 + @param o The option set to work on + @param uid user id number (see /etc/passwd) + @param gid group id number (see /etc/group) + @param mode permissions (not file type) as of man 2 stat. + With directories, r-permissions will automatically imply + x-permissions. See isoburn_ropt_set_default_dirperms() below. + @return 1 success, <=0 failure +*/ +int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o, + uid_t uid, gid_t gid, mode_t mode); +int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o, + uid_t *uid, gid_t *gid, mode_t *mode); + +/** Default attributes to use on directories if no RockRidge extension + gets loaded. + Above call isoburn_ropt_set_default_perms() automatically adds + x-permissions to r-permissions for directories. This call here may + be done afterwards to set independend permissions for directories, + especially to override the automatically added x-permissions. + @since 0.1.0 + @param o The option set to work on + @param mode permissions (not file type) as of man 2 stat. + @return 1 success, <=0 failure +*/ +int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o, + mode_t mode); +int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o, + mode_t *mode); + + +/** Set the character set for reading RR file names from ISO images. + @since 0.1.0 + @param o The option set to work on + @param input_charset Set this to NULL to use the default locale charset + For selecting a particular character set, submit its + name, e.g. as listed by program iconv -l. + Example: "UTF-8". + @return 1 success, <=0 failure +*/ +int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o, + char *input_charset); +int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o, + char **input_charset); + + +/** + Enable or disable methods to automatically choose an input charset. + This eventually overrides the name set via isoburn_ropt_set_input_charset() + @since 0.3.8 + @param o The option set to work on + @param mode Bitfield for control purposes: + bit0= allow to set the input character set automatically from + attribute "isofs.cs" of root directory. + Submit any other bits with value 0. + @return 1 success, <=0 failure + */ +int isoburn_ropt_set_auto_incharset(struct isoburn_read_opts *o, int mode); +int isoburn_ropt_get_auto_incharset(struct isoburn_read_opts *o, int *mode); + + +/** Control an offset to be applied to all block address pointers in the ISO + image in order to compensate for an eventual displacement of the image + relative to the start block address for which it was produced. + E.g. if track number 2 from CD gets copied into a disk file and shall then + be loaded as ISO filesystem, then the directory tree and all data file + content of the track copy will become readable by setting the track start + address as displacement and -1 as displacement_sign. + Data file content outside the track will of course not be accessible and + eventually produce read errors. + @since 0.6.6 + @param o The option set to work on + @param displacement 0 or a positive number + @param displacement_sign Determines wether to add or subtract displacement + to block addresses before applying them to the + storage object for reading: + +1 = add , -1= subtract , else keep unaltered +*/ +int isoburn_ropt_set_displacement(struct isoburn_read_opts *o, + uint32_t displacement, int displacement_sign); +int isoburn_ropt_get_displacement(struct isoburn_read_opts *o, + uint32_t *displacement, int *displacement_sign); + +/* If you get here because of a compilation error like + + /usr/include/libisoburn/libisoburn.h:895: error: + expected declaration specifiers or '...' before 'uint32_t' + + then see above paragraph "Application Constraints" about the definition + of uint32_t. +*/ + + +/** After calling function isoburn_read_image() there are informations + available in the option set. + This info can be obtained as bits in parameter has_what. Like: + joliet_available = (has_what & isoburn_ropt_has_joliet); + @since 0.1.0 + @param o The option set to work on + @param size Number of image data blocks, 2048 bytes each. + @param has_what Bitfield: + bit0= has_rockridge + RockRidge extension info is available (POSIX filesystem) + bit1= has_joliet + Joliet extension info is available (suitable for MS-Windows) + bit2= has_iso1999 + ISO version 2 Enhanced Volume Descriptor is available. + This is rather exotic. + bit3= has_el_torito + El-Torito boot record is present + @return 1 success, <=0 failure +*/ +#define isoburn_ropt_has_rockridge 1 +#define isoburn_ropt_has_joliet 2 +#define isoburn_ropt_has_iso1999 4 +#define isoburn_ropt_has_el_torito 8 + +int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, + uint32_t *size, int *has_what); + +/* ts A90122 */ +/* >>> to be implemented: +#define isoburn_ropt_has_acl 64 +#define isoburn_ropt_has_ea 128 +*/ + + + +/* ----------------------------------------------------------------------- */ +/* End of Options for image reading */ +/* ----------------------------------------------------------------------- */ + +/* ----------------------------------------------------------------------- */ +/* + + Options for image generation by libisofs and image transport to libburn. + + An application shall create an option set by isoburn_igopt_new(), + program it by isoburn_igopt_set_*(), use it with either + isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete + it by isoburn_igopt_destroy(). + +*/ +/* ----------------------------------------------------------------------- */ + +struct isoburn_imgen_opts; + +/** Produces a set of generation and transfer options, initialized with default + values. + @since 0.1.0 + @param o the newly created option set object + @param flag Bitfield for control purposes. Submit 0 for now. + @return 1=ok , <0 = failure +*/ +int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag); + + +/** Deletes an option set which was created by isoburn_igopt_new(). + @since 0.1.0 + @param o The option set to give up + @param flag Bitfield for control purposes. Submit 0 for now. + @return 1= **o destroyed , 0= *o was already NULL (harmless) +*/ +int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag); + + +/** ISO level to write at. + @since 0.1.0 + @param o The option set to work on + @param level is a term of the ISO 9660 standard. It should be one of: + 1= filenames restricted to form 8.3 + 2= filenames allowed up to 31 characters + 3= file content may be larger than 4 GB - 1. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level); +int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level); + + +/** Which extensions to support. + @since 0.1.0 + @param o The option set to work on + @param ext Bitfield: + bit0= rockridge + Rock Ridge extensions add POSIX file attributes like + owner, group, access permissions, long filenames. Very + advisable if the designed audience has Unix style systems. + bit1= joliet + Longer filenames for Windows systems. + Weaker than RockRidge, but also readable with GNU/Linux. + bit2= iso1999 + This is rather exotic. Better do not surprise the readers. + bit3= hardlinks + Enable hardlink consolidation. IsoNodes which refer to the + same source object and have the same properties will get + the same ISO image inode numbers. + If combined with isoburn_igopt_rrip_version_1_10 below, + then the PX entry layout of RRIP-1.12 will be used within + RRIP-1.10 (mkisofs does this without causing visible trouble). + bit5= aaip + The libisofs specific SUSP based extension of ECMA-119 which + can encode ACL and XFS-style Extended Attributes. + bit6= session_md5 + @since 0.4.2 + Produce and write MD5 checksum tags of superblock, directory + tree, and the whole session stream. + bit7= file_md5 + @since 0.4.2 + Produce and write MD5 checksums for each single IsoFile. + bit8= file_stability (only together with file_md5) + @since 0.4.2 + Compute MD5 of each file before copying it into the image and + compare this with the MD5 of the actual copying. If they do + not match then issue MISHAP event. + See also libisofs.h iso_write_opts_set_record_md5() + bit9= no_emul_toc + @since 0.5.8 + On overwriteable media or random access files do not write + the first session to LBA 32 and do not copy the first 64kB + of the first session to LBA 0, but rather write the first + session to LBA 0 directly. + bit10= will_cancel + @since 0.6.6 + Announce to libisofs that only the image size is desired + and that the write thread will be cancelled by + isoburn_cancel_prepared_write() before actual image writing + occurs. Without this, cancellation can cause a MISHAP event. + bit11= old_empty + @since 1.0.2 + Let symbolic links and device files point to block 0, and let + empty data files point to the address of the Volume Descriptor + Set Terminator. This was done by libisofs in the past. + By default there is now a single dedicated block of zero bytes + after the end of the directory trees, of which the address + is used for all files without own content. + + @return 1 success, <=0 failure +*/ +#define isoburn_igopt_rockridge 1 +#define isoburn_igopt_joliet 2 +#define isoburn_igopt_iso1999 4 +#define isoburn_igopt_hardlinks 8 +#define isoburn_igopt_aaip 32 +#define isoburn_igopt_session_md5 64 +#define isoburn_igopt_file_md5 128 +#define isoburn_igopt_file_stability 256 +#define isoburn_igopt_no_emul_toc 512 +#define isoburn_igopt_will_cancel 1024 +#define isoburn_igopt_old_empty 2048 +int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext); +int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext); + +/** Relaxed constraints. Setting any of the bits to 1 break the specifications, + but it is supposed to work on most moderns systems. Use with caution. + @since 0.1.0 + @param o The option set to work on + @param relax Bitfield: + bit0= omit_version_numbers + Omit the version number (";1") at the end of the + ISO-9660 and Joliet identifiers. + Version numbers are usually not used by readers. + bit1= allow_deep_paths + Allow ISO-9660 directory hierarchy to be deeper + than 8 levels. + bit2= allow_longer_paths + Allow path in the ISO-9660 tree to have more than + 255 characters. + bit3= max_37_char_filenames + Allow a single file or directory hierarchy to have + up to 37 characters. This is larger than the 31 + characters allowed by ISO level 2, and the extra space + is taken from the version number, so this also forces + omit_version_numbers. + bit4= no_force_dots + ISO-9660 forces filenames to have a ".", that separates + file name from extension. libisofs adds it if original + filename has none. Set this to 1 to prevent this + behavior. + bit5= allow_lowercase + Allow lowercase characters in ISO-9660 filenames. + By default, only uppercase characters, numbers and + a few other characters are allowed. + bit6= allow_full_ascii + Allow all ASCII characters to be appear on an ISO-9660 + filename. Note * that "/" and "\0" characters are never + allowed, even in RR names. + bit7= joliet_longer_paths + Allow paths in the Joliet tree to have more than + 240 characters. + bit8= always_gmt + Write timestamps as GMT although the specs prescribe local + time with eventual non-zero timezone offset. Negative + timezones (west of GMT) can trigger bugs in some operating + systems which typically appear in mounted ISO images as if + the timezone shift from GMT was applied twice + (e.g. in New York 22:36 becomes 17:36). + bit9= rrip_version_1_10 + Write Rock Ridge info as of specification RRIP-1.10 rather + than RRIP-1.12: signature "RRIP_1991A" rather than + "IEEE_1282", field PX without file serial number. + bit10= dir_rec_mtime + Store as ECMA-119 Directory Record timestamp the mtime + of the source rather than the image creation time. + bit11= aaip_susp_1_10 + Write AAIP fields without announcing AAIP by an ER field and + without distinguishing RRIP fields from the AAIP field by + prefixed ES fields. This saves 5 to 10 bytes per file and + might avoid problems with readers which only accept RRIP. + SUSP-1.10 allows it, SUSP-1.12 frowns on it. + bit12= only_iso_numbers + Same as bit1 omit_version_number but restricted to the names + in the eventual Joliet tree. + @since 0.5.4 + For reasons of backward compatibility it is not possible yet + to disable version numbers for ISO 9660 while enabling them + for Joliet. + bit13= no_j_force_dots + Same as no_force_dots but affecting the names in the eventual + Joliet tree rather than the ISO 9660 / ECMA-119 names. + @since 0.5.4 + Previous versions added dots to Joliet names unconditionally. + bit14= allow_dir_id_ext + Convert directory names for ECMA-119 similar to other file + names, but do not force a dot or add a version number. + This violates ECMA-119 by allowing one "." and especially + ISO level 1 by allowing DOS style 8.3 names rather than + only 8 characters. + (mkisofs and its clones obviously do this violation.) + @since 1.0.0 + bit15= joliet_long_names + Allow for Joliet leaf names up to 103 characters rather than + up to 64. + @since 1.0.6 + @return 1 success, <=0 failure +*/ +#define isoburn_igopt_omit_version_numbers 1 +#define isoburn_igopt_allow_deep_paths 2 +#define isoburn_igopt_allow_longer_paths 4 +#define isoburn_igopt_max_37_char_filenames 8 +#define isoburn_igopt_no_force_dots 16 +#define isoburn_igopt_allow_lowercase 32 +#define isoburn_igopt_allow_full_ascii 64 +#define isoburn_igopt_joliet_longer_paths 128 +#define isoburn_igopt_always_gmt 256 +#define isoburn_igopt_rrip_version_1_10 512 +#define isoburn_igopt_dir_rec_mtime 1024 +#define isoburn_igopt_aaip_susp_1_10 2048 +#define isoburn_igopt_only_iso_versions 4096 +#define isoburn_igopt_no_j_force_dots 8192 +#define isoburn_igopt_allow_dir_id_ext 16384 +#define isoburn_igopt_joliet_long_names 32768 +int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax); +int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax); + + +/** Caution: This option breaks any assumptions about names that + are supported by ECMA-119 specifications. + Try to omit any translation which would make a file name compliant to the + ECMA-119 rules. This includes and exceeds omit_version_numbers, + max_37_char_filenames, no_force_dots bit0, allow_full_ascii. Further it + prevents the conversion from local character set to ASCII. + The maximum name length is given by this call. If a filename exceeds + this length or cannot be recorded untranslated for other reasons, then + image production gets aborted. + Currently the length limit is 96 characters, because an ECMA-119 directory + record may at most have 254 bytes and up to 158 other bytes must fit into + the record. Probably 96 more bytes can be made free for the name in future. + @since 1.0.0 + @param o The option set to work on + @param len 0 = disable this feature and perform name translation + according to other settings. + >0 = Omit any translation. Eventually abort image production + if a name is longer than the given value. + -1 = Like >0. Allow maximum possible length. + isoburn_igopt_get_untranslated_name_len() will tell the + effectively resulting value. + @return >0 success, <=0 failure +*/ +int isoburn_igopt_set_untranslated_name_len(struct isoburn_imgen_opts *o, + int len); +int isoburn_igopt_get_untranslated_name_len(struct isoburn_imgen_opts *o, + int *len); + + +/** Whether and how files should be sorted. + @since 0.1.0 + @param o The option set to work on + @param value Bitfield: bit0= sort_files_by_weight + files should be sorted based on their weight. + Weight is attributed to files in the image + by libisofs call iso_node_set_sort_weight(). + @return 1 success, <=0 failure +*/ +#define isoburn_igopt_sort_files_by_weight 1 +int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value); +int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value); + + +/** Set the override values for files and directory permissions. + The parameters replace_* these take one of three values: 0, 1 or 2. + If 0, the corresponding attribute will be kept as set in the IsoNode + at the time of image generation. + If set to 1, the corresponding attrib. will be changed by a default + suitable value. + With value 2, the attrib. will be changed with the value specified + in the corresponding *_mode options. Note that only the permissions + are set, the file type remains unchanged. + @since 0.1.0 + @param o The option set to work on + @param replace_dir_mode whether and how to override directories + @param replace_file_mode whether and how to override files of other type + @param dir_mode Mode to use on dirs with replace_dir_mode == 2. + @param file_mode; Mode to use on files with replace_file_mode == 2. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o, + int replace_dir_mode, int replace_file_mode, + mode_t dir_mode, mode_t file_mode); +int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o, + int *replace_dir_mode, int *replace_file_mode, + mode_t *dir_mode, mode_t *file_mode); + +/** Set the override values values for group id and user id. + The rules are like with above overriding of mode values. replace_* controls + whether and how. The other two parameters provide values for eventual use. + @since 0.1.0 + @param o The option set to work on + @param replace_uid whether and how to override user ids + @param replace_gid whether and how to override group ids + @param uid User id to use with replace_uid == 2. + @param gid Group id to use on files with replace_gid == 2. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o, + int replace_uid, int replace_gid, + uid_t uid, gid_t gid); +int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o, + int *replace_uid, int *replace_gid, + uid_t *uid, gid_t *gid); + +/** Set the charcter set to use for representing RR filenames in the image. + @since 0.1.0 + @param o The option set to work on + @param output_charset Set this to NULL to use the default output charset. + For selecting a particular character set, submit its + name, e.g. as listed by program iconv -l. + Example: "UTF-8". + @return 1 success, <=0 failure +*/ +int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o, + char *output_charset); +int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o, + char **output_charset); + + +/** The number of bytes to be used for the fifo which decouples libisofs + and libburn for better throughput and for reducing the risk of + interrupting signals hitting the libburn thread which operates the + MMC drive. + The size will be rounded up to the next full 2048. + Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway). + @since 0.1.0 + @param o The option set to work on + @param fifo_size Number of bytes to use + @return 1 success, <=0 failure +*/ +int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size); +int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size); + + +/** Obtain after image preparation the block address where the session will + start on the medium. + This value cannot be set by the application but only be inquired. + @since 0.1.4 + @param o The option set to work on + @param lba The block number of the session start on the medium. + <0 means that no address has been determined yet. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba); + + +/** Obtain after image preparation the lowest block address of file content + data. Failure can occur if libisofs is too old to provide this information, + if the result exceeds 31 bit, or if the call is made before image + preparation. + This value cannot be set by the application but only be inquired. + @since 0.3.6 + @param o The option set to work on + @param lba The block number of the session start on the medium. + <0 means that no address has been determined yet. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_get_data_start(struct isoburn_imgen_opts *o, int *lba); + + +/** Set resp. get parameters "name" and "timestamp" for a scdbackup checksum + tag. It will be appended to the libisofs session tag if the image starts at + LBA 0. See isoburn_disc_track_lba_nwa. The scdbackup tag can be used + to verify the image by command scdbackup_verify $device -auto_end. + See scdbackup/README appendix VERIFY for its inner details. + @since 0.4.4 + @param o The option set to work on + @param name The tag name. 80 characters max. + @param timestamp A string of up to 13 characters YYMMDD.hhmmss + A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ... + @param tag_written Either NULL or the address of an array with at least 512 + characters. In the latter case the eventually produced + scdbackup tag will be copied to this array when the image + gets written. This call sets scdbackup_tag_written[0] = 0 + to mark its preliminary invalidity. + @return 1 success, <=0 failure + */ +int isoburn_igopt_set_scdbackup_tag(struct isoburn_imgen_opts *o, char *name, + char *timestamp, char *tag_written); +int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o, + char name[81], char timestamp[19], + char **tag_written); + + +/** Attach 32 kB of binary data which shall get written to the first 32 kB + of the ISO image, the System Area. + options can cause manipulations of these data before writing happens. + If system area data are giveni or options bit0 is set, then bit1 of + el_torito_set_isolinux_options() is automatically disabled. + @since 0.5.4 + @param o The option set to work on + @param data Either NULL or 32 kB of data. Do not submit less bytes ! + @param options Can cause manipulations of submitted data before they + get written: + bit0= apply a --protective-msdos-label as of grub-mkisofs. + This means to patch bytes 446 to 512 of the system + area so that one partition is defined which begins + at the second 512-byte block of the image and ends + where the image ends. + This works with and without system_area_data. + bit1= apply isohybrid MBR patching to the system area. + This works only with system area data from + SYSLINUX plus an ISOLINUX boot image (see + iso_image_set_boot_image()) and only if not bit0 + is set. + bit2-7= System area type + 0= with bit0 or bit1: MBR + else: unspecified type + @since 0.6.4 + 1= MIPS Big Endian Volume Header + Submit up to 15 MIPS Big Endian boot files by + iso_image_add_mips_boot_file() of libisofs. + This will overwrite the first 512 bytes of + the submitted data. + 2= DEC Boot Block for MIPS Little Endian + The first boot file submitted by + iso_image_add_mips_boot_file() will be activated. + This will overwrite the first 512 bytes of + the submitted data. + @since 0.6.6 + 3= SUN Disk Label for SUN SPARC + Submit up to 7 SPARC boot images by + isoburn_igopt_set_partition_img() for partition + numbers 2 to 8. + This will overwrite the first 512 bytes of + the submitted data. + bit8-9= Only with System area type 0 = MBR + @since 1.0.4 + Cylinder alignment mode eventually pads the image + to make it end at a cylinder boundary. + 0 = auto (align if bit1) + 1 = always align to cylinder boundary + 2 = never align to cylinder boundary + + @return 1 success, 0 no data to get, <0 failure +*/ +int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o, + char data[32768], int options); +int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o, + char data[32768], int *options); + +/** Control production of a second set of volume descriptors (superblock) + and directory trees, together with a partition table in the MBR where the + first partition has non-zero start address and the others are zeroed. + The first partition stretches to the end of the whole ISO image. + The additional volume descriptor set and trees will allow to mount the + ISO image at the start of the first partition, while it is still possible + to mount it via the normal first volume descriptor set and tree at the + start of the image resp. storage device. + This makes few sense on optical media. But on USB sticks it creates a + conventional partition table which makes it mountable on e.g. Linux via + /dev/sdb and /dev/sdb1 alike. + @since 0.6.2 + @param opts + The option set to be manipulated. + @param block_offset_2k + The offset of the partition start relative to device start. + This is counted in 2 kB blocks. The partition table will show the + according number of 512 byte sectors. + Default is 0 which causes no second set and trees. + If it is not 0 then it must not be smaller than 16. + @param secs_512_per_head + Number of 512 byte sectors per head. 1 to 63. 0=automatic. + @param heads_per_cyl + Number of heads per cylinder. 1 to 255. 0=automatic. + @return 1 success, <=0 failure + */ +int isoburn_igopt_set_part_offset(struct isoburn_imgen_opts *opts, + uint32_t block_offset_2k, + int secs_512_per_head, int heads_per_cyl); +int isoburn_igopt_get_part_offset(struct isoburn_imgen_opts *opts, + uint32_t *block_offset_2k, + int *secs_512_per_head, int *heads_per_cyl); + + +/** Explicitely set the four timestamps of the emerging ISO image. + Default with all parameters is 0. + @since 0.5.4 + @param opts + The option set to work on + @param creation_time + ECMA-119 Volume Creation Date and Time + When "the information in the volume was created." + A value of 0 means that the timepoint of write start is to be used. + @param modification_time + ECMA-119 Volume Modification Date and Time + When "the informationin the volume was last modified." + A value of 0 means that the timepoint of write start is to be used. + @param expiration_time + ECMA-119 Volume Expiration Date and Time + When "the information in the volume may be regarded as obsolete." + A value of 0 means that the information never shall expire. + @param effective_time + ECMA-119 Volume Effective Date and Time + When "the information in the volume may be used." + A value of 0 means that not such retention is intended. + @param uuid + If this text is not empty, then it overrides vol_modification_time + by copying the first 16 decimal digits from uuid, eventually + padding up with decimal '1', and writing a NUL-byte as timezone GMT. + It should express a reasonable time in form YYYYMMDDhhmmsscc + E.g.: 2010040711405800 = 7 Apr 2010 11:40:58 (+0 centiseconds) + @return 1 success, <=0 failure + */ +int isoburn_igopt_set_pvd_times(struct isoburn_imgen_opts *opts, + time_t creation_time, time_t modification_time, + time_t expiration_time, time_t effective_time, + char *uuid); +int isoburn_igopt_get_pvd_times(struct isoburn_imgen_opts *opts, + time_t *creation_time, time_t *modification_time, + time_t *expiration_time, time_t *effective_time, + char uuid[17]); + + +/** Associate a libjte environment object to the upcomming write run. + libjte implements Jigdo Template Extraction as of Steve McIntyre and + Richard Atterer. + A non-NULL libjte_handle will cause failure to write if libjte was not + enabled in libisofs at compile time. + @since 0.6.4 + @param opts + The option set to work on + @param libjte_handle + Pointer to a struct libjte_env e.g. created by libjte_new(). + It must stay existent from the start of image writing by + isoburn_prepare_*() until the write thread has ended. + E.g. until libburn indicates the end of its write run. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_attach_jte(struct isoburn_imgen_opts *opts, + void *libjte_handle); + +/** Remove eventual association to a libjte environment handle. + @since 0.6.4 + @param opts + The option set to work on + @param libjte_handle + If not submitted as NULL, this will return the previously set + libjte handle. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_detach_jte(struct isoburn_imgen_opts *opts, + void **libjte_handle); + + +/** Set resp. get the number of trailing zero byte blocks to be written by + libisofs. The image size counter of the emerging ISO image will include + them. Eventual checksums will take them into respect. + They will be written immediately before the eventual image checksum area + which is at the very end of the image. + For a motivation see iso_write_opts_set_tail_blocks() in libisofs.h . + @since 0.6.4 + @param opts + The option set to work on + @aram num_blocks + Number of extra 2 kB blocks to be written by libisofs. + @return 1 success, <=0 failure +*/ +int isoburn_igopt_set_tail_blocks(struct isoburn_imgen_opts *opts, + uint32_t num_blocks); +int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts, + uint32_t *num_blocks); + + +/** Cause an arbitrary data file to be appended to the ISO image and to be + described by a partition table entry in an MBR or SUN Disk Label at the + start of the ISO image. + The partition entry will bear the size of the image file rounded up to + the next multiple of 2048 bytes. + MBR or SUN Disk Label are selected by isoburn_igopt_set_system_area() + system area type: 0 selects MBR partition table. 3 selects a SUN partition + table with 320 kB start alignment. + @since 0.6.4 + @param opts + The option set to be manipulated. + @param partition_number + Depicts the partition table entry which shall describe the + appended image. + Range with MBR: 1 to 4. 1 will cause the whole ISO image to be + unclaimable space before partition 1. + @since 0.6.6 + Range with SUN Disk Label: 2 to 8. + @param image_path + File address in the local file system. + With SUN Disk Label: an empty name causes the partition to become + a copy of the next lower partition. + @param image_type + The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06, + Linux Native Partition = 0x83. See fdisk command L. + This parameter is ignored with SUN Disk Label. + @return + <=0 = error, 1 = success +*/ +int isoburn_igopt_set_partition_img(struct isoburn_imgen_opts *opts, + int partition_number, uint8_t partition_type, + char *image_path); + +/** Inquire the current settings made by isoburn_igopt_set_partition_img(). + @since 0.6.4 + @param opts + The option set to be inquired. + @param num_entries + Number of array elements in partition_types[] and image_paths[]. + @param partition_types + The partition type associated with the partition. Valid only if + image_paths[] of the same index is not NULL. + @param image_paths + Its elements get filled with either NULL or a pointer to a string + with a file address resp. an empty text. + @return + <0 = error + 0 = no partition image set + >0 highest used partition number +*/ +int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts, + int num_entries, + uint8_t partition_types[], + char *image_paths[]); + + +/** Set a name for the system area. This setting is ignored unless system area + type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area(). + In this case it will replace the default text at the start of the image: + "CD-ROM Disc with Sun sparc boot created by libisofs" + @since 0.6.6 + @param opts + The option set to be manipulated. + @param label + A text of up to 128 characters. + @return + <=0 = error, 1 = success +*/ +int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label); + +/** Inquire the current setting made by isoburn_igopt_set_disc_label(). + @since 0.6.6 + @param opts + The option set to be inquired. + @param label + Returns a pointer to the currently set label string. + Do not alter this string. + Use only as long as the opts object exists. + @return + <=0 = error, 1 = success +*/ +int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts, + char **label); + + +/* ----------------------------------------------------------------------- */ +/* End of Options for image generation */ +/* ----------------------------------------------------------------------- */ + + +/** Get the image attached to a drive, if any. + @since 0.1.0 + @param d The drive to inquire + @return A reference to attached image, or NULL if the drive has no image + attached. This reference needs to be released via iso_image_unref() + when it is not longer needed. +*/ +IsoImage *isoburn_get_attached_image(struct burn_drive *d); + + +/** Load the ISO filesystem directory tree from the medium in the given drive. + This will give libisoburn the base on which it can let libisofs perform + image growing or image modification. The loaded volset gets attached + to the drive object and handed out to the application. + Not a wrapper, but peculiar to libisoburn. + @since 0.1.0 + @param d The drive which holds an existing ISO filesystem or blank media. + d is allowed to be NULL which produces an empty ISO image. In + this case one has to call before writing isoburn_attach_volset() + with the volset from this call and with the intended output + drive. + @param read_opts The read options which can be chosen by the application + @param image the image read, if the disc is blank it will have no files. + This reference needs to be released via iso_image_unref() when + it is not longer needed. The drive, if not NULL, will hold an + own reference which it will release when it gets a new volset + or when it gets released via isoburn_drive_release(). + You can pass NULL if you already have a reference or you plan to + obtain it later with isoburn_get_attached_image(). Of course, if + you haven't specified a valid drive (i.e., if d == NULL), this + parameter can't be NULL. + @return <=0 error , 1 = success +*/ +int isoburn_read_image(struct burn_drive *d, + struct isoburn_read_opts *read_opts, + IsoImage **image); + +/** Set a callback function for producing pacifier messages during the lengthy + process of image reading. The callback function and the application handle + are stored until they are needed for the underlying call to libisofs. + Other than with libisofs the handle is managed entirely by the application. + An idle .free() function is exposed to libisofs. The handle has to stay + valid until isoburn_read_image() is done. It has to be detached by + isoburn_set_read_pacifier(drive, NULL, NULL); + before it may be removed from memory. + @since 0.1.0 + @param drive The drive which will be used with isoburn_read_image() + It has to be aquired by an isoburn_* wrapper call. + @param read_pacifier The callback function + @param app_handle The app handle which the callback function can obtain + via iso_image_get_attached_data() from its IsoImage* + @return 1 success, <=0 failure +*/ +int isoburn_set_read_pacifier(struct burn_drive *drive, + int (*read_pacifier)(IsoImage*, IsoFileSource*), + void *app_handle); + +/** Inquire the partition offset of the loaded image. The first 512 bytes of + the image get examined whether they bear an MBR signature and a first + partition table entry which matches the size of the image. In this case + the start address is recorded as partition offset and internal buffers + get adjusted. + See also isoburn_igopt_set_part_offset(). + @since 0.6.2 + @param drive The drive with the loaded image + @param block_offset_2k returns the recognized partition offset + @return <0 = error + 0 = no partition offset recognized + 1 = acceptable non-zero offset, buffers are adjusted + 2 = offset is credible but not acceptable for buffer size +*/ +int isoburn_get_img_partition_offset(struct burn_drive *drive, + uint32_t *block_offset_2k); + + +/** Set the IsoImage to be used with a drive. This eventually releases + the reference to the old IsoImage attached to the drive. + Caution: Use with care. It hardly makes sense to replace an image that + reflects a valid ISO image on the medium. + This call is rather intended for writing a newly created and populated + image to blank media. The use case in xorriso is to let an image survive + the change or demise of the outdev target drive. + @since 0.1.0 + @param d The drive which shall be write target of the volset. + @param image The image that represents the image to be written. + This image pointer MUST already be a valid reference suitable + for iso_image_unref(). + It may have been obtained by appropriate libisofs calls or by + isoburn_read_image() with d==NULL. + @return <=0 error , 1 = success +*/ +int isoburn_attach_image(struct burn_drive *d, IsoImage *image); + + +/** Return the best possible estimation of the currently available capacity of + the medium. This might depend on particular write option settings and on + drive state. + An eventual start address for emulated multi-session will be subtracted + from the capacity estimation given by burn_disc_available_space(). + Negative results get defaulted to 0. + Wrapper for: burn_disc_available_space() + @since 0.1.0 + @param d The drive to query. + @param o If not NULL: write parameters to be set on drive before query + @return number of most probably available free bytes +*/ +off_t isoburn_disc_available_space(struct burn_drive *d, + struct burn_write_opts *o); + + +/** Obtain the start block number of the most recent session on the medium. In + case of random access media this will normally be 0. Successfull return is + not a guarantee that there is a ISO-9660 image at all. The call will fail, + nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE + or BURN_DISC_FULL. + Note: The result of this call may be fabricated by a previous call of + isoburn_set_msc1() which can override the rule to load the most recent + session. + Wrapper for: burn_disc_get_msc1() + @since 0.1.0 + @param d The drive to inquire + @param start_lba Contains on success the start address in 2048 byte blocks + @return <=0 error , 1 = success +*/ +int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba); + + +/** Use this with trackno==0 to obtain the predicted start block number of the + new session. The interesting number is returned in parameter nwa. + Wrapper for: burn_disc_track_lba_nwa() + @since 0.1.0 + @param d The drive to inquire + @param o If not NULL: write parameters to be set on drive before query + @param trackno Submit 0. + @param lba return value: start lba + @param nwa return value: Next Writeable Address + @return 1=nwa is valid , 0=nwa is not valid , -1=error +*/ +int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, + int trackno, int *lba, int *nwa); + + +/** Obtain the size which was attributed to an emulated appendable on actually + overwriteable media. This value is supposed to be <= 2048 * nwa as of + isoburn_disc_track_lba_nwa(). + @since 0.1.0 + @param d The drive holding the medium. + @param start_byte The reply value counted in bytes, not in sectors. + @param flag Unused yet. Submit 0. + @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error +*/ +int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, + int flag); + + +/** To choose the expansion method of Growing: + Create a disc object for writing the new session from the created or loaded + iso_volset which has been manipulated via libisofs, to the same medium from + where the image was eventually loaded. This struct burn_disc is ready for + use by a subsequent call to isoburn_disc_write(). + After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE + again, the burn_disc object has to be disposed by burn_disc_free(). + @since 0.1.0 + @param drive The combined source and target drive, grabbed with + isoburn_drive_scan_and_grab(). . + @param disc Returns the newly created burn_disc object. + @param opts Image generation options, see isoburn_igopt_*() + @return <=0 error , 1 = success +*/ +int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc, + struct isoburn_imgen_opts *opts); + + +/** To choose the expansion method of Modifying: + Create a disc object for producing a new image from a previous image + plus the changes made by user. The generated burn_disc is suitable + to be written to a grabbed drive with blank writeable medium. + But you must not use the same drive for input and output, because data + will be read from the source drive while at the same time the target + drive is already writing. + The resulting burn_disc object has to be disposed when all its writing + is done and the drive is BURN_DRIVE_IDLE again after asynchronous + burn_disc_write(). + @since 0.1.0 + @param in_drive The input drive, grabbed with isoburn_drive_aquire() or + one of its alternatives. + @param disc Returns the newly created burn_disc object. + @param opts Options for image generation and data transport to the + medium. + @param out_drive The output drive, from isoburn_drive_aquire() et.al.. + @return <=0 error , 1 = success +*/ +int isoburn_prepare_new_image(struct burn_drive *in_drive, + struct burn_disc **disc, + struct isoburn_imgen_opts *opts, + struct burn_drive *out_drive); + + +/** To choose the expansion method of Blind Growing: + Create a disc object for writing an add-on session from the created or + loaded IsoImage which has been manipulated via libisofs, to a different + drive than the one from where it was loaded. + Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped + into some burn program like with this classic gesture: + mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev + Parameter translation into libisoburn: + $dev is the address by which parameter in_drive of this call was aquired + $msc1 was set by isoburn_set_msc1() before image reading + or was detected from the in_drive medium + $nwa is a parameter of this call + or can be used as detected from the in_drive medium + + This call waits for libisofs output to become available and then detaches + the input drive object from the data source object by which libisofs was + reading from the input drive. + So, as far as libisofs is concerned, that drive may be released immediately + after this call in order to allow the consumer to access the drive for + writing. + The consumer should wait for input to become available and only then open + its burn drive. With cdrecord this is caused by option -waiti. + + The resulting burn_disc object has to be disposed when all its writing + is done and the drive is BURN_DRIVE_IDLE again after asynchronous + burn_disc_write(). + @since 0.2.2 + @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab(). + @param disc Returns the newly created burn_disc object. + @param opts Options for image generation and data transport to media. + @param out_drive The output drive, from isoburn_drive_aquire() et.al.. + typically stdio:/dev/fd/1 . + @param nwa The address (2048 byte block count) where the add-on + session will be finally stored on a mountable medium + or in a mountable file. + If nwa is -1 then the address is used as determined from + the in_drive medium. + @return <=0 error , 1 = success +*/ +int isoburn_prepare_blind_grow(struct burn_drive *in_drive, + struct burn_disc **disc, + struct isoburn_imgen_opts *opts, + struct burn_drive *out_drive, int nwa); + + +/** + Revoke isoburn_prepare_*() instead of running isoburn_disc_write(). + libisofs reserves resources and maybe already starts generating the + image stream when one of above three calls is performed. It is mandatory to + either run isoburn_disc_write() or to revoke the preparations by the + call described here. + If this call returns 0 or 1 then the write thread of libisofs has ended. + @since 0.1.0 + @param input_drive The drive resp. in_drive which was used with the + preparation call. + @param output_drive The out_drive used with isoburn_prepare_new_image(), + NULL if none. + @param flag Bitfield, submit 0 for now. + bit0= -reserved for internal use- + @return <0 error, 0= no pending preparations detectable, 1 = canceled +*/ +int isoburn_cancel_prepared_write(struct burn_drive *input_drive, + struct burn_drive *output_drive, int flag); + + +/** + Override the truncation setting that was made with flag bit2 during the + call of isoburn_drive_aquire. This applies only to stdio pseudo drives. + @since 0.1.6 + @param drive The drive which was aquired and shall be used for writing. + @param flag Bitfield controlling the setting: + bit0= truncate (else do not truncate) + bit1= do not warn if call is inappropriate to drive + bit2= only set if truncation is currently enabled + do not warn if call is inappropriate to drive + @return 1 success, 0 inappropriate drive, <0 severe error +*/ +int isoburn_set_truncate(struct burn_drive *drive, int flag); + + +/** Start writing of the new session. + This call is asynchrounous. I.e. it returns quite soon and the progress has + to be watched by a loop with call burn_drive_get_status() until + BURN_DRIVE_IDLE is returned. + Wrapper for: burn_disc_write() + @since 0.1.0 + @param o Options which control the burn process. See burnwrite_opts_*() + in libburn.h. + @param disc Disc object created either by isoburn_prepare_disc() or by + isoburn_prepare_new_image(). +*/ +void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); + + +/** Inquire state and fill parameters of the fifo which is attached to + the emerging track. This should be done in the pacifier loop while + isoburn_disc_write() or burn_disc_write() are active. + This works only with drives obtained by isoburn_drive_scan_and_grab() + or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then + parameter out_drive must have announced the track output drive. + Hint: If only burn_write_opts and not burn_drive is known, then the drive + can be obtained by burn_write_opts_get_drive(). + @since 0.1.0 + @param d The drive to which the track with the fifo gets burned. + @param size The total size of the fifo + @param free_bytes The current free capacity of the fifo + @param status_text Returns a pointer to a constant text, see below + @return <0 reply invalid, >=0 fifo status code: + bit0+1=input status, bit2=consumption status, i.e: + 0="standby" : data processing not started yet + 1="active" : input and consumption are active + 2="ending" : input has ended without error + 3="failing" : input had error and ended, + 4="unused" : ( consumption has ended before processing start ) + 5="abandoned" : consumption has ended prematurely + 6="ended" : consumption has ended without input error + 7="aborted" : consumption has ended after input error +*/ +int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes, + char **status_text); + + +/** Inquire whether the most recent write run was successful. + Wrapper for: burn_drive_wrote_well() + @since 0.1.0 + @param d The drive to inquire + @return 1=burn seems to have went well, 0=burn failed +*/ +int isoburn_drive_wrote_well(struct burn_drive *d); + + +/** Call this after isoburn_disc_write has finished and burn_drive_wrote_well() + indicates success. It will eventually complete the emulation of + multi-session functionality, if needed at all. Let libisoburn decide. + Not a wrapper, but peculiar to libisoburn. + @since 0.1.0 + @param d The output drive to which the session was written + @return 1 success , <=0 failure +*/ +int isoburn_activate_session(struct burn_drive *d); + + +/** Wait after normal end of operations until libisofs ended all write + threads and freed resource reservations. + This call is not mandatory. But without it, messages from the ending + threads might appear after the application ended its write procedure. + @since 0.1.0 + @param input_drive The drive resp. in_drive which was used with the + preparation call. + @param output_drive The out_drive used with isoburn_prepare_new_image(), + NULL if none. + @param flag Bitfield, submit 0 for now. + @return <=0 error , 1 = success +*/ +int isoburn_sync_after_write(struct burn_drive *input_drive, + struct burn_drive *output_drive, int flag); + + +/** Release an aquired drive. + Wrapper for: burn_drive_release() + @since 0.1.0 + @param drive The drive to be released + @param eject 1= eject medium from drive , 0= do not eject +*/ +void isoburn_drive_release(struct burn_drive *drive, int eject); + + +/** Shutdown all three libraries. + Wrapper for : iso_finish() and burn_finish(). + @since 0.1.0 +*/ +void isoburn_finish(void); + + +/* + The following calls are for expert applications only. + An application should have a special reason to use them. +*/ + + +/** Inquire wether the medium needs emulation or would be suitable for + generic multi-session via libburn. + @since 0.1.0 + @param d The drive to inquire + @return 0 is generic multi-session + 1 is emulated multi-session + -1 is not suitable for isoburn +*/ +int isoburn_needs_emulation(struct burn_drive *d); + + +/* ---------------------------- Test area ----------------------------- */ + +/* no tests active, currently */ + diff --git a/libisoburn/branches/1.1.8/libisoburn/libisoburn.ver b/libisoburn/branches/1.1.8/libisoburn/libisoburn.ver new file mode 100644 index 00000000..8b467d9e --- /dev/null +++ b/libisoburn/branches/1.1.8/libisoburn/libisoburn.ver @@ -0,0 +1,280 @@ +LIBISOBURN1 { +global: +isoburn_activate_session; +isoburn_attach_image; +isoburn_cancel_prepared_write; +isoburn_disc_available_space; +isoburn_disc_erasable; +isoburn_disc_erase; +isoburn_disc_get_msc1; +isoburn_disc_get_status; +isoburn_disc_track_lba_nwa; +isoburn_disc_write; +isoburn_drive_aquire; +isoburn_drive_grab; +isoburn_drive_release; +isoburn_drive_scan_and_grab; +isoburn_drive_set_msgs_submit; +isoburn_drive_wrote_well; +isoburn_finish; +isoburn_get_attached_image; +isoburn_get_fifo_status; +isoburn_get_min_start_byte; +isoburn_get_mount_params; +isoburn_igopt_attach_jte; +isoburn_igopt_destroy; +isoburn_igopt_detach_jte; +isoburn_igopt_get_data_start; +isoburn_igopt_get_disc_label; +isoburn_igopt_get_effective_lba; +isoburn_igopt_get_extensions; +isoburn_igopt_get_fifo_size; +isoburn_igopt_get_level; +isoburn_igopt_get_out_charset; +isoburn_igopt_get_over_mode; +isoburn_igopt_get_over_ugid; +isoburn_igopt_get_partition_img; +isoburn_igopt_get_pvd_times; +isoburn_igopt_get_relaxed; +isoburn_igopt_get_scdbackup_tag; +isoburn_igopt_get_sort_files; +isoburn_igopt_get_system_area; +isoburn_igopt_get_tail_blocks; +isoburn_igopt_get_untranslated_name_len; +isoburn_igopt_new; +isoburn_igopt_set_disc_label; +isoburn_igopt_set_extensions; +isoburn_igopt_set_fifo_size; +isoburn_igopt_set_level; +isoburn_igopt_set_out_charset; +isoburn_igopt_set_over_mode; +isoburn_igopt_set_over_ugid; +isoburn_igopt_set_partition_img; +isoburn_igopt_set_pvd_times; +isoburn_igopt_set_relaxed; +isoburn_igopt_set_scdbackup_tag; +isoburn_igopt_set_sort_files; +isoburn_igopt_set_system_area; +isoburn_igopt_set_tail_blocks; +isoburn_igopt_set_untranslated_name_len; +isoburn_initialize; +isoburn_is_compatible; +isoburn_libburn_req; +isoburn_libisofs_req; +isoburn_libjte_req; +isoburn_needs_emulation; +isoburn_prepare_blind_grow; +isoburn_prepare_disc; +isoburn_prepare_new_image; +isoburn_read_image; +isoburn_read_iso_head; +isoburn_ropt_destroy; +isoburn_ropt_get_auto_incharset; +isoburn_ropt_get_default_dirperms; +isoburn_ropt_get_default_perms; +isoburn_ropt_get_displacement; +isoburn_ropt_get_extensions; +isoburn_ropt_get_input_charset; +isoburn_ropt_get_size_what; +isoburn_ropt_new; +isoburn_ropt_set_auto_incharset; +isoburn_ropt_set_default_dirperms; +isoburn_ropt_set_default_perms; +isoburn_ropt_set_displacement; +isoburn_ropt_set_extensions; +isoburn_ropt_set_input_charset; +isoburn_set_msc1; +isoburn_set_msgs_submit; +isoburn_set_read_pacifier; +isoburn_set_truncate; +isoburn_sync_after_write; +isoburn_toc_disc_free; +isoburn_toc_disc_get_sectors; +isoburn_toc_disc_get_sessions; +isoburn_toc_drive_get_disc; +isoburn_toc_session_get_leadout_entry; +isoburn_toc_session_get_sectors; +isoburn_toc_session_get_tracks; +isoburn_toc_track_get_emul; +isoburn_toc_track_get_entry; +isoburn_version; +Xorriso_change_is_pending; +Xorriso_destroy; +Xorriso_dialog; +Xorriso_eval_problem_status; +Xorriso_execute_option; +Xorriso__get_patch_level_text; +Xorriso_get_problem_status; +Xorriso_interpreter; +Xorriso__is_compatible; +Xorriso_lst_destroy_all; +Xorriso_lst_get_next; +Xorriso_lst_get_prev; +Xorriso_lst_get_text; +Xorriso_make_return_value; +Xorriso_msgs_submit; +Xorriso_msgs_submit_void; +Xorriso_new; +Xorriso_option_abort_on; +Xorriso_option_abstract_file; +Xorriso_option_acl; +Xorriso_option_add; +Xorriso_option_add_plainly; +Xorriso_option_alter_date; +Xorriso_option_append_partition; +Xorriso_option_application_id; +Xorriso_option_as; +Xorriso_option_assert_volid; +Xorriso_option_auto_charset; +Xorriso_option_backslash_codes; +Xorriso_option_ban_stdio_write; +Xorriso_option_biblio_file; +Xorriso_option_blank; +Xorriso_option_boot_image; +Xorriso_option_calm_drive; +Xorriso_option_cdi; +Xorriso_option_cdx; +Xorriso_option_charset; +Xorriso_option_check_md5; +Xorriso_option_check_media; +Xorriso_option_check_media_defaults; +Xorriso_option_chgrpi; +Xorriso_option_chmodi; +Xorriso_option_chowni; +Xorriso_option_clone; +Xorriso_option_close; +Xorriso_option_close_damaged; +Xorriso_option_close_filter_list; +Xorriso_option_commit; +Xorriso_option_commit_eject; +Xorriso_option_compare; +Xorriso_option_compliance; +Xorriso_option_copyright_file; +Xorriso_option_cp_clone; +Xorriso_option_cpri; +Xorriso_option_cpx; +Xorriso_option_cut_out; +Xorriso_option_dev; +Xorriso_option_devices; +Xorriso_option_dialog; +Xorriso_option_disk_dev_ino; +Xorriso_option_disk_pattern; +Xorriso_option_displacement; +Xorriso_option_drive_class; +Xorriso_option_dummy; +Xorriso_option_dvd_obs; +Xorriso_option_early_drive_test; +Xorriso_option_eject; +Xorriso_option_end; +Xorriso_option_errfile_log; +Xorriso_option_error_behavior; +Xorriso_option_external_filter; +Xorriso_option_extract; +Xorriso_option_extract_cut; +Xorriso_option_file_size_limit; +Xorriso_option_find; +Xorriso_option_follow; +Xorriso_option_fs; +Xorriso_option_getfacli; +Xorriso_option_gid; +Xorriso_option_grow_blindly; +Xorriso_option_hardlinks; +Xorriso_option_help; +Xorriso_option_hide; +Xorriso_option_history; +Xorriso_option_iso_rr_pattern; +Xorriso_option_jigdo; +Xorriso_option_joliet; +Xorriso_option_list_delimiter; +Xorriso_option_list_formats; +Xorriso_option_list_formats; +Xorriso_option_list_profiles; +Xorriso_option_list_speeds; +Xorriso_option_load; +Xorriso_option_logfile; +Xorriso_option_lsi; +Xorriso_option_lsx; +Xorriso_option_map; +Xorriso_option_map_l; +Xorriso_option_mark; +Xorriso_option_md5; +Xorriso_option_mkdiri; +Xorriso_option_mount; +Xorriso_option_mount_opts; +Xorriso_option_mvi; +Xorriso_option_no_rc; +Xorriso_option_not_leaf; +Xorriso_option_not_list; +Xorriso_option_not_mgt; +Xorriso_option_not_paths; +Xorriso_option_options_from_file; +Xorriso_option_osirrox; +Xorriso_option_overwrite; +Xorriso_option_pacifier; +Xorriso_option_padding; +Xorriso_option_page; +Xorriso_option_paste_in; +Xorriso_option_path_list; +Xorriso_option_pathspecs; +Xorriso_option_pkt_output; +Xorriso_option_preparer_id; +Xorriso_option_print; +Xorriso_option_print_size; +Xorriso_option_prog; +Xorriso_option_prog_help; +Xorriso_option_prompt; +Xorriso_option_publisher; +Xorriso_option_pvd_info; +Xorriso_option_pwdi; +Xorriso_option_pwdx; +Xorriso_option_read_mkisofsrc; +Xorriso_option_reassure; +Xorriso_option_report_about; +Xorriso_option_return_with; +Xorriso_option_rmi; +Xorriso_option_rollback; +Xorriso_option_rom_toc_scan; +Xorriso_option_scdbackup_tag; +Xorriso_option_scsi_log; +Xorriso_option_session_log; +Xorriso_option_setfacli; +Xorriso_option_setfacl_listi; +Xorriso_option_setfattri; +Xorriso_option_setfattr_listi; +Xorriso_option_set_filter; +Xorriso_option_signal_handling; +Xorriso_option_sleep; +Xorriso_option_speed; +Xorriso_option_split_size; +Xorriso_option_status; +Xorriso_option_status_history_max; +Xorriso_option_stdio_sync; +Xorriso_option_stream_recording; +Xorriso_option_system_id; +Xorriso_option_tell_media_space; +Xorriso_option_temp_mem_limit; +Xorriso_option_toc; +Xorriso_option_uid; +Xorriso_option_unregister_filter; +Xorriso_option_update; +Xorriso_option_use_readline; +Xorriso_option_version; +Xorriso_option_volid; +Xorriso_option_volset_id; +Xorriso_option_volume_date; +Xorriso_option_xattr; +Xorriso_option_zisofs; +Xorriso_prescan_args; +Xorriso__preset_signal_behavior; +Xorriso_process_errfile; +Xorriso_process_msg_queues; +Xorriso_program_arg_bsl; +Xorriso_pull_outlists; +Xorriso_push_outlists; +Xorriso_read_rc; +Xorriso_set_problem_status; +Xorriso_startup_libraries; +Xorriso__version; +local: *; +}; + diff --git a/libisoburn/branches/1.1.8/releng/CHECKLIST b/libisoburn/branches/1.1.8/releng/CHECKLIST new file mode 100644 index 00000000..642b75f2 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/CHECKLIST @@ -0,0 +1,32 @@ +Release Engineering Check List +============================== + +Automated and semi-automated tests +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + TEST: all auto_* tests are to be run by ./run_all_auto + FILE: http://people.debian.org/~danchev/libburnia/logs/releng/ + + TEST: all manual_* tests are to be run individually and manually. + + TEST: cppcheck + FILE: http://people.debian.org/~danchev/libburnia/logs/cppcheck/ + + TEST: medistimator (dialog mode, size estimation, processing large trees) + requires some specific knowledge of how the tool works, to interpret + the results and compare them previous runs (see comments in the source). + FILE: http://anonscm.debian.org/gitweb/?p=users/danchev/medistimator.git;a=summary + FILE: http://people.debian.org/~danchev/libburnia/logs/medistimator/ + +Non-automated tests +~~~~~~~~~~~~~~~~~~~ + TEST: valgrind + FILE: + + TEST: buildd_logs + FILE: http://buildd.debian.org (others are also welcome) + FILE: (err/warn from prev. builds for several h/w architectures and kernels: linux, kfreebsd, hurd) + + TEST: gprof + FILE: CFLAGS=-pg ./configure && make + FILE: run resulting executable; gmon.out to be created in current cirectory + FILE: gprof path/to/xorriso gmon.out > gprof.out diff --git a/libisoburn/branches/1.1.8/releng/README b/libisoburn/branches/1.1.8/releng/README new file mode 100644 index 00000000..d1b0547a --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/README @@ -0,0 +1,284 @@ +------------------------------------------------------------------------------ + http:libburnia-project.org +------------------------------------------------------------------------------ +libisoburn/releng. By George Danchev + and Thomas Schmitt + +Test suite for xorriso and libburnia libraries. +Copyright (C) 2011 George Danchev, Thomas Schmitt +Provided under GPL version 2 or later. +------------------------------------------------------------------------------ + +The impatient tester will build libisoburn according to its README and then do + + cd ./releng + ./run_all_auto -x ../xorriso/xorriso + +More patient testers will first read the following description. + +Those who simply lack the interpreter /bin/bash, may do + ./change_shell_to_use +and then retry. + + + The test suite + +Directory ./releng of libisoburn contains a collection of test scripts and +auxiliary data. They exercise some typical use cases of building libisoburn +applications and running the ISO 9660 filesystem manipulation and CD/DVD/BD +burn program xorriso. + +It is assumed that libburn and libisofs are installed, so that libisoburn +can be configured and built. It is not mandatory that libisoburn is already +installed. The tests may use an installed xorriso program as well as a +freshly built one. + +The test scripts explicitely demand /bin/bash as interpreter, although they +would run on certain other shells too. If you get an error message like + ./run_all_auto: not found +then consider to install /bin/bash. +If you decide against that, see below "Alternative Shells". + + +There are two groups of test scripts: + + auto_* gets started and watched by script run_all_auto. + These tests have a moderate resource consumption and do + not cause mechanical movements of drive trays. + + manual_* gets started by the user if desired. + Manual tests may create larger sets of temporary files, + may download test data from the internet, may need + system privileges beyond the reach of a sandbox user, + and operate the mechanics of a CD drive. + + + Running automated tests + +The test scripts expect to get run while the working directory is + ./releng +of a libisoburn source tree. E.g.: libisoburn-1.1.4/releng +They create all their temporary files underneath + ./releng/releng_generated_data +Some of these files are persistent between tests. +Nevertheless it is safe to empty ./releng/releng_generated_data after +tests are done. The directory itself must be kept. + +To run the unobtrusive automatic tests, build libisoburn and xorriso, +go to directory ./releng, and execute + + ./run_all_auto -x ../xorriso/xorriso + +or if you want to use an installed xorriso program: + + ./run_all_auto -x $(which xorriso) +resp. + ./run_all_auto -x $(type -p xorriso) + +There are several options which work with run_all_auto and any single test. + -x absolute or relative path to xorriso binary to be run. + -k keep self-generated data. + -c cleanup temporary data kept from previous run and exit. + -f simulate failure. + -h print this help text. + -- end of general options, begin of test specific options. +After option "--", there may be given options which are specific to +particular manually executable test scripts. + + + Manually executable tests + +Currently there are the following tests which should have the attention of +the user or require sysadmin considerations before they are run: + +./manual_devices -x ../xorriso/xorriso [-- [--dev device_file_to_use] + [--priv_cmd 'command [arg [arg ...]]']] + Exercises listing of all accessible optical drives and the examination of + a one of these drives. The user needs the permission to operate the CD + drives. This might involve the need for superuser authority. + The media tray of the examined drive will get loaded if it is not already. + If no option --dev is given, then the user gets asked which of the listed + drives to examine more closely. + If a privilege command and optional arguments are given with --priv_cmd, + then this command and arguments are used to launch the xorriso runs. + Command and arguments must be single words and be submitted altogether + as one single argument. On Solaris use: --priv_cmd pfexec + +./manual_burn -x ../xorriso/xorriso [-- [--dev device_file_to_use] + [--priv_cmd 'command [arg [arg ...]]'] + [--what ...directory...] [--any_media]] + Burns the content of the directory given with --what onto re-usable + media: CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE. + Other media types get refused, unless option --any_media is given. + Data, which are possibly present on the media, get overwritten. + The result gets check read and compared with the state of the input + directory. MD5 mismatch causes a test failure. Differences to the directory + state are reported but still regarded as success. + If a privilege command and optional arguments are given with --priv_cmd, + then this command and arguments are used to laynch the xorriso runs. + Command and arguments must be single words and be submitted altogether + as one single argument. On Solaris use: + --priv_cmd pfexec + +./manual_isojigdo -x ../xorriso/xorriso + Exercises the production of a bootable Debian GNU/Linux image and its Jigdo + files. This test downloads a Debian daily image for i386 of about 70 MB, + extracts its content and composes a new image. Thus it needs about 250 MB + of disk space in releng/releng_generated_data. + This test will only work with GNU xorriso or if libjte was installed already + when libisofs was built. Further it needs the program jigit-mkimage. Both + are part of package jigit, version >= 1.18, available at: + http://www.einval.com/~steve/software/JTE/ + Currently jigit builds only in GNU environments. + + +Any auto_* script can be run on its own. Some of them demand option -x. +All general options are accepted. + +./auto_cxx + Exercises inclusion of xorriso/xorriso.h and libisoburn/libisoburn.h + in C++ programs and linking of the libraries. It might be necessary + to set compiler options by shell variable CFLAGS before running the test. + It might be necessary to hand over the install directory of libburn and + libisofs in shell variable LD_LIBRARY_PATH. + E.g. if on FreeBSD the include headers libisofs.h , libburn.h are not found: + export CFLAGS="-I/usr/local/include" + E.g. on GNU/Hurd, where libburn and libisofs are not found by the linker: + export LD_LIBRARY_PATH="/usr/local/lib" + +./auto_isocontent -x ../xorriso/xorriso + Tests whether xorriso is able to record and restore two familes of + hard links. + +./auto_printsize -x ../xorriso/xorriso + Tests how long xorriso needs to compose a medium sized directory tree. + If programs mkisofs and/or genisomage are availaible, then the same test + is done with them. + + +---------------------------------------------------------------------------- + + What to do with FAIL results + +The text output of the automatic tests is recorded in file + releng_generated_data/log.run_all_auto + +Script ./run_all_auto will detect failure of perticular tests and report +lines from the log file which contain problem indicating keywords: + NEVER,ABORT,FATAL,FAILURE,MISHAP,SORRY,WARNING,HINT,FAIL,ERROR,WRONG + +If the program messages in log.run_all_auto do not explain the failure, +please contact mailing list libburn-hackers@pykix.org . + + +---------------------------------------------------------------------------- + + Alternative Shells + +If you decided against installing /bin/bash, you may try to use your +current $SHELL by running + ./change_shell_to_use +which will modify the test scripts named run_all_auto , auto_* ,manual_*. + +Known to be suitable are the following shells + GNU/Linux: /bin/bash + FreeBSD 8: /bin/sh + Solaris: /bin/bash , /bin/i86/ksh93 + +The script does not choose an interpreter explicitely and is safe to be run +inline: + . ./change_shell_to_use +One may set any interpreter path by running a sub shell and changing its +variable SHELL. E.g. by: + ( SHELL=/bin/my_shell" ; . ./change_shell_to_use ) + + +---------------------------------------------------------------------------- + + Creating a new test script + +If you want to provide an own test, manual or auto, then first invent a name +for it + test_name="releng/manual_"...some.name... +or + test_name="releng/auto_"...some.name... +Then copy file releng/template_new to $test_name. +Edit $test_name and process any line that begins by "# === TEMPLATE:". +Do what the line prescribes and then remove it from the script. You are +not done as long as such a line remains. + +Your test must not start if no file + ./inc/releng_getopts.inc +exists, i.e. if the current working directory is not ./releng. +If your test creates own files on disk, then it must do this underneath +directory + ./releng_generated_data/$test_name (resp. $GEN_DATA_DIR, see below). + +In case of failure, issue a line to stdout that begins by the word "FAIL", +followed by " : " and the name of the test (e.g. $SELF, see below). +Make sure that the test script finally returns a non-zero exit value. +This value should be between 1 and 28. Each type of failure should have its +own exit value. +Predefined are: + 31 = Unknown option or unusable argument with known option + 30 = Unexpected state of own directory for self generated files + 29 = Not in ./releng directory or missing essential parts of ./releng + +When exiting prematurely, make sure to call function cleanup. + + + Variables, general options, helper functions + +The code piece inc/releng_getopts.inc should get executed inline at the +start of a test script. +It initializes the following variables and sets some of them according +to the general options of the test suite: + + SELF basename $0 + + GEN_DATA_DIR releng_generated_data/${SELF} + + RELENG_XORRISO Path to xorriso binary. "" or "0" means no xorriso. + Default "0". Adjustable by option -x. + + SIMULATE_FAILURE 0=normal operation, 1=test script shall simulate a failure. + Default 0. Setable to 1 by option -f. + + CLEANUP 0=do not cleanup temporary data, 1=normal operation + Default 1. Setable to 0 by option -k. + + SPECIFIC_HELP 0=normal operation, 1=print help text of script and exit 0 + Default 0. Setable to 1 by option -h + +The code piece inc/releng_getopts.inc defines the following functions +for use by the single tests: + + print_help Prints the help text for general options. + + check_for_xorriso [-x] + Will exit with value 31 if no path to a xorriso binary + was defined by option -x of ./run_all_auto or a single + test. + Option -x of check_for_xorriso additionally tests whether + the given path leads to an executable program. + + cleanup Removes the directory tree GEN_DATA_DIR after making + some safety checks. + + boldify Try to set the terminal mode for future output to a more + noticable style of writing. + unboldify Reset terminal mode to normal style of writing. + + + Specific options + +Options which are specific to the test should begin with a double dash. +They may have further arguments. +Implement them in the prepared interpreter loop which begins after line + next_is=ignore + +Specific options shall only be interpreted by tests which get run manually. +If you plan to introduce a specific option, look at the description of +existing tests whether one of them would match your needs. In that case, +please re-use the name of that existing option. + diff --git a/libisoburn/branches/1.1.8/releng/TODO b/libisoburn/branches/1.1.8/releng/TODO new file mode 100644 index 00000000..f5fc4dcf --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/TODO @@ -0,0 +1,47 @@ + +* Manpage examples turned into tests + Convert most examples from xorriso(1) manpage into tests. + +* Enhance 'auto_isocontent' + Extend it to use some more demanding directory tree. + MD5s should be checked. + All file types as of stat(2) should be tested. + Test various comparisons: + xorriso provides built-in means for comparison: + xorriso -compare_r disk_path iso_rr_path + xorriso -indev my.iso -find / vs. find input_dir + bsdtar -xf my.iso vs. input_dir + +* Test for wrong CD sizes would need a new test and probably an + automatic CD changer. + +* Library unit tests - investigate the possibility to write some + cunit-based tests (http://cunit.sourceforge.net) for both + xorriso.h and libisoburn.h API's. The code samples could be put into + codesamples/ directory and run by auto_cxx or a separate auto_ script. + +* ??? Still to decide: + Delete debian-testing-i386-businesscard.iso with ./run_all_auto -c + Contra: Currently remaining large files (like downloaded ISO images) are + simply left behind to be re-used and a boldified info message is shown + so the users can decide for themselves what to remove or leave as well. + Pro: Leaving 70 MB of image is quite obtrusive. Option -c is not run + under normal circumstances. So it could well be used for total cleanup. + Alternative: Specific option --remove_image. + +* ??? Still to decide: + Have a script ./run_all_manual + Contra argument: if a releng sctipt is suitable to be run under a master + script run_all*, then this releng script should be put into auto_* + namespace , otherwise it is manual_*. + Pro: Tests may be manual because they demand lots of resources, not + because they need manual attention. In general the run_all_manual script + shall spare the user the plight to read the documentation. Instead it + shall present the manual tests, give an opportunity to skip the test, + and ask for parameters, + +* derive a GNU xorriso test suite from libisoburn test suite + +* auto_ tests should know whether they work underneath run_all_auto + or whether they run standalone + diff --git a/libisoburn/branches/1.1.8/releng/auto_cxx b/libisoburn/branches/1.1.8/releng/auto_cxx new file mode 100755 index 00000000..c26c07b3 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/auto_cxx @@ -0,0 +1,88 @@ +#!/bin/bash + +# Copyright 2011 George Danchev +# Licensed under GNU GPL version 2 or later + +set -e + +not_in_releng_exit() { + printf "\nPlease execute the tests from releng directory.\n\n" + exit 1 +} + +. inc/releng_getopts.inc || not_in_releng_exit + +print_specific_help() { +cat << HLP +Specific options: + none yet. +Overview: + Tests both xorriso/xorriso.h and libisoburn/libisoburn.h + APIs for C++ cleanness. +HLP +} + +if test "$SPECIFIC_HELP" = 1; then + print_specific_help + exit 0 +fi + +# xorriso binary is not needed for that particular test +SAMPLE_CODE_DIR=codesamples +CC=g++ + +# check compiler +if ! which "${CC}" >/dev/null 2>&1; then + printf "\n${SELF}: Not found: ${CC}. Install ${CC}.\n" + cleanup + exit 5 +fi + +# check data dir +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} + printf "\n${SELF}: use '${SELF} -c' to remove.\n" + exit 6 +else + mkdir "${GEN_DATA_DIR}" +fi + +# process sample code tests +# if test -f "${SAMPLE_CODE_DIR}"/*.cpp; then + for SMPL in `ls "${SAMPLE_CODE_DIR}"/*.cpp`; do + CMD_CPL="${CC} -I../ -L ../libisoburn/.libs/ ${CFLAGS} -lisoburn -o ${SMPL}.obj ${SMPL}" + printf "${SELF}: ${CMD_CPL}\n" + set +e + ${CMD_CPL} + RET_CPL="$?" + if [ ${RET_CPL} = 0 -a -f ${SMPL}.obj ]; then + mv ${SMPL}.obj ${GEN_DATA_DIR} + else + printf "\nFAIL : ${SELF}: Compilation of ${SMPL}\n" + cleanup + exit 7 + fi + BASE=$(basename ${SMPL}.obj) + printf "${SELF}: Running LD_LIBRARY_PATH=../libisoburn/.libs/:${LD_LIBRARY_PATH} ${GEN_DATA_DIR}/${BASE}" + LD_LIBRARY_PATH=../libisoburn/.libs/:${LD_LIBRARY_PATH} ${GEN_DATA_DIR}/${BASE} + RET_SMPL="$?" + case ${RET_SMPL} in + 0) + printf "...ok\n" + ;; + *) + printf "exit code: ${RET_SMPL}\n" + cleanup + exit 8 + ;; + esac + set -e + done +#else +# printf "\n${SELF}: No C++ code samples found in ${SAMPLE_CODE_DIR}\n" +#fi + +# clean +cleanup + +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/auto_isocontent b/libisoburn/branches/1.1.8/releng/auto_isocontent new file mode 100755 index 00000000..af1f4c62 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/auto_isocontent @@ -0,0 +1,393 @@ +#!/bin/bash + +# Copyright 2011 Thomas Schmitt +# Copyright 2011 George Danchev +# Licensed under GNU GPL version 2 or later + +# Test the correct handling of hardlinks by xorriso options +# -update_r , -hardlinks perform_update , and -extract +# If there is support for ACLs or xattr in xorriso and on the local system, +# then test recording and restoring of these features. + +not_in_releng_exit() { + printf "\nPlease execute the tests from releng directory.\n\n" + exit 1 +} + +. inc/releng_getopts.inc || not_in_releng_exit + +print_specific_help() { +cat << HLP +Specific options: + none yet. +Overview: + Tests ISO image contents by performing various + image generation, extractions and comparisons. +HLP +} + +if test "$SPECIFIC_HELP" = 1; then + print_specific_help + exit 0 +fi + +if [ ! -x $RELENG_XORRISO ]; then + print_help + printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" + exit 31 +fi + +# check data dir, if any and after checking -x xorriso +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} + printf "\n${SELF}: use '${SELF} -c' to remove.\n" + exit 8 +else + mkdir "${GEN_DATA_DIR}" +fi + +export xorriso=${RELENG_XORRISO} +export workdir=${GEN_DATA_DIR} +export image_file="$workdir"/xorriso_hardlinks.iso +export on_disk="$workdir"/xorriso_hardlinks_test_dir +export in_iso="" +export copy_on_disk="$workdir"/xorriso_hardlinks_copy_dir +export failure=0 +export simulate_failure=${SIMULATE_FAILURE} +export next_is_xorriso=0 +export next_is_rc=0 +export bad=0 +export report_about="-report_about UPDATE" + +test -z "$in_iso" && in_iso="$on_disk" + +# mkdir "$workdir" || bad=1 +mkdir "$on_disk" || bad=1 +if test "$bad" = 1 +then + echo -e "\nFAIL : ${SELF} : Test environment error : Cannot make directories" + exit 3 +fi + + +# All must be set at this point +printf "\n${SELF}: Setting up $on_disk with several hardlinks\n" >&2 +echo test_content >"$on_disk"/file_1 || exit 1 +echo test_content >"$on_disk"/file_2 || exit 1 +ln "$on_disk"/file_1 "$on_disk"/file_1_link_a || exit 1 +ln "$on_disk"/file_1 "$on_disk"/file_1_link_b || exit 1 +ln "$on_disk"/file_2 "$on_disk"/file_2_link_a || exit 1 + +# trivial ISO 9660 image validation routine +is_valid_iso9660() { + ISOfile="$1" + if [ ! -f ${ISOfile} ]; then + failure=1 + printf "\nFAIL : ${SELF} : Not found: ${ISOfile}\n" + fi + file ${ISOfile} + if file ${ISOfile} | grep "ISO *9660" >/dev/null 2>&1; then + printf "\n${SELF}: Resulting ${ISOfile} OK. Looks like ISO 9660 filesystem.\n" + else + failure=1 + printf "\nFAIL : ${SELF} : ${ISOfile} DOES NOT look like ISO 9660 filesystem data.\n" + fi +} + +# Retrieve and evaluate return value of command run under return_wrapper +check_xorriso_return() { + ret=$(cat "$return_value_file") + rm "$return_value_file" + if test "$ret" = 0 + then + return 0 + fi + failure=1 + echo + echo "FAIL : ${SELF} : xorriso run exited with value $ret" + return 1 +} + +# Create test file and find out whether ACLs and/or xattr are available. +# +# Users known on GNU/Linux and FreeBSD: root games daemon man +# Groups : daemon games bin sshd sys +# On both systems, ACLs are manipulated by setfacl/getfacl +# +acl_xattr_test_file="$on_disk"/acl_xattr_test_file +acl_xattr_copy_file="$copy_on_disk"/acl_xattr_test_file +acl_xattr_test_dir="$on_disk"/acl_xattr_test_dir +acl_xattr_iso_dir="$in_iso"/acl_xattr_test_dir +acl_xattr_copy_dir="$copy_on_disk"/acl_xattr_test_dir +mkdir "$acl_xattr_test_dir" +echo echo hello world >"$acl_xattr_test_file" || exit 1 +sys=$(uname -s) +acls=no +default_acls=no +setfacl_opts="" +if ( setfacl -m u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx \ + "$acl_xattr_test_file" ) >/dev/null 2>&1 +then + if ( getfacl "$acl_xattr_test_file" ) >/dev/null 2>&1 + then + if ( setfacl -m u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx \ + "$acl_xattr_test_dir" ) >/dev/null 2>&1 + then + acls=yes + # Setting of "default" ACLs will fail on FreeBSD. It will nevertheless be + # done in the image by a xorriso command. Restoring is supposed to skip + # "default" ACLs if none could be recorded. + if setfacl -m u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx,d:u::rwx,d:g::r-x,d:o::---,d:u:root:rwx,d:g:sys:rwx,d:u:daemon:r--,d:mask::rwx "$acl_xattr_iso_dir" 2>/dev/null + then + default_acls=yes + fi + setfacl_opts="-setfacl u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx,d:u::rwx,d:g::r-x,d:o::---,d:u:root:rwx,d:g:sys:rwx,d:u:daemon:r--,d:mask::rwx $acl_xattr_iso_dir --" + fi + fi +fi + +# GNU/Linux and FreeBSD have different tools for Extended Attributes +xattrs=no +extattrs=no +# Try GNU/Linux style setattr/getattr +if ( setfattr -n user.test_xattr -v test_value "$acl_xattr_test_file" ) \ + >/dev/null 2>&1 +then + if ( getfattr -d "$acl_xattr_test_file" ) >/dev/null 2>&1 + then + xattrs=yes + setfattr -n user.long_data -v 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file" + setfattr -n user.more_data -v 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file" + fi +fi +if test "$xattrs" = no +then + # Try FreeBSD style setextattr + if ( setextattr user test_xattr test_value "$acl_xattr_test_file" ) \ + >/dev/null 2>&1 + then + if ( getextattr user test_xattr "$acl_xattr_test_file" ) >/dev/null 2>&1 + then + setextattr user long_data 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file" + setextattr user more_data 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file" + if ( lsextattr user "$acl_xattr_test_file" ) >/dev/null 2>&1 + then + extattrs=yes + fi + fi + fi +fi + +echo +echo "${SELF}: Detected sys='$sys' , acls=$acls , d_acls=$default_acls , xattrs=$xattrs , extattrs=$extattrs" + +# Examine capabilities of xorriso +xorriso_acls=no +xorriso_xattrs=no +extras=$("$xorriso" -list_extras all 2>/dev/null) +if test "$?" = 0 +then + if echo "$extras" | fgrep 'Local ACL : yes' >/dev/null 2>&1 + then + xorriso_acls=yes + fi + if echo "$extras" | fgrep 'Local xattr : yes' >/dev/null 2>&1 + then + xorriso_xattrs=yes + fi +fi +if test "$xorriso_acls" = no +then + acls=no + setfacl_opts= +fi +if test "$xorriso_xattrs" = no +then + xattrs=no + extattrs=no +fi + +echo "${SELF}: Detected xorriso_acls=$xorriso_acls , xorriso_xattrs=$xorriso_xattrs" +echo +ls -l "$on_disk"/* + +echo -e "\n${SELF}: Producing simple image via -o" >&2 +"$xorriso" -as mkisofs "$on_disk" -o "$workdir"/image_minus_o.iso +is_valid_iso9660 "$workdir"/image_minus_o.iso + +echo -e "\n${SELF}: Producing simple image via redirect" >&2 +"$xorriso" -as mkisofs "$on_disk" > "$workdir"/image_redirected.iso +is_valid_iso9660 "$workdir"/image_redirected.iso + +echo -e "\n${SELF}: Producing simple image via pipe" >&2 +return_wrapper "$xorriso" -as mkisofs "$on_disk" | \ + cat > "$workdir"/image_piped.iso +check_xorriso_return +is_valid_iso9660 "$workdir"/image_piped.iso + +echo -e "\n${SELF}: Producing simple image with for_backup/update_r/hardlinks" >&2 +"$xorriso" \ + $report_about \ + -version \ + -for_backup \ + -padding 0 \ + -outdev "$image_file" \ + -volid TEST_AUTO_ISOCONTENT \ + -update_r "$on_disk" "$in_iso" \ + $setfacl_opts \ + -hardlinks perform_update +ret=$? + +if test "$ret" -gt 0 -a "$ret" -lt 32 +then + printf "\nFAIL : ${SELF} : xorriso write run failed\n\n" + cleanup + exit 1 +fi +is_valid_iso9660 "$image_file" + + +# It must refuse to load and go on with -assert_volid and non-matching pattern. +msg=$(\ +"$xorriso" \ + -abort_on FATAL \ + -return_with FAILURE 32 \ + -assert_volid 'NON_MATCHING*' FATAL \ + -indev "$image_file" \ + 2>&1 +) +ret=$? +if test "$ret" -gt 0 -a "$ret" -lt 32 +then + printf "\n${SELF}: Ok. -assert_volid snapped.\n" +elif test "$ret" -ne 0 +then + failure=1 + echo >&2 + echo "$msg" >&2 + printf "\nFAIL : ${SELF} : -assert_volid test not properly performed\n\n" +else + failure=1 + printf "\nFAIL : ${SELF} : -assert_volid did not snap\n\n" >&2 +fi + +echo -e "\n${SELF}: Copying from image to temporary disk tree" >&2 +"$xorriso" \ + $report_about \ + -for_backup \ + -assert_volid 'TEST_AUTO_ISOCONT*' FATAL \ + -indev "$image_file" \ + -osirrox on \ + -find "$in_iso" -exec lsdl -- \ + -extract "$in_iso" "$copy_on_disk" +ret=$? +if test "$ret" -gt 0 -a "$ret" -lt 32 +then + printf "\nFAIL : ${SELF} : xorriso file extraction run failed\n\n" + cleanup + exit 1 +fi + +if test "$simulate_failure" = 1 +then + echo -e "\n${SELF}: SIMULATING FAILURE BY REMOVING AN EXTRACTED FILE" >&2 + echo -e "\nFAIL : ${SELF} : Simulated failure caused by option -fail" + rm "$copy_on_disk"/file_1_link_b +fi + + +printf "\n${SELF}: Comparing original disk tree and temporary one..." >&2 +diff -r "$on_disk" "$copy_on_disk" +if test "$?" -ne 0 +then + echo -e "\nFAIL : ${SELF} : diff -r $on_disk $copy_on_disk reports differences" >&2 + echo -e "\nFAIL : ${SELF} : diff -r reports differences" + failure=1 +else + printf "OK" >&2 +fi + +printf "\n${SELF}: Checking for hardlinks being siblings...\n" +ls -l "$copy_on_disk"/* +x=$(echo $(ls -ld "$copy_on_disk"/*file* | awk '{print $2}')) +expected="1 3 3 3 2 2" +if test x"$x" = x"$expected" +then + printf "${SELF}: Checking for hardlinks being siblings done: ok.\n" >&2 +else + printf "\nFAIL : ${SELF} : Link count of extracted files is not as expected." >&2 + printf "\n${SELF}: Expected: $expected" >&2 + printf "\n${SELF}: Got : $x\n" >&2 + failure=1 +fi + +if test "$acls" = yes +then + printf "\n${SELF}: Checking ACLs ...\n" >&2 + acl_on_disk=$(getfacl "$acl_xattr_test_file" | grep -v '^# file:' | sort) + acl_in_copy=$(getfacl "$acl_xattr_copy_file" | grep -v '^# file:' | sort) + if test "$acl_on_disk" = "$acl_in_copy" + then + printf "${SELF}: Checking ACLs done: ok.\n" >&2 + else + printf "\nFAIL : ${SELF} : ACL mismatch between original and extracted copy\n" + printf "\nOriginal:\n${acl_on_disk}\n" + printf "\nCopy:\n${acl_in_copy}\n" + failure=1 + fi +fi + +if test "$xattrs" = yes +then + printf "\n${SELF}: Checking xattr via getfattr ...\n" >&2 + xattr_on_disk=$(getfattr "$acl_xattr_test_file" | \ + grep -v '^# file:' | grep -v '^$' | \sort) + xattr_in_copy=$(getfattr "$acl_xattr_copy_file" | + grep -v '^# file:' | grep -v '^$' | sort) + if test "$xattr_on_disk" = "$xattr_in_copy" + then + num_xattr=$(echo "$xattr_on_disk" | wc -l) + printf "${SELF}: Checking xattr done: $num_xattr attributes, ok.\n" >&2 + else + printf "\nFAIL : ${SELF} : xattr mismatch between original and extracted copy\n" + printf "\nOriginal:\n${xattr_on_disk}\n" + printf "\nCopy:\n${xattr_in_copy}\n" + failure=1 + fi +elif test "$extattrs" = yes +then + printf "\n${SELF}: Checking xattr via lsextattr and getextattr ...\n" >&2 + lsext_on_disk=$(lsextattr -q user "$acl_xattr_test_file") + xattr_on_disk=$(for i in $lsext_on_disk ; do echo $i $(getextattr -q user $i "$acl_xattr_test_file"); done | sort) + lsext_in_copy=$(lsextattr -q user "$acl_xattr_copy_file") + xattr_in_copy=$(for i in $lsext_in_copy ; do echo $i $(getextattr -q user $i "$acl_xattr_copy_file"); done | sort) + if test "$xattr_on_disk" = "$xattr_in_copy" + then + num_xattr=$(echo "$xattr_on_disk" | wc -l) + printf "${SELF}: Checking xattr done: $num_xattr attributes, ok.\n" >&2 + else + printf "\nFAIL : ${SELF} : xattr mismatch between original and extracted copy\n" + printf "\nOriginal:\n${xattr_on_disk}\n" + printf "\nCopy:\n${xattr_in_copy}\n" + failure=1 + fi + +fi + +# +echo +cleanup + +# Report result +echo +if test "$failure" = 1 +then + printf "${SELF}: FAILED" + echo + exit 1 +else + printf "${SELF}: Passed" + echo +fi + +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/auto_printsize b/libisoburn/branches/1.1.8/releng/auto_printsize new file mode 100755 index 00000000..fd00fab5 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/auto_printsize @@ -0,0 +1,149 @@ +#!/bin/bash + +# Copyright 2011 George Danchev +# Licensed under GNU GPL version 2 or later + +set -e + +not_in_releng_exit() { + printf "\nPlease execute the tests from releng directory.\n\n" + exit 1 +} + +# Include common bits +. inc/releng_getopts.inc || not_in_releng_exit + +print_specific_help() { +cat << HLP +Specific options: + none yet. +Overview: + Test performance of print_size against various input tree. + Optionally compare with genisoimage and mkisofs. +HLP +} + +if test "$SPECIFIC_HELP" = 1; then + print_specific_help + exit 0 +fi + +# Each test should decide whether or not it needs +# a xorriso binary to test, since some do compilations only. +if [ ! -x $RELENG_XORRISO ]; then + print_help + printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" + exit 31 +fi + +# check data dir, if any and after checking -x xorriso +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} + printf "\n${SELF}: use '${SELF} -c' to remove.\n" + exit 8 +else + mkdir "${GEN_DATA_DIR}" +fi + +# +DIR_UPPER=32 +FILE_UPPER=10 + +# All must be set at this point +# TODO: work out a smarter way to quickly generate different +# types of trees (long, deep, etc) +printf "\n${SELF}: Generating sample tree in ${GEN_DATA_DIR} :\n" +count=0 +date + +# Hopefully the for-loops are much faster than while-loops with arithmetics +# This needs 7/4*DIR_UPPER+FILE_UPPER (= 66) while-iterations +# +i1_list= +i1=0 +o1=$(expr ${DIR_UPPER} / 4) +while test $i1 -lt $o1 +do + i1_list="$i1_list $i1" + i1=$(expr $i1 + 1) +done +i2_list= +i2=0 +o2=$(expr ${DIR_UPPER} / 2) +while test $i2 -lt $o2 +do + i2_list="$i2_list $i2" + i2=$(expr $i2 + 1) +done +i3_list= +i3=0 +while test $i3 -lt ${DIR_UPPER} +do + i3_list="$i3_list $i3" + i3=$(expr $i3 + 1) +done +i_file_list= +i_file=0 +while test $i_file -lt ${FILE_UPPER} +do + i_file_list="$i_file_list $i_file" + i_file=$(expr $i_file + 1) +done +# +# plus 1/8*DIR_UPPER*DIR_UPPER*DIR_UPPER*FILE_UPPER (= 40960) for-iterations +# +for i1 in $i1_list +do + for i2 in $i2_list + do + for i3 in $i3_list + do + mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3 + for i_file in $i_file_list + do + echo -n \ + > ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3/File_${i_file} + count=$((count + 1)) + done + done + done + echo " ${count} files created ..." +done + +printf "done.\n" +date +du -s "${GEN_DATA_DIR}" + +printf "\n${SELF}: Performing several print size runs to neutralize possible disk cache impact.\n" + +# run xorriso +if [ -x ${RELENG_XORRISO} ]; then + for run in 1 2 3; do + printf "\n${SELF}: Running ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n" + time ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR} + done +fi + +# try to run genisoimage +if which genisoimage >/dev/null 2>&1; then + RELENG_GENISOIMAGE=`which genisoimage` + for run in 1 2 3; do + printf "\n${SELF}: Running ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n" + time ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR} + done +fi + +# try to run mkisofs +if which mkisofs >/dev/null 2>&1; then + RELENG_MKISOFS=`which mkisofs` + for run in 1 2 3; do + printf "\n${SELF}: Running ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n" + time ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR} + done +fi + +# +cleanup + +# +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/change_shell_to_use b/libisoburn/branches/1.1.8/releng/change_shell_to_use new file mode 100755 index 00000000..341cead6 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/change_shell_to_use @@ -0,0 +1,39 @@ + +# check whether we are in releng and create dir +mkdir_ret=29 +if test -d releng_generated_data +then + if test -d releng_generated_data/change_shell_to_use + then + mkdir_ret=0 + else + mkdir releng_generated_data/change_shell_to_use + mkdir_ret=$? + fi +fi + +if test "$mkdir_ret" = 0 +then + for i in run_all_auto auto_* manual_* + do + temp=releng_generated_data/change_shell_to_use/temp_file + c=$(wc -l "$i" | awk '{print $1}') + line=$(head -n 1 "$i") + + if echo x"$line" | grep '^x#!' >/dev/null 2>&1 + then + cp "$i" "$temp" + echo '#!'"$SHELL" > "$temp" + tail -n "$(expr $c - 1)" "$i" >> "$temp" + mv "$temp" "$i" + echo "Changed to #!$SHELL : $i" + fi + done + rmdir releng_generated_data/change_shell_to_use +else + echo "change_shell_to_use: Missing directory ./releng_generated_data" >&2 + echo "or cannot create directory ./releng_generated_data/change_shell_to_use" >&2 + echo "change_shell_to_use: Run aborted" + test 1 = 0 +fi + diff --git a/libisoburn/branches/1.1.8/releng/codesamples/api_3lib.cpp b/libisoburn/branches/1.1.8/releng/codesamples/api_3lib.cpp new file mode 100644 index 00000000..0bc30919 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/codesamples/api_3lib.cpp @@ -0,0 +1,34 @@ +// Just to ensure we are C++-clean. This should not spit too much noise + +/* Copyright 2011 George Danchev + * Licensed under GNU GPL version 2 + */ + +#if __WORDSIZE == 32 +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#endif + +#include +#include + +extern "C" { +#include +#include +// using namespace burn; +// (this was needed to before rev.4062 of libisoburn) +#include +} + +int main() { + int major=-1, minor=-1, micro=-1; + isoburn_version(&major, &minor, µ); + if (major<0 || minor<0 || micro<0) + return -1; + std::cout + << " major:" << major + << " minor:" << minor + << " micro:" << micro + ; + return 0; +} diff --git a/libisoburn/branches/1.1.8/releng/codesamples/api_xorriso.cpp b/libisoburn/branches/1.1.8/releng/codesamples/api_xorriso.cpp new file mode 100644 index 00000000..07ac5a1c --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/codesamples/api_xorriso.cpp @@ -0,0 +1,30 @@ +// Just to ensure we are C++-clean. This should not spit too much noise + +/* Copyright 2011 George Danchev + * Licensed under GNU GPL version 2 + */ + +#if __WORDSIZE == 32 +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#endif + +#include +#include + +extern "C" { +#include "xorriso/xorriso.h" +} + +int main() { + int major=-1, minor=-1, micro=-1; + Xorriso__version(&major, &minor, µ); + if (major<0 || minor<0 || micro<0) + return -1; + std::cout + << " major:" << major + << " minor:" << minor + << " micro:" << micro + ; + return 0; +} diff --git a/libisoburn/branches/1.1.8/releng/inc/releng_getopts.inc b/libisoburn/branches/1.1.8/releng/inc/releng_getopts.inc new file mode 100644 index 00000000..4a87fb20 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/inc/releng_getopts.inc @@ -0,0 +1,183 @@ +# Copyright 2011 George Danchev +# Copyright 2011 Thomas Schmitt +# Licensed under GNU GPL version 2 or later + +SELF=$(basename $0) +RELENG_XORRISO=0 +SIMULATE_FAILURE=0 +CLEANUP=1 +SPECIFIC_HELP=0 + +START_DIR_DONT_CHANGE=`pwd` +GEN_DATA_DIR=releng_generated_data/${SELF} + +############################################# +print_help() { +cat << EOF + +Usage: $SELF -x path/to/xorriso [-k] [-f] [-c] [-h] + [-- ...test specific options...] +General options: + -x absolute or relative path to xorriso binary to be run. + -k keep self-generated data. + -c cleanup self-generated data kept from previous run and exit. + -f simulate failure. + -h print this help text + -- end of general options, begin of test specific options. +EOF +} + +boldify() { + if which tput >/dev/null 2>&1; then tput smso; fi +} + +unboldify() { + if which tput >/dev/null 2>&1; then tput rmso; fi +} + +############################################# +cleanup() { + if [ ${CLEANUP} -eq 1 ]; then + # safety net, just in case -> we want to be in the starting + # directory before removing whatever self-generated stuff + if [ -d "${GEN_DATA_DIR}" ]; then + cd "${START_DIR_DONT_CHANGE}" || exit 2 + + # Verify once again we are in the releng_generated_data directory + # Check for both returned code of grep and returned matching string + # There is no "readlink -e" on FreeBSD + READ_CANON_EXISTS=`cd "${GEN_DATA_DIR}" 2>/dev/null && pwd` + DIR_NAME_GEN_DATA=`dirname "${READ_CANON_EXISTS}"` + set +e + # There is no "grep -P" on FreeBSD + RET_NON_EMPTY_STRING=`echo "${DIR_NAME_GEN_DATA}" | grep "[a-zA-Z0-9_][a-zA-Z0-9_]*/releng_generated_data$"` + GREP_RET_GEN_DATA="$?" + case "${GREP_RET_GEN_DATA}" in + 0) + if [ x"${RET_NON_EMPTY_STRING}" != x"" ]; then + # now call the nastiness + chmod -R +w ${GEN_DATA_DIR} + rm -rf ${GEN_DATA_DIR} +# boldify + printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR} +# unboldify + else + printf "FAIL : ${SELF} : Safety check for being in releng_generated_data directory.\n" + printf "FAIL : ${SELF} : GREP returned empty string: ${RET_NON_EMPTY_STRING}.\n" + printf "FAIL : ${SELF} : Skipped trying to remove ${GEN_DATA_DIR} directory. Exiting.\n" + fi + ;; + *) + printf "FAIL : ${SELF} : Safety check for being in releng_generated_data directory.\n" + printf "FAIL : ${SELF} : GREP returned code: ${GREP_RET_GEN_DATA}.\n" + printf "FAIL : ${SELF} : Skipped trying to remove ${GEN_DATA_DIR} directory. Exiting.\n" + exit 30 + ;; + esac + else + printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n" + fi + else +# boldify + printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR} +# unboldify + fi +} + +############################################# + +check_for_xorriso() { + # $1: if "-x" then check executability + + if test -z "$RELENG_XORRISO" -o "$RELENG_XORRISO" = "0" + then + print_help +# print_specific_help + echo + echo "${SELF}: Need -x absolute or relative path to xorriso binary." + echo + exit 31 + fi + if [ x"$1" = x"-x" -a ! -x "$RELENG_XORRISO" ] + then + print_help +# print_specific_help + echo + echo "${SELF}: Path given by option -x does not lead to an executable file." + echo "Given is: '$RELENG_XORRISO'" + if test "$RELENG_XORRISO" = "xorriso" + then + xorriso=$(type -p xorriso) + if test -n "xorriso" + then + echo "Hint: Try '$xorriso'" + fi + fi + echo + exit 31 + fi +} + + +############################################# + +# To catch the exit value of a command in a pipe +return_value_file="$GEN_DATA_DIR"/wrapper_"$$"_return_value +return_wrapper() +{ + cmd="$1" + shift 1 + "$cmd" "$@" + RET="$?" + echo "$RET" >"$return_value_file" + return "$RET" +} + +############################################# + +next_is= +for i in "$@" +do + if test "$next_is" = "ignore" + then : + elif test "$next_is" = "x" + then + RELENG_XORRISO="$i" + next_is= + elif test x"$i" = x"-x" + then + next_is="x" + elif test x"$i" = x"-k" + then + CLEANUP=0 + elif test x"$i" = x"-c" + then + CLEANUP=1 + cleanup + exit 0 + elif test x"$i" = x"-f" + then + SIMULATE_FAILURE=1 + elif test x"$i" = x"-h" + then + print_help + SPECIFIC_HELP=1 + elif test x"$i" = x"--" + then + # Begin of private arguments for caller + next_is="ignore" + else + echo >&2 + echo "Unknown general option: $i" >&2 + print_help + exit 31 + fi +done + +if test "$next_is" = x +then + echo >&2 + echo "Option -x expects an argument (the path to the xorriso program)" >&2 + print_help + exit 31 +fi diff --git a/libisoburn/branches/1.1.8/releng/inc/test_releng_getopt b/libisoburn/branches/1.1.8/releng/inc/test_releng_getopt new file mode 100755 index 00000000..740faf16 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/inc/test_releng_getopt @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +. releng_getopts.inc + +boldify +printf "\ntesting boldify and unboldify..." +unboldify + +printf "\nSELF =${SELF}" +printf "\nRELENG_XORRISO =${RELENG_XORRISO}" +printf "\nSIMULATE_FAILURE =${SIMULATE_FAILURE}" +printf "\nCLEANUP =${CLEANUP}" +printf "\nSPECIFIC_HELP =${SPECIFIC_HELP}" +printf "\nSTART_DIR_DONT_CHANGE =${START_DIR_DONT_CHANGE}" +printf "\nGEN_DATA_DIR =${GEN_DATA_DIR}" +printf "\n" + +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/jigdo-gen-md5-list b/libisoburn/branches/1.1.8/releng/jigdo-gen-md5-list new file mode 100755 index 00000000..381c441b --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/jigdo-gen-md5-list @@ -0,0 +1,175 @@ +#!/bin/sh + +# Copyright (c) 2010, 2011 George Danchev +# Copyright (c) 2010, 2011 Thomas Schmitt +# This script is distributed according to the terms of the GNU GPL v2. +# This should be better rewritten in C at some future point. Ref: pwd code. + +# Create a list of MD5sums encoded in hexidecimal format and print to standard output + +# Format Description +# A line in the emerging file is to be composed as follows: +# +# The MD5 checksum of the file content must be encoded in 32 hex digits +# [0-9afAF] +# +# Next come two blanks. +# +# The byte size of the file content must be encoded in 12 decimal digits +# or blanks. +# +# Next come two blanks. +# +# The rest of the line up to the newline character is a semi-literal file +# address. Its basename has to be the same as the basename of the data file +# when it is used as one of the input files for the jigdo file generator. + +# The semi-literal address and the address mapping define what will be +# listed as file address in the jigdo file. +# The address may bear at its start a literal text that shall be recognized by +# the address mapping (e.g. -jigdo-map) of the jigdo file generator. +# The rest of the address must be usable as file address in both situations: +# When the jigdo file gets generated, and when the jigdo file gets read +# to inflate the template file into the original payload image. +# The address mappings at both occasions can be used to adapt to a change +# of the absolute location of the listed files. +# Between both mappings, the parent directory is represented by a symbolic +# text, like "Debian:". + +# A simple strategy to cope with this is to write absolute paths into the +# .md5 file, and to use matching absolute paths in the -jigdo-map +# directives. Keep in mind that mapping is purely literal. Symbolic links +# are neither resolved nor can they confuse the mapping. + +set -e + +SELF=jigdo-gen-md5-list +VER=0.2 + +OPT_ABSOLUTE=1 + +# On FreeBSD there is "md5" rather than "md5sum". +# Furthermore, the FreeBSD shell reports missing commands to inherited stderr, +# regardless that the attempt itself has redirected stderr. Thus a sub shell +# is needed to hide the protest. +if ( md5sum --help ) >/dev/null 2>&1 +then + md5_cmd=md5sum +elif ( md5 -s test ) >/dev/null 2>&1 +then + md5_cmd=md5 +else + echo "$0 : Programs md5sum and md5 failed to work" >&2 + exit 2 +fi + +usage() { + cat << USAGE +usage: $SELF [option] DIR FILE ... + -a, --make-absolute make absolute paths, avoiding any symlinks (default) + -l, --keep-literal leave paths untouched, literally as supplied + -v, --version print version + -h, --help print help + -e, --examples print examples +USAGE +} + +examples() { + cat << EXAMPLES +examples: + $SELF datadir datafile + $SELF --keep-literal datadir datafile + find . -type f | xargs $SELF + find . -exec $SELF '{}' ';' +EXAMPLES +} + +md5list() { + item="$1" + if test $OPT_ABSOLUTE -eq 1; then + dn=`dirname "$item"` # dirname + fn=`basename "$item"` # filename + od=`pwd -P` # old dir + cd "$dn" || exit 1 + item=`pwd -P`/"$fn" # absolute physical file path, avoiding all symlinks + cd "$od" || exit 1 + fi + if test "$md5_cmd" = "md5sum" + then + MD5=`md5sum "$item" | awk '{print $1}'` + elif test "$md5_cmd" = "md5" + then + MD5=`md5 -q "$item"` + else + echo "$0 : No MD5 program found" >&2 + exit 2 + fi + SIZ=`ls -ld "$item" | awk '{print $5}'` + printf '%32s %12s %s\n' "$MD5" "$SIZ" "$item" +} + +walkdir() { + DR="$1" + for item in `find "$DR" -type f` + do + md5list "$item" + done +} + + +# main() +if test "$1" = "" ; then + usage + exit 1 +fi + +case "$1" in + --make-absolute|-a) + OPT_ABSOLUTE=1; + shift; + ;; + --keep-literal|-l) + OPT_ABSOLUTE=0; + shift; + ;; + --version|-v) + printf '%s %s\n' "$SELF" "$VER" + exit 0 + ;; + --help|-h) + usage + exit 0 + ;; + --examples|-e) + examples + exit 0 +# *) +# usage +# exit 1 +# ;; +esac + +for i in "$@" +do + + if test -d "$i" ; then + DR="$i" + if test $OPT_ABSOLUTE -eq 1; then + od=`pwd -P` # old dir + cd "$DR" || exit 1 + DR=`pwd -P` # absolute physical dir path, avoiding all symlinks + cd "$od" || exit 1 + fi + walkdir "$DR" + elif test -f "$i" ; then + FL="$i" + md5list "$FL" + else + usage + exit 1 + fi; + +done + +exit 0 + diff --git a/libisoburn/branches/1.1.8/releng/jigdo-gen-md5-list.1 b/libisoburn/branches/1.1.8/releng/jigdo-gen-md5-list.1 new file mode 100644 index 00000000..ae6ff061 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/jigdo-gen-md5-list.1 @@ -0,0 +1,30 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. +.TH JIGDO-GEN-MD5-LIST "1" "October 2010" "jigdo-gen-md5-list 0.1" "User Commands" +.SH NAME +jigdo-gen-md5-list \- create a list of MD5sums encoded in hexidecimal format and print to standard output +.SH DESCRIPTION +usage: jigdo\-gen\-md5\-list [option] DIR FILE ... +.TP +\fB\-a\fR, \fB\-\-make\-absolute\fR +make absolute paths, avoiding any symlinks (default) +.TP +\fB\-l\fR, \fB\-\-keep\-literal\fR +leave paths untouched, literally as supplied +.TP +\fB\-v\fR, \fB\-\-version\fR +print version +.TP +\fB\-h\fR, \fB\-\-help\fR +print help +.TP +\fB\-e\fR, \fB\-\-examples\fR +print examples +.SH FORMAT + +File format is described in the beginning of the script itself. + +.SH "SEE ALSO" +xorriso(1), jigdo-lite(1), jigit-mkimage(1) + +.SH AUTHOR +Written by George Danchev and Thomas Schmitt diff --git a/libisoburn/branches/1.1.8/releng/manual_burn b/libisoburn/branches/1.1.8/releng/manual_burn new file mode 100755 index 00000000..aabb87b1 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/manual_burn @@ -0,0 +1,256 @@ +#!/bin/bash + +# Copyright 2011 George Danchev +# Copyright 2011 Thomas Schmitt +# +# Licensed under GNU GPL version 2 or later + +set -e +# set -x + +print_specific_help() { +cat << HLP +Specific options: + --dev path use path as drive address. Default: /dev/cdrw + --what path use path as address of the directory which shall + be copied into an ISO 9660 filesystem on media. + --any_media allow non re-usable MMC media, like CD-R or DVD+R. + Allow paths to non-existing files, but disallow paths + to existing regular files. + --priv_cmd 'command [arg [arg ...]]' + With drive operations execute xorriso as argument + of the given command (e.g. pfexec, sudo) with the + optionally given arguments: command arg arg xorriso ... + Command and arguments must be single words. +Overview: + Test burning to re-usable media CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE. + By default, one-time usable media will be rejected deliberately. +HLP +} + +wait_for_dev () { +# $1 = device address + timeout=30 + counter=0 + + while test "$counter" -lt "$timeout" + do + if test -e "$1" + then + echo + return 0 + fi + if test "$counter" = 0 + then + echo + echo "Not existing: $dev" + echo "Will wait up to $timeout seconds for it to appear." + fi + counter=$(expr $counter + 1) + echo -n "$counter " + sleep 1 + done + echo + return 1 +} + +getopts_inc=inc/releng_getopts.inc +if test -e "$getopts_inc" +then + . "$getopts_inc" + if test "$SPECIFIC_HELP" = 1 + then + print_specific_help + exit 0 + fi +else + echo >&2 + echo "File not found: $getopts_inc" >&2 + echo "Are we in the ./releng directory of a libisoburn SVN checkout ?" >&2 + echo "(Please execute the tests from that ./releng directory.)" >&2 + echo >&2 + exit 29 +fi + +# Set default values for specific option variables. +dev=/dev/cdrw +what=../xorriso +any_media=0 +priv_cmd= +# Interpret specific options, they begin after the first --. +next_is=ignore +for i in "$@" +do + if test "$next_is" = "ignore" + then + if test "$i" = "--" + then + next_is="" + fi + elif test "$next_is" = "dev" + then + dev="$i" + next_is="" + elif test "$next_is" = "what" + then + what="$i" + next_is="" + elif test "$next_is" = "priv_cmd" + then + priv_cmd="$i" + next_is="" + elif test "$i" = "--dev" + then + next_is="dev" + elif test "$i" = "--what" + then + next_is="what" + elif test "$i" = "--any_media" + then + any_media=1 + elif test "$i" = "--priv_cmd" + then + next_is="priv_cmd" + else + echo >&2 + echo "Unknown test specific option: $i" >&2 + print_help + print_specific_help + exit 31 + fi +done + + +check_for_xorriso -x + + +# check data dir, if any and after checking -x xorriso +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} + printf "\n${SELF}: use '${SELF} -c' to remove.\n" + exit 30 +else + mkdir "${GEN_DATA_DIR}" +fi + + +##################################################################### + +# Inspect drive address +if test -e "$dev" +then + if test "$any_media" = 1 -a -f "$dev" + then + echo "FAIL : ${SELF} : --dev $dev leads to an existing regular file" + echo + cleanup + exit 31 + fi +else + if test "$any_media" = "0" + then + echo "FAIL : ${SELF} : --dev $dev does not lead to an existing file" + echo + cleanup + exit 31 + fi +fi + +# Inspect media +set +e +wait_for_dev "$dev" +res=$(${priv_cmd} "$RELENG_XORRISO" -outdev "$dev" 2>&1) +ret=$? +set -e +if test "$ret" -ne 0 +then + echo "$res" >&2 + echo "FAIL : ${SELF} : Non-zero exit value $ret with: ${priv_cmd} $RELENG_XORRISO -outdev $dev" + echo + cleanup + exit 1 +elif echo "$res" | grep '^Media current:' >/dev/null 2>&1 +then + media=$(echo "$res" | grep '^Media current:' | \ + sed -e 's/^Media current: //') + echo "Detected media: '$media'" + if test "$media" = "CD-RW" -o "$media" = "DVD-RW sequential recording" -o \ + "$media" = "DVD-RW restricted overwrite" -o "$media" = "DVD-RAM" -o \ + "$media" = "DVD+RW" -o "$media" = "BD-RE" + then + echo "Recognized as re-usable." + elif test "$media" = "is not recognizable" + then + echo "FAIL : ${SELF} : No recognizable media detected in: '$dev'" + echo + cleanup + exit 2 + elif test "$any_media" = 1 + then + echo "Accepted media only because of option --any_media : '$media'" + else + echo "FAIL : ${SELF} : No re-usable media detected, but: '$media'" + echo + cleanup + exit 2 + fi +fi + +# Perform burn run +echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test +set +e +wait_for_dev "$dev" +${priv_cmd} "$RELENG_XORRISO" \ + -for_backup \ + -outdev "$dev" \ + -blank as_needed \ + -map "$what" /test +ret=$? +set -e +if test "$ret" -ne 0 +then + echo "FAIL : ${SELF} : Non-zero exit value with burn run: $ret" + echo + cleanup + exit 1 +fi + +if test "$SIMULATE_FAILURE" = 1 +then + echo "FAIL : ${SELF} : Simulated failure caused by option -f" + if test -f "$dev" + then + # Alter image + dd if=/dev/urandom bs=2K count=1 \ + of="$dev" conv=notrunc seek=400 + else + cleanup + exit 1 + fi +fi + +# Check read +echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -indev "$dev" \ + -check_media event=FATAL -- \ -check_md5_r FATAL / -- +set +e +wait_for_dev "$dev" +${priv_cmd} "$RELENG_XORRISO" \ + -for_backup \ + -indev "$dev" \ + -print '---check_media:' -check_media event=FATAL -- \ + -print '---check_md5_r:' -check_md5_r FATAL / -- \ + -print '---compare_r:' -md5 off -compare_r "$what" /test +ret=$? +set -e +if test "$ret" -ne 0 +then + echo "FAIL : ${SELF} : Non-zero exit value with checkread run: $ret" + echo + cleanup + exit 1 +fi + +echo "Ok. Burn test passed." +echo +cleanup +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/manual_devices b/libisoburn/branches/1.1.8/releng/manual_devices new file mode 100755 index 00000000..8b576635 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/manual_devices @@ -0,0 +1,188 @@ +#!/bin/bash + +# Copyright 2011 George Danchev +# Copyright 2011 Thomas Schmitt +# Licensed under GNU GPL version 2 or later + +# set -e + +print_specific_help() { +cat << HLP +Specific options: + --dev path Suppress dialog and use path as drive address. + --priv_cmd 'command [arg [arg ...]]' + With drive operations execute xorriso as argument + of the given command (e.g. pfexec, sudo) with the + optionally given arguments: command arg arg xorriso ... + Command and arguments must be single words. +Overview: + Test device scanning and list of speeds. +HLP +} + +# Include common bits and interpret general options +getopts_inc=inc/releng_getopts.inc +if test -e "$getopts_inc" +then + . "$getopts_inc" + + if test "$SPECIFIC_HELP" = 1 + then + print_specific_help + exit 0 + fi +else + echo >&2 + echo "File not found: $getopts_inc" >&2 + echo "Are we in the ./releng directory of a libisoburn SVN checkout ?" >&2 + echo "(Please execute the tests from that ./releng directory.)" >&2 + echo >&2 + exit 2 +fi + +# Interpret private options, they begin after the first --. +dev= +priv_cmd= +next_is=ignore +for i in "$@" +do + if test "$next_is" = "ignore" + then + if test "$i" = "--" + then + next_is="" + fi + elif test "$next_is" = "dev" + then + dev="$i" + next_is="" + elif test "$next_is" = "priv_cmd" + then + priv_cmd="$i" + next_is="" + elif test "$i" = "--dev" + then + next_is="dev" + elif test "$i" = "--priv_cmd" + then + next_is="priv_cmd" + else + echo >&2 + echo "Unknown test specific option: $i" >&2 + print_help + print_specific_help + exit 31 + fi +done + +# Insist in having a xorriso +check_for_xorriso -x + +has_device_links=$("$RELENG_XORRISO" -help 2>/dev/null | fgrep ' -device_links') +if test -n "$has_device_links" +then + devices_opt="-device_links" +else + devices_opt="-devices" +fi + +# +get_speeds() { + echo -e "\n${SELF}: Running: ${priv_cmd} ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds" + ${priv_cmd} "$RELENG_XORRISO" -report_about WARNING -outdev "$1" \ + -print '---toc :' -toc \ + -print '---list_formats :' -list_formats \ + -print '---list_profiles :' -list_profiles out \ + -print '---list_speeds :' -list_speeds +} + +cat_var() { +# $1 = variable to put out with line feeds +cat <<+ +$1 ++ +} + +get_devices() { + # $1 = if not empty: device lines from xorriso -devices or -device_links + # $2 = if not empty: suppress dialog and use $2 as input + + if test -n "$1" + then + DEVICES="$1" + else + DEVICES=$( ${priv_cmd} "$RELENG_XORRISO" $devices_opt 2>/dev/null | grep "\-dev") + fi + NUM_DEV=$(cat_var "$DEVICES" | wc -l) + case "${NUM_DEV}" in + 0) + echo -e "\n${SELF}: No drives found." + exit 1 + ;; + 1) + echo -e "\n${SELF}: 1 drive found:\n" + ;; + *) + echo -e "\n${SELF}: ${NUM_DEV} drives found:\n" + ;; + esac + echo ================================================================= + echo "$DEVICES" + echo ================================================================= + + OUTDEV=$( cat_var "$DEVICES" | head -1 | \ + sed -e "s/[0-9] *-dev '\//\//" -e "s/'.*$//" ) + if test -n "$2" + then + x="$2" + else + echo >&2 + echo "WARNING: The following tests might pull in the drive tray." >&2 + echo " Best is if you now put in a suitable media and" >&2 + echo " load it manually, so nobody gets surprised. :))" >&2 + echo >&2 + echo "Which drive to examine ? (Empty input = ${OUTDEV})" >&2 + read x + fi + if test -n "$x" + then + OUTDEV="$x" + fi + + get_speeds "$OUTDEV" +} + +# main +"$RELENG_XORRISO" -version +echo -e "\n${SELF}: Running: $RELENG_XORRISO $devices_opt ..." +devices=$( ${priv_cmd} "$RELENG_XORRISO" -report_about WARNING $devices_opt | grep "\-dev") +RET="$?" +if test "$SIMULATE_FAILURE" = 1 +then + echo "===" >&2 + echo "=== SIMULATING FAILURE BY OVERRIDING EXIT VALUE OF XORRISO" >&2 + echo "===" >&2 + echo "FAIL : ${SELF} : Simulated failure caused by option -f" + RET=1 +fi +case ${RET} in + 0) + get_devices "$devices" "$dev" + RET="$?" + if test "$RET" = 0 + then : + else + echo "FAIL : ${SELF} : Device scan or single drive listing failed" + exit "$RET" + fi + ;; + *) + boldify + echo -ne "\n${SELF}: ${priv_cmd} ${RELENG_XORRISO} $devices_opt returned ${RET}." + unboldify + echo -e "\n${SELF}: Already mounted?" + df -kh + exit 1 +esac + +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/manual_isojigdo b/libisoburn/branches/1.1.8/releng/manual_isojigdo new file mode 100755 index 00000000..559fb8e4 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/manual_isojigdo @@ -0,0 +1,288 @@ +#!/bin/bash + +# Copyright 2011 Thomas Schmitt +# Copyright 2011 George Danchev +# Licensed under GNU GPL version 2 or later + +set -e + +not_in_releng_exit() { + printf "\nPlease execute the tests from releng directory.\n\n" + exit 1 +} + +. inc/releng_getopts.inc || not_in_releng_exit + +print_specific_help() { +cat << HLP +Specific options: + none yet. +Overview: + Match the resulting ISO image representation + against the jigdo representation. +HLP +} + +if test "$SPECIFIC_HELP" = 1; then + print_specific_help + exit 0 +fi + +if [ ! -x $RELENG_XORRISO ]; then + print_help + printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" + exit 30 +fi + +# check data dir, if any and after checking -x xorriso +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} + printf "\n${SELF}: use './${SELF} -c' to remove.\n" + exit 1 +else + mkdir "${GEN_DATA_DIR}" +fi + +TMP_DATA_DIR=releng_generated_data +IMG_EXTRACT_DIR=${GEN_DATA_DIR}/${SELF}_extracted_tree +RELENG_DIR="${IMG_EXTRACT_DIR}" +RELENG_ISOLINUX_BIN="isolinux/isolinux.bin" +RELENG_BOOT_CAT="isolinux/boot.cat" +RELENG_IMG=t1 +RES="" +REMOTE_URL="http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/iso-cd" +REMOTE_IMG="debian-testing-i386-businesscard.iso" + +# check for required items +if [ "${RELENG_XORRISO}" = "" -o "${RELENG_DIR}" = "" -o "${RELENG_IMG}" = "" ]; then + echo -e "\n${SELF}: xorriso_cmd IN_dir and OUT_image are required\n" + exit 2 +fi + +# All must be set at this point +printf "${SELF}: Config items:" +printf "\n\txorriso_cmd=${RELENG_XORRISO}\n\tIN_dir=${RELENG_DIR}\n\tOUT_image=${RELENG_IMG}.iso" +printf "\n\tIN_isolinux=${RELENG_ISOLINUX_BIN}\n\tOUT_bootcat=${RELENG_BOOT_CAT}\n" +RES="${RELENG_IMG}.iso ${RELENG_IMG}.new ${RELENG_IMG}.md5 ${RELENG_IMG}.jigdo ${RELENG_IMG}.template" + +# xorriso version details, incl. underlying libraries +# "${RELENG_XORRISO}" -version + +# check whether the binary support JTE +set +e +RETSTR_VER_JTE=`"${RELENG_XORRISO}" --version 2>/dev/null | grep "libjte * in use"` +RETCODE_VER_JTE="$?" +set -e +case ${RETCODE_VER_JTE} in + 0) + printf "\n${SELF}: Found JTE support with ${RELENG_XORRISO} : ${RETSTR_VER_JTE}" + ;; + *) + printf "\nFAIL : ${SELF} : Not found JTE support in ${RELENG_XORRISO}. Quit." + printf "\n${SELF}: JTE not supported with this xorriso build. Install jigit >=1.18 and rebuild." + printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n" + cleanup + exit 4 + ;; +esac + +# grab remote ISO image, to decompose +if [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then + printf "\n${SELF}: Downloading ${REMOTE_URL}/${REMOTE_IMG}\n" + if wget -V >/dev/null 2>&1 + then + set +e + wget --no-check-certificate -T20 -t3 \ + -O "${TMP_DATA_DIR}"/"${REMOTE_IMG}" "${REMOTE_URL}"/"${REMOTE_IMG}" + WGET_RET="$?" + set -e + elif fetch -T 20 -o "${TMP_DATA_DIR}"/"${REMOTE_IMG}" \ + "${REMOTE_URL}"/"${REMOTE_IMG}" + then + WGET_RET=0 + else + echo + echo "FAIL: ${SELF} : Neither wget nor fetch are present and willing to work" + cleanup + exit 10 + fi + case ${WGET_RET} in + 0) + echo -e "\n${SELF}: Downloading successfully completed.\n" + ;; + *) + echo -e "\nFAIL : ${SELF} : wget returned code: $WGET_RET\n" + rm "${TMP_DATA_DIR}"/"${REMOTE_IMG}" + cleanup + exit 5 + ;; + esac +else + printf "\n${SELF}: Found ISO image: ${TMP_DATA_DIR}/${REMOTE_IMG}\n" +fi + +# check for extraction directory existence +if [ -d "${IMG_EXTRACT_DIR}" ]; then + printf "\n${SELF}: Found ${IMG_EXTRACT_DIR}. Please cleanup.\n" + cleanup + exit 6 +else + mkdir "${IMG_EXTRACT_DIR}" +fi + +# extract image content +CMD_EXTRACT="${RELENG_XORRISO} -indev ${TMP_DATA_DIR}/${REMOTE_IMG} \ + -osirrox on:auto_chmod_on \ + -extract / ${IMG_EXTRACT_DIR} \ +" + +# TODO: drop set +e|-e block, catch exit code instead when +# the boot catalog warnings get completely resolved. +echo -e "${SELF}: Extracting ISO image:\n${CMD_EXTRACT}\n" +set +e +${CMD_EXTRACT} +set -e + +# grab an MBR +ISOHYBRID_MBR="${GEN_DATA_DIR}/isohybrid.mbr" +dd if="${TMP_DATA_DIR}/${REMOTE_IMG}" bs=1K count=32 of="${ISOHYBRID_MBR}" + +# create FAT partition +APPEND_PART="${GEN_DATA_DIR}/fatpart.fat" +MKFS_MSDOS="/sbin/mkfs.msdos" +if [ -x "${MKFS_MSDOS}" ]; then + "${MKFS_MSDOS}" -n Bla -C "${APPEND_PART}" 8192 + APPEND_PART_CMD="-append_partition 2 0x01 ${APPEND_PART}" +else + APPEND_PART_CMD= + +# printf "\nFAIL : ${SELF} : Not found: ${MKFS_MSDOS}" +# printf "\n${SELF}: Not found: "${MKFS_MSDOS}". Install dosfstools." +# printf "\n${SELF}: http://www.daniel-baumann.ch/software/dosfstools/\n" +# cleanup +# exit 7 +fi + +# GENERAL section +CMD="${RELENG_XORRISO} \ + -as mkisofs \ + -quiet \ + -o ${GEN_DATA_DIR}/${RELENG_IMG}.iso \ + -R \ + -V ISOJIGDO \ + -partition_offset 16 \ + -J -joliet-long \ +" + +# BOOT section +if [ -f "${IMG_EXTRACT_DIR}"/"${RELENG_ISOLINUX_BIN}" -a -f "${ISOHYBRID_MBR}" ] +then +CMD="$CMD \ + -b ${RELENG_ISOLINUX_BIN} \ + -c ${RELENG_BOOT_CAT} \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -isohybrid-mbr ${ISOHYBRID_MBR} \ + -partition_offset 16 \ +" +else + printf "\n${SELF}: FAIL to compose the boot section.\n" + cleanup + exit 8 +fi +if [ -n "${APPEND_PART_CMD}" -a -f "${APPEND_PART}" ]; then +CMD="$CMD \ + ${APPEND_PART_CMD} +" +fi + +# JIGDO section +JIGDO_JIGDO=${GEN_DATA_DIR}/${RELENG_IMG}.jigdo +JIGDO_TEMPLATE=${GEN_DATA_DIR}/${RELENG_IMG}.template + +JIGDO_MAP_RHV=$(cd ${RELENG_DIR} 2>/dev/null && pwd) + +JIGDO_MAP="Debian=${JIGDO_MAP_RHV}/" + +# create jigdo MD5 list in base64 format +JIGDO_GEN_MD5=${GEN_DATA_DIR}/${RELENG_IMG}.md5 + +printf "${SELF}: Creating MD5 list in hex format in ${JIGDO_GEN_MD5}..." +set +e +./jigdo-gen-md5-list ${RELENG_DIR} > ${JIGDO_GEN_MD5} +ret=$? +set -e + +if test "$ret" = 0 +then + printf "Done.\n" +else + printf "\nFAIL : ${SELF}: ./jigdo-gen-md5-list returns $ret" + cleanup + exit 9 +fi + + +CMD="$CMD \ + -jigdo-template-compress gzip \ + -checksum_algorithm_iso md5,sha1,sha256,sha512 \ + -checksum_algorithm_template md5,sha1,sha256,sha512 \ + -jigdo-jigdo ${JIGDO_JIGDO} \ + -jigdo-template ${JIGDO_TEMPLATE} \ + -jigdo-map ${JIGDO_MAP} \ + -md5-list ${JIGDO_GEN_MD5} \ + -jigdo-min-file-size 1024 \ +" + +CMD="$CMD ${RELENG_DIR}" + +# Run the whole compound command +echo -e "${SELF}: Creating ISO and jigdo representations:\n$CMD\n" +${CMD} + +# Create another imange this time from jigdo files +if which jigit-mkimage >/dev/null 2>&1; then + printf "${SELF}: Creating new ISO from jigdo files..." + jigit-mkimage \ + -t ${JIGDO_TEMPLATE} \ + -j ${JIGDO_JIGDO} \ + -m ${JIGDO_MAP} \ + -o ${GEN_DATA_DIR}/${RELENG_IMG}.new + printf "Done.\n" +else + printf "\n${SELF}: Not found: jigit-mkimage. Install jigit." + printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n" + cleanup + exit 10 +fi + +# trap the exit code of diff and let the Universe explode +diff ${GEN_DATA_DIR}/${RELENG_IMG}.iso ${GEN_DATA_DIR}/${RELENG_IMG}.new +DIFF_RET="$?" +case ${DIFF_RET} in + 0) + echo -e "${SELF}: Match: diff ${GEN_DATA_DIR}/${RELENG_IMG}.iso ${GEN_DATA_DIR}/${RELENG_IMG}.new" + ;; + *) + echo -e "FAIL : ${SELF} : diff returned code: $DIFF_RET\n" + ;; +esac + +# sort out the cruft +cleanup + +# warn about downloaded image left behind +if [ -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then + printf "${SELF}: Leaving " + ls -sh "${TMP_DATA_DIR}"/"${REMOTE_IMG}" +fi + +# last hints +if [ -d ${GEN_DATA_DIR} ]; then + printf "\n${SELF}: HINT: manual checks remained to be done:\n" + printf " * ${GEN_DATA_DIR}/${RELENG_IMG}.iso boots from USB stick and/or optical media.\n" + printf " * appended FAT partition is mountable.\n" + printf " * xorriso -indev ${GEN_DATA_DIR}/${RELENG_IMG}.iso -pvd_info\n" + printf " * fdisk -lu ${GEN_DATA_DIR}/${RELENG_IMG}.iso\n" +fi + +exit 0 diff --git a/libisoburn/branches/1.1.8/releng/run_all_auto b/libisoburn/branches/1.1.8/releng/run_all_auto new file mode 100755 index 00000000..7cf09b5d --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/run_all_auto @@ -0,0 +1,237 @@ +#!/bin/bash + +# Copyright 2011 George Danchev +# Copyright 2011 Thomas Schmitt +# Licensed under GNU GPL version 2 or later + +set -e + +SELF=$(basename "$0") +GEN_DATA_DIR=releng_generated_data +CLOG=${GEN_DATA_DIR}/log.${SELF} +PASSED_OPTIONS="$@" +RELENG_XORRISO= +CLEANUP_LOG=0 + +not_in_releng_exit() { + printf "\nPlease execute the tests from releng directory.\n\n" + exit 1 +} + +# To catch the exit value of a command in a pipe +return_value_file="$GEN_DATA_DIR"/run_all_"$$"_return_value +return_wrapper() +{ + cmd="$1" + shift 1 + "$cmd" "$@" + RET="$?" + echo "$RET" >"$return_value_file" + return "$RET" +} + +# Using only bash builtin commands. +# On 4 year old amd64 x2 3000 MHz, xterm local,it counts 22471 lines per second +# On 2 year old amd64 x4 2600 MHz, ssh remote, it counts 35348 lines per second +count_lines() +{ + # $1 if not empty: start count + line= + if test -n "$1" + then + count="$1" + else + count=0 + fi + while read line + do + count=$(($count + 1)) + printf "\r %4d lines logged ... " "$count" >&2 + printf "%s\n" "$line" + done + return 0 +} + +# It is not a good idea to include inc/releng_getopts.inc with the +# master script as it calls the subordinate scripts and they include +# this file too, and we want to avoid sharing variable with subshells +if [ ! -f inc/releng_getopts.inc ]; then + not_in_releng_exit +fi + +############################################# +next_is= +for i in "$@" +do + if test "$next_is" = "ignore" + then : + elif test "$next_is" = "x" + then + RELENG_XORRISO="$i" + next_is= + elif test x"$i" = x"-x" + then + next_is="x" + elif test x"$i" = x"-c" + then + CLEANUP_LOG=1 + fi +done +############################################# +if test "$next_is" = x +then + echo + echo "Option -x expects an argument (the path to the xorriso program)" + exit 31 +fi + +if [ ! "${1}" ]; then +cat << HLP +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +${SELF} runs executables from CWD starting +with auto_*, passing them its own options. +stdout/stderr output stored in: + ${CLOG} + +examples: +# run xorriso and keep the self-generated data + $ ./${SELF} -x path/to/xorriso [-k] + +# clean up self-generated data from previous run + $ ./${SELF} -c +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +HLP + exit 31 +fi + +######################################################## + if [ -f "${CLOG}" ]; then + mv "${CLOG}" "${CLOG}".prev + fi + > ${CLOG} + if [ -x "${RELENG_XORRISO}" ]; then + echo "_OVERVIEW_______________________________________________________________" >> ${CLOG} + date -u >> ${CLOG} + ${RELENG_XORRISO} --version >> ${CLOG} + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG} + fi + DSTART=`date -u` + echo "${SELF}: Started at ${DSTART}" | tee -a ${CLOG} + E1=`date '+%s'` + exit_value=0 + # require ^auto_, avoid running (your)self explicitly + for s in `ls | grep ^auto_ | grep -v ${SELF} | sort -n`; do + if [ -x ${s} -a ! -d ${s} ]; then + echo >> ${CLOG} + echo >> ${CLOG} + echo "_STARTING_TEST_________________________________________________________" >> ${CLOG} + echo "${SELF}: Running ./${s} ${PASSED_OPTIONS} :" \ + | tee -a ${CLOG} + T1=`date '+%s'` + set +e + + if test -n "$PIPESTATUS" + then + # PIPESTATUS[0] should be available in bash + ./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG} + RET="${PIPESTATUS[0]}" + else + # a more portable method which uses a temporary file to record exit value + return_wrapper ./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG} + RET=$(cat "$return_value_file") + rm "$return_value_file" + fi +# echo "RET='$RET'" >/dev/tty + + T2=`date '+%s'` + TS=`expr ${T2} - ${T1}` + case ${RET} in + 0) + echo "done in ${TS} sec. ok." + ;; + *) + exit_value=2 + printf "done in ${TS} sec. " + which tput >/dev/null 2>&1 && tput smso + printf "FAIL -> EXIT CODE $RET" + which tput >/dev/null 2>&1 && tput rmso + echo + ;; + esac + set -e + fi + done + + DEND=`date -u` + echo | tee -a ${CLOG} + echo -n "${SELF}: Stopped at ${DEND}." | tee -a ${CLOG} + if [ "${CLEANUP_LOG}" -eq 1 ]; then + if [ -f "${CLOG}" ]; then + rm -f "${CLOG}" + echo # | tee -a ${CLOG} + echo -n "${SELF}: Removed my own log ${CLOG}." # | tee -a ${CLOG} + fi + if [ -f "${CLOG}".prev ]; then + rm -f "${CLOG}".prev + echo # | tee -a ${CLOG} + echo "${SELF}: Removed my own log ${CLOG}.prev." # | tee -a ${CLOG} + fi + else + E2=`date '+%s'` + if [ ${E2} -eq ${E1} ]; then + echo " Total elapsed 0 sec." | tee -a ${CLOG} + else + ES=`expr ${E2} - ${E1}` + echo " Total elapsed ${ES} sec." | tee -a ${CLOG} + fi + ##### + echo >> ${CLOG} + echo "_SUMMARY________________________________________________________________" >> ${CLOG} + echo "${SELF}: Trivial log examination: ${CLOG}" | tee -a ${CLOG} + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG} + # severity classes of libdax_msgs.h in libburn and libisofs + # List of boring keywords: + # 'UPDATE|NOTE|DEBUG|ALL' - not considered interesting for lazy log inspection. + # List of interesting keywords: + # thrown by xorriso and underlying libraries + LIST_KWD="NEVER|ABORT|FATAL|FAILURE|MISHAP|SORRY|WARNING|HINT" + # thrown by others + LIST_KWD="${LIST_KWD}|FAIL|ERROR|WRONG" + + if [ -f "${CLOG}" ]; then + set +e + # lines, perl regex, leading tabs + grep -n -E "${LIST_KWD}" "${CLOG}" + RET_GREP="$?" + case ${RET_GREP} in + 0) # found + ;; + 1) # not found + echo "${SELF}: Log file looks clear." # | tee -a ${CLOG} + ;; + *) # + echo "${SELF}: grep returned EXIT CODE: ${RET_GREP}." # | tee -a ${CLOG} + ;; + esac + set -e + fi + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG} + + ##### TODO: work out a less noisy diff'ing technique! + if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then + echo "${SELF}: See diff against previous log file (might be long):" | tee -a ${CLOG} + echo "diff -Naur ${CLOG}.prev ${CLOG} | less" | tee -a ${CLOG} + fi + + fi + + # + which tput >/dev/null 2>&1 && tput smso + echo # | tee -a ${CLOG} + echo "${SELF}: Leaving the following cruft in ${GEN_DATA_DIR}:" # | tee -a ${CLOG} + which tput >/dev/null 2>&1 && tput rmso + ls -lth "${GEN_DATA_DIR}" # | tee -a ${CLOG} + + # Fin + exit $exit_value + diff --git a/libisoburn/branches/1.1.8/releng/template_new b/libisoburn/branches/1.1.8/releng/template_new new file mode 100755 index 00000000..a14e3a36 --- /dev/null +++ b/libisoburn/branches/1.1.8/releng/template_new @@ -0,0 +1,135 @@ +#!/bin/bash + +# Copyright 2011 George Danchev +# Copyright 2011 Thomas Schmitt +# === TEMPLATE: Add your own copyright here +# +# Licensed under GNU GPL version 2 or later + +# === TEMPLATE: Remove this remark before releasing this script. +# +# This is a template for creating a new libisoburn/releng test. +# It is supposed that you have read releng/README before you begin to work +# here. +# +# Step 1: Invent a name for your test +# test_name="manual_"...some.name... +# or +# test_name="auto_"...some.name... +# +# Step 2: Copy releng/template_new to $test_name +# +# Step 3: Edit $test_name and process any line that begins by +# "# === TEMPLATE:". Do what the line prescribes and then remove it +# from the script. You are not done as long as such a line remains. +# +# === TEMPLATE: End of remark to remove + +set -e + + +# === TEMPLATE: Describe your own specific options (if any) and the test +print_specific_help() { +cat << HLP +Specific options: + --option Explanation of specific option +Overview: + Short explanation of test purpose and activities. +HLP +} + + +getopts_inc=inc/releng_getopts.inc +if test -e "$getopts_inc" +then + . "$getopts_inc" + + if test "$SPECIFIC_HELP" = 1 + then + print_specific_help + exit 0 + fi +else + echo >&2 + echo "File not found: $getopts_inc" >&2 + echo "Are we in the ./releng directory of a libisoburn SVN checkout ?" >&2 + echo "(Please execute the tests from that ./releng directory.)" >&2 + echo >&2 + exit 29 +fi + + +# === TEMPLATE: Decide whether the test will have own options, +# === TEMPLATE: apart from those interpreted by inc/releng_getopts.inc +# === TEMPLATE: If not, then remove this interpreter code. +# Set default values for specific option variables. E.g.: +# dev= +# Interpret specific options, they begin after the first --. +next_is=ignore +for i in "$@" +do + if test "$next_is" = "ignore" + then + if test "$i" = "--" + then + next_is="" + fi + +# === TEMPLATE: Implement interpretation of specific options. Like: +# elif test "$next_is" = "dev" +# then +# dev="$i" +# next_is="" +# elif test "$i" = "--dev" +# then +# next_is="dev" + + else + echo >&2 + echo "Unknown test specific option: $i" >&2 + print_help + print_specific_help + exit 31 + fi +done +# === TEMPLATE: End of own option interpreter code. + + +# Each test should decide whether or not it needs +# a xorriso binary to test, since some do compilations only. +# === TEMPLATE: Decide whether you need a xorriso program. +# === TEMPLATE: If not, then remove this function call +check_for_xorriso -x + + +# check data dir, if any and after checking -x xorriso +# === TEMPLATE: Decide whether your test will possibly create own files. +# === TEMPLATE: If yes, then create your files underneath ${GEN_DATA_DIR}. +# === TEMPLATE: The name in this variable is set by inc/releng_getopts.inc . +# === TEMPLATE: If not, then remove this if ... fi statement. +if [ -d "${GEN_DATA_DIR}" ]; then + printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} + printf "\n${SELF}: use '${SELF} -c' to remove.\n" + exit 30 +else + mkdir "${GEN_DATA_DIR}" +fi + + +##################################################################### + + +# === TEMPLATE: Perform your test activities here. + + +# === TEMPLATE: In case of failure, issue a line to stdout that begins by +# === TEMPLATE: the word "FAIL", and make sure that the test script finally +# === TEMPLATE: returns a non-zero exit value. +# === TEMPLATE: 31 = Unknown option or unusable argument with known option +# === TEMPLATE: 30 = Unexpected state of own directory for self generated files +# === TEMPLATE: 29 = Not in ./releng directory or missing essential parts +# === TEMPLATE: 1 to 28 = test specific exit values +# === TEMPLATE: When exiting prematurely, make sure to call cleanup. + +cleanup +exit 0 diff --git a/libisoburn/branches/1.1.8/test/compare_file.c b/libisoburn/branches/1.1.8/test/compare_file.c new file mode 100644 index 00000000..d554c4e8 --- /dev/null +++ b/libisoburn/branches/1.1.8/test/compare_file.c @@ -0,0 +1,289 @@ +/* + Compare two copies of a file object in as many aspects as i can imagine + to make sense. (E.g.: comparing atime makes no sense.) + + To compare tree /media/dvd and /original/dir : + find /media/dvd -exec compare_file '{}' /media/dvd /original/dir ';' + + Copyright 2008 - 2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + + cc -g -o compare_file compare_file.c +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* @param flag bit0= single letters */ +char *Ftypetxt(mode_t st_mode, int flag) +{ + if(flag&1) + goto single_letters; + if(S_ISDIR(st_mode)) + return("directory"); + else if(S_ISREG(st_mode)) + return("regular_file"); + else if(S_ISLNK(st_mode)) + return("symbolic_link"); + else if(S_ISBLK(st_mode)) + return("block_device"); + else if(S_ISCHR(st_mode)) + return("char_device"); + else if(S_ISFIFO(st_mode)) + return("name_pipe"); + else if(S_ISSOCK(st_mode)) + return("unix_socket"); + return("unknown"); +single_letters:; + if(S_ISDIR(st_mode)) + return("d"); + else if(S_ISREG(st_mode)) + return("-"); + else if(S_ISLNK(st_mode)) + return("l"); + else if(S_ISBLK(st_mode)) + return("b"); + else if(S_ISCHR(st_mode)) + return("c"); + else if(S_ISFIFO(st_mode)) + return("p"); + else if(S_ISSOCK(st_mode)) + return("s"); + return("?"); +} + + +char *Ftimetxt(time_t t, char timetext[40], int flag) +{ + char *rpt; + struct tm tms, *tmpt; + static char months[12][4]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + + tmpt= localtime_r(&t, &tms); + rpt= timetext; + rpt[0]= 0; + if(tmpt==0) + sprintf(rpt+strlen(rpt), "%12.f", (double) t); + else if(time(NULL)-t < 180*86400 && time(NULL)-t >= 0) + sprintf(rpt+strlen(rpt), "%3s %2d %2.2d:%2.2d", + months[tms.tm_mon], tms.tm_mday, tms.tm_hour, tms.tm_min); + else + sprintf(rpt+strlen(rpt), "%3s %2d %4.4d", + months[tms.tm_mon], tms.tm_mday, 1900+tms.tm_year); + return(timetext); +} + + +/* @param flag bit0= compare atime + bit1= compare ctime +*/ +int Compare_2_files(char *adr1, char *adr2, char *adrc, int flag) +{ + struct stat s1, s2; + int ret, differs= 0, r1, r2, fd1= -1, fd2= -1, i, done; + char buf1[4096], buf2[4096], a[4096], ttx1[40], ttx2[40]; + off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1; + + ret= lstat(adr1, &s1); + if(ret==-1) { + printf("? %s : cannot lstat() : %s\n", adr1, strerror(errno)); + return(0); + } + strcpy(a, Ftypetxt(s1.st_mode, 1)); + strcat(a, " "); + if(adrc[0]) + strcat(a, adrc); + else + strcat(a, "."); + + ret= lstat(adr2, &s2); + if(ret==-1) { + printf("? %s : cannot lstat() : %s\n", adr2, strerror(errno)); + return(0); + } + + /* Attributes */ + if(s1.st_mode != s2.st_mode) { + if((s1.st_mode&~S_IFMT)!=(s2.st_mode&~S_IFMT)) + printf("%s : st_mode : %7.7o <> %7.7o\n", a, + (unsigned int) (s1.st_mode & ~S_IFMT), + (unsigned int) (s2.st_mode & ~S_IFMT)); + if((s1.st_mode&S_IFMT)!=(s2.st_mode&S_IFMT)) + printf("%s : type : %s <> %s\n", + a, Ftypetxt(s1.st_mode, 0), Ftypetxt(s2.st_mode, 0)); + differs= 1; + } + if(s1.st_uid != s2.st_uid) { + printf("%s : st_uid : %lu <> %lu\n", + a, (unsigned long) s1.st_uid, (unsigned long) s2.st_uid); + differs= 1; + } + if(s1.st_gid != s2.st_gid) { + printf("%s : st_gid : %lu <> %lu\n", + a, (unsigned long) s1.st_gid, (unsigned long) s2.st_gid); + differs= 1; + } + if((S_ISCHR(s1.st_mode) && S_ISCHR(s2.st_mode)) || + (S_ISBLK(s1.st_mode) && S_ISBLK(s2.st_mode))) { + if(s1.st_rdev != s2.st_rdev) { + printf("%s : %s st_rdev : %lu <> %lu\n", a, + (S_ISCHR(s1.st_mode) ? "S_IFCHR" : "S_IFBLK"), + (unsigned long) s1.st_rdev, (unsigned long) s1.st_rdev); + differs= 1; + } + } + if(S_ISREG(s2.st_mode) && s1.st_size != s2.st_size) { + printf("%s : st_size : %.f <> %.f diff= %.f\n", + a, (double) s1.st_size, (double) s2.st_size, + ((double) s1.st_size) - (double) s2.st_size); + differs= 1; + } + if(s1.st_mtime != s2.st_mtime) { + printf("%s : st_mtime : %s <> %s diff= %.f s\n", + a, Ftimetxt(s1.st_mtime, ttx1, 0), + Ftimetxt(s2.st_mtime, ttx2, 0), + ((double) s1.st_mtime) - (double) s2.st_mtime); + differs= 1; + } + if(flag&1) { + if(s1.st_atime != s2.st_atime) { + printf("%s : st_atime : %s <> %s diff= %.f s\n", + a, Ftimetxt(s1.st_atime, ttx1, 0), + Ftimetxt(s2.st_atime, ttx2, 0), + ((double) s1.st_atime) - (double) s2.st_atime); + differs= 1; + } + } + if(flag&2) { + if(s1.st_ctime != s2.st_ctime) { + printf("%s : st_ctime : %s <> %s diff= %.f s\n", + a, Ftimetxt(s1.st_ctime, ttx1, 0), + Ftimetxt(s2.st_ctime, ttx2, 0), + ((double) s1.st_ctime) - (double) s2.st_ctime); + differs= 1; + } + } + if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)) { + fd1= open(adr1, O_RDONLY); + if(fd1==-1) { + printf("- %s : cannot open() : %s\n", adr1, strerror(errno)); + return(0); + } + fd2= open(adr2, O_RDONLY); + if(fd2==-1) { + printf("- %s : cannot open() : %s\n", adr2, strerror(errno)); + close(fd1); + return(0); + } + + /* Content */ + done= 0; + while(!done) { + r1= read(fd1, buf1, sizeof(buf1)); + r2= read(fd2, buf2, sizeof(buf2)); + if((r1==EOF && r2==EOF) || (r1==0 && r2==0)) + break; + if(r1==EOF || r1==0) { + if(r1==EOF) + r1= 0; + if(s1.st_size > r1count + r1) + printf("- %s : early EOF after %.f bytes\n", adr1, (double) r1count); + differs= 1; + } + r1count+= r1; + if(r2==EOF || r2 r2count + r2) + printf("- %s : early EOF after %.f bytes\n", adr2, (double) r2count); + differs= 1; + done= 1; + } + if(r2>r1) { + if(s1.st_size > r1count + r1) + printf("- %s : early EOF after %.f bytes\n", adr1, (double) r1count); + differs= 1; + done= 1; + } + r2count+= r2; + if(r1>r2) + r1= r2; + for(i= 0; i0 || r1count!=r2count) { + if(first_diff<0) + first_diff= (r1count>r2count ? r2count : r1count); + printf("%s : %s : differs by at least %.f bytes. First at %.f\n", a, + (s1.st_mtime==s2.st_mtime ? "CONTENT":"content"), + (double) (diffcount + abs(r1count-r2count)), (double) first_diff); + differs= 1; + } + } + if(fd1!=-1) + close(fd1); + if(fd2!=-1) + close(fd2); + return(!differs); +} + + +int main(int argc, char **argv) +{ + int ret, i, with_ctime= 1; + char adr1[4096], adr2[4096], adrc[4096]; + + if(sizeof(off_t) < 8) { + fprintf(stderr, + "%s : FATAL : Compile time misconfiguration. sizeof(off_t) too small.\n\n", + argv[0]); + exit(4); + } + if(argc<4) { + fprintf(stderr, "usage: %s path prefix1 prefix2\n", argv[0]); + exit(2); + } + for(i= 4; i + and Thomas Schmitt +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include "../src/libisoburn.h" + +const char * const optstring = "JRh"; +extern char *optarg; +extern int optind; + + +/** Activates the usage of function graft_point() rather than + plain iso_tree_radd_dir() from libisofs +*/ +#define With_graft_poinT 1 + + +static int graft_point(struct iso_volume *volume, const char *disk_path, + const char *img_path, struct iso_tree_radd_dir_behavior *behav) +{ + char path[4096], *apt, *npt; + struct iso_tree_node_dir *dir; + struct iso_tree_node *node; + int done= 0, is_dir= 0; + struct stat stbuf; + + strncpy(path, img_path, sizeof(path)-1); + path[sizeof(path)-1]= 0; + apt= npt= path; + + if(lstat(disk_path, &stbuf) == -1) { + fprintf(stderr, "Cannot determine attributes of '%s' : %s (%d)\n", + disk_path, (errno > 0 ? strerror(errno) : "unknown error"), errno); + return(0); + } + if(S_ISDIR(stbuf.st_mode)) + is_dir= 1; + else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) { + fprintf(stderr, "File object '%s' is of non-supported file type\n", + disk_path); + return(0); + } + + dir= iso_volume_get_root(volume); + if(dir==NULL) { + fprintf(stderr, "While grafting '%s' : no root node available\n", img_path); + return(0); + } + for(npt= apt; !done; apt= npt+1) { + npt= strchr(apt, '/'); + if(npt==NULL) { + npt= apt+strlen(apt); + done= 1; + } else + *npt= 0; + if(*apt==0) { + *apt= '/'; + apt++; + continue; + } + node= iso_tree_volume_path_to_node(volume,path); + if(node!=NULL) { + if(iso_tree_node_get_type(node)!=LIBISO_NODE_DIR) { + fprintf(stderr, "While grafting '%s' : '%s' is not a directory\n", + img_path, path); + return(0); + } + dir= (struct iso_tree_node_dir *) node; + } else { + dir= iso_tree_add_dir(dir, apt); + if(dir==NULL) { + fprintf(stderr, "While grafting '%s' : could not insert '%s'\n", + img_path, path); + return(0); + } + } + if(done) { + if(is_dir) { + iso_tree_radd_dir(dir, disk_path, behav); + } else { + node= iso_tree_add_node(dir, disk_path); + if(node == NULL) { + fprintf(stderr, "While grafting '%s'='%s' : libisofs_errno = %d\n", + img_path, disk_path, libisofs_errno); + } + } + } else + *npt= '/'; + } + fprintf(stderr, "NOTE: added %s '%s'='%s'\n", (is_dir ? "directory" : "node"), + img_path, disk_path); + return(1); +} + + +static +void usage() +{ + printf("test [OPTIONS] DRIVE DIRECTORY\n"); +} + +static +void help() +{ + printf( +"Options:\n" +" -J Add Joliet support\n" +" -R Add Rock Ridge support\n" +" -h Print this message\n" +); +} + +int main(int argc, char **argv) +{ + struct burn_drive_info *drives; + struct iso_volset *volset; + struct burn_drive *drive; + struct burn_disc *disc; + enum burn_disc_status state; + struct isoburn_read_opts ropts; + struct isoburn_source_opts sopts; + int c; + struct iso_tree_radd_dir_behavior behav = {0,0,0}; + int flags=0; + int ret=0, i; + int size, free_bytes; + char *status_text; + + while ((c = getopt(argc, argv, optstring)) != -1) { + switch(c) { + case 'h': + usage(); + help(); + exit(0); + break; + case 'J': + flags |= ECMA119_JOLIET; + break; + case 'R': + flags |= ECMA119_ROCKRIDGE; + break; + case '?': + usage(); + exit(1); + break; + } + } + + if (argc < optind + 1) { + fprintf(stderr, "Please supply device name\n"); + usage(); + exit(1); + } + if (argc < optind + 2) { + fprintf(stderr, "Please supply directory to add to disc\n"); + usage(); + exit(1); + } + + + if (!isoburn_initialize()) { + fprintf(stderr, "Can't init libisoburn\n"); + exit(1); + } + + /* TODO change this. maybe we can add wrapp in libisoburn */ + iso_msgs_set_severities("NEVER", "DEBUG", "libisofs : "); + burn_msgs_set_severities("NEVER", "DEBUG", "libburn : "); + burn_set_signal_handling("libisoburn/test/test : ", NULL, 0); + + printf("Growing drive %s\n", argv[optind]); + + if (isoburn_drive_scan_and_grab(&drives, argv[optind], 1) <= 0) { + fprintf(stderr, + "Can't open device. Are you sure it is a valid drive?\n"); + exit(1); + } + drive = drives[0].drive; + + /* check for invalid state */ + state = isoburn_disc_get_status(drive); + if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) { + fprintf(stderr, "Unsuitable disc status\n"); + goto exit_cleanup; + } + + /* fill read opts */ + memset(&ropts, sizeof(ropts), 0); + ropts.norock = 0; + ropts.nojoliet = 0; + ropts.preferjoliet = 0; + ropts.uid = 0; + ropts.gid = 0; + ropts.mode = 0555; + ropts.pretend_blank= 0; + + if (isoburn_read_volset(drive, &ropts, &volset) <= 0) { + fprintf(stderr, "Can't read volset\n"); + goto exit_cleanup; + } + + +#ifdef With_graft_poinT + for (i = optind + 1; i < argc; i++) { + if (graft_point(iso_volset_get_volume(volset, 0), + argv[i], argv[i], &behav) <= 0) { + fprintf(stderr, "Canot graft '%s'\n", argv[optind+1]); + goto exit_cleanup; + } + } + +#else + struct iso_tree_node_dir *root; + root = iso_volume_get_root(iso_volset_get_volume(volset, 0)); + /* add a new dir */ + iso_tree_radd_dir(root, argv[optind+1], &behav); +#endif /* ! With_graft_poinT */ + + + sopts.level = 2; + sopts.flags = flags; + sopts.relaxed_constraints = 0; + sopts.copy_eltorito = 1; + sopts.no_cache_inodes = 0; + sopts.sort_files = 1; + sopts.default_mode = 0; + sopts.replace_dir_mode = 0; + sopts.replace_file_mode = 0; + sopts.replace_uid = 0; + sopts.replace_gid = 0; + sopts.dir_mode = 0555; + sopts.file_mode = 0444; + sopts.gid = 0; + sopts.uid = 0; + sopts.input_charset = NULL; + sopts.ouput_charset = NULL; + + if (isoburn_prepare_disc(drive, &disc, &sopts) <= 0) { + fprintf(stderr, "Can't prepare disc\n"); + goto volset_cleanup; + } + + /* a. write the new image */ + printf("Adding new data...\n"); + { + struct burn_write_opts *burn_options; + struct burn_progress progress; + + burn_options = burn_write_opts_new(drive); + burn_drive_set_speed(drive, 0, 0); + burn_write_opts_set_underrun_proof(burn_options, 1); + + /* ok, write the new track */ + isoburn_disc_write(burn_options, disc); + burn_write_opts_free(burn_options); + + while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) + usleep(100002); + + while (burn_drive_get_status(drive, &progress) + != BURN_DRIVE_IDLE) { + + printf("Writing: sector %d of %d", + progress.sector, progress.sectors); + ret = isoburn_get_fifo_status(drive, &size, + &free_bytes, &status_text); + if (ret > 0 ) + printf(" [fifo %s, %2d%% fill]", status_text, + (int) (100.0 - 100.0 * + ((double) free_bytes) / + (double) size)); + printf("\n"); + sleep(1); + } + } + + /* b. write the new vol desc */ + printf("Writing the new vol desc...\n"); + if (isoburn_activate_session(drive) <= 0) { + fprintf(stderr, "Ups, new vol desc write failed\n"); + } + + ret= 0; +volset_cleanup:; +/* + iso_volset_free(volset); +*/ + +exit_cleanup:; + isoburn_drive_release(drive, 0); + isoburn_finish(); + + exit(ret); +} + diff --git a/libisoburn/branches/1.1.8/version.h.in b/libisoburn/branches/1.1.8/version.h.in new file mode 100644 index 00000000..cf529233 --- /dev/null +++ b/libisoburn/branches/1.1.8/version.h.in @@ -0,0 +1,6 @@ + +/* <<< this file is on its way out +#define ISOBURN_MAJOR_VERSION @ISOBURN_MAJOR_VERSION@ +#define ISOBURN_MINOR_VERSION @ISOBURN_MINOR_VERSION@ +#define ISOBURN_MICRO_VERSION @ISOBURN_MICRO_VERSION@ +*/ diff --git a/libisoburn/branches/1.1.8/xorriso/AUTHORS_gnu_xorriso b/libisoburn/branches/1.1.8/xorriso/AUTHORS_gnu_xorriso new file mode 100644 index 00000000..cd4ebadc --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/AUTHORS_gnu_xorriso @@ -0,0 +1,15 @@ +Derek Foreman +Ben Jansens +Thomas Schmitt +Mario Danic +Vreixo Formoso Lopes +Colin Plumb +Tatu Ylonen +Jim Kingdon +Scott G. Miller +Ulrich Drepper +Richard Atterer +Steve McIntyre +George Danchev +and possibly others who gave their copyright to Free Software Foundation, Inc. + diff --git a/libisoburn/branches/1.1.8/xorriso/COPYING_gnu_xorriso b/libisoburn/branches/1.1.8/xorriso/COPYING_gnu_xorriso new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/COPYING_gnu_xorriso @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/libisoburn/branches/1.1.8/xorriso/COPYRIGHT_gnu_xorriso b/libisoburn/branches/1.1.8/xorriso/COPYRIGHT_gnu_xorriso new file mode 100644 index 00000000..6f21ac08 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/COPYRIGHT_gnu_xorriso @@ -0,0 +1,34 @@ +Derek Foreman +Ben Jansens +Thomas Schmitt +Mario Danic , +Vreixo Formoso +Steve McIntyre +George Danchev + +GNU xorriso is a compilation of modules from libburnia-project.org : +xorriso Copyright (C) 2007-2011 Thomas Schmitt +libisoburn Copyright (C) 2007-2011 Vreixo Formoso, Thomas Schmitt +libisofs Copyright (C) 2007-2011 Vreixo Formoso, Mario Danic, Thomas Schmitt +libburn Copyright (C) 2002-2006 Derek Foreman, Ben Jansens + 2006-2011 Mario Danic, Thomas Schmitt +Further included is : +libjte Copyright (C) 2000-2007 Free Software Foundation, Inc. + 2004-2011 Steve McIntyre + 2010-2011 George Danchev, Thomas Schmitt + +Originally they all are licensed directly or indirectly as GPLv2+. +GNU xorriso is licensed by the following statement: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 3 + or later as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/libisoburn/branches/1.1.8/xorriso/README_gnu_xorriso b/libisoburn/branches/1.1.8/xorriso/README_gnu_xorriso new file mode 100644 index 00000000..fd09a1fc --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/README_gnu_xorriso @@ -0,0 +1,460 @@ +------------------------------------------------------------------------------ + Contribution of libburnia-project.org to the GNU Operating System +------------------------------------------------------------------------------ +GNU xorriso. By Thomas Schmitt +Derived from and supported by libburnia-project.org, published via: +http://www.gnu.org/software/xorriso/xorriso_eng.html +http://www.gnu.org/software/xorriso/xorriso-1.1.7.tar.gz +Provided under GPL version 3 or later. No warranty. +------------------------------------------------------------------------------ + + +xorriso is a program which copies file objects from POSIX compliant +filesystems into Rock Ridge enhanced ISO 9660 filesystems and allows +session-wise manipulation of such filesystems. It can load the management +information of existing ISO images and it writes the session results to +optical media or to filesystem objects. +Vice versa xorriso is able to restore file objects from ISO 9660 filesystems. + +A special property of xorriso is that it needs neither an external ISO 9660 +formatter program nor an external burn program for CD or DVD but rather +incorporates the libraries of libburnia-project.org . + +Currently it is fully supported on GNU/Linux with kernels >= 2.4, +on FreeBSD with ATAPI/CAM support enabled in the kernel, see atapicam(4), +and on OpenSolaris (tested with kernel 5.11). +On other X/Open compliant systems there will only be POSIX i/o with disk +file objects, but no direct MMC operation on CD/DVD/BD drives. + +By using this software you agree to the disclaimer at the end of this text: +"... without even the implied warranty ..." + + + Compilation, First Glimpse, Installation + +The most simple way to get xorriso from source code is the GNU xorriso tarball. + +Prerequisites: +The tarball contains everything that is needed except the following system +components: + libc, libpthread + plus on FreeBSD: libiconv, libcam, IDE and SATA drives need atapicam +Optional at compile time are: + libreadline and the readline-dev headers make dialog mode more convenient. + zlib and zlib-devel allow zisofs compression. + on GNU/Linux: libacl and libacl-devel allow getting and setting ACLs. +If they were present at compile time, then the optional libraries have to +be present at runtime, too. + +Obtain xorriso-1.1.7.tar.gz, take it to a directory of your choice and do: + + tar xzf xorriso-1.1.7.tar.gz + cd xorriso-1.1.7 + +Within that directory execute: + + ./configure --prefix=/usr + make + +This will produce a binary named + ./xorriso/xorriso + +If you want xorriso to report a "Build timestamp" with its option -version : + make buildstamped + +You may strip the binary to reduce it in size + strip ./xorriso/xorriso + +You may copy or move it to a directory where it can be found by the shell, +or you may execute xorriso at the place where it was built, +or you may execute as superuser: + make install + +For general concepts, options and usage examples see + info xorriso + info xorrisofs + info xorrecord + man 1 xorriso + man 1 xorrisofs + man 1 xorrecord + +You may get a first glimpse by e.g. + info ./xorriso/xorriso.info + man ./xorriso/xorriso.1 + +The installation creates several alias links pointing to the xorriso binary: + xorrisofs starts xorriso with -as mkisofs emulation already enabled + xorrecord starts xorriso with -as cdrecord emulation already enabled + osirrox starts with -osirrox image-to-disk copying already enabled + + +If you want to avoid dependecy on libreadline although the libreadline +development package is installed, then rather build xorriso by: + ./configure --prefix=/usr --disable-libreadline + make clean ; make +Never omit the "make clean" command after switching libreadline enabling. +Other deliberate dependency reduction options of ./configure are: + --disable-libacl avoid use of ACL functions like acl_to_text() + --disable-xattr avoid use of xattr functions like listxattr() on Linux + resp. extattr_list_file() on FreeBSD + --disable-zlib avoid use of zlib functions like compress2() + this also avoids the use of libjte and option -jigdo. + +xorriso brings own system adapters which allow burning optical media on +GNU/Linux, FreeBSD, Solaris. +Alternatively it can use libcdio-0.83 or later for sending commands to +optical drives: + --enable-libcdio + +xorriso allows to use external processes as file content filters. This is +a potential security risk which may be avoided by ./configure option + --disable-external-filters + +By default the filter feature is disabled if effective user id and real +user id differ. This ban can be lifted by + --enable-external-filters-setuid + +Sometimes xorriso will yield better write performance on GNU/Linux if 64 KB are +transmitted in each write operation rather than 32 KB. See option -dvd_obs . +64k can be made default at configure time by: + --enable-dvd-obs-64k + +For xorriso -as cdrecord emulation only: +In some situations GNU/Linux may deliver a better write performance to drives +if the track input is read with O_DIRECT (see man 2 open). The included libburn +and the cdrecord emulation of xorriso can be told to use this peculiar read +mode by: + --enable-track-src-odirect + +Linux only: +libburn tries to avoid a collision with udev's drive examination by waiting +0.1 seconds before opening the device file for a longer time, after udev +might have been alarmed by drive scanning activities. +The waiting time can be set at ./configure time with microsecond granularity. +E.g. 2 seconds: + CFLAGS="$CFLAGS -DLibburn_udev_wait_useC=2000000" + ./configure ...options... +Waiting can be disabled by zero waiting time: + CFLAGS="$CFLAGS -DLibburn_udev_wait_useC=0" +Alternatively, libburn can try to be nice by opening the device file, +closing it immediately, waiting, and only then opening it for real: + CFLAGS="$CFLAGS -DLibburn_udev_extra_open_cyclE -DLibburn_udev_wait_useC=500000" + + + Drives and Disk File Objects + +The user of libisoburn applications needs rw-permission for the CD/DVD/BD +drives which shall be used, even if only reading is intended. +A list of rw-accessible drives can be obtained by + + xorriso -devices + +CD devices which offer not enough permission are invisible to normal users. +The superuser should be able to see any usable drive and then set the +permissions as needed. +On Linux and FreeBSD, rw-permissions are needed. +On Solaris, the privilege "sys_devices" and r-permission are needed. + +The output of xorriso -devices might look like + +0 -dev '/dev/sr0' rwrw-- : 'TSSTcorp' 'CDDVDW SH-S203B' +1 -dev '/dev/hda' rwrw-- : 'HL-DT-ST' 'DVD-ROM GDR8162B' + +On Linux, full and insecure enabling of both for everybody would look like + chmod a+rw /dev/sr0 /dev/hda +This is equivalent to the traditional setup chmod a+x,u+s cdrecord. + +On FreeBSD, device permissions are to be set in /etc/devfs.rules. +On Solaris, pfexec privileges may be restricted to "basic,sys_devices". +See below "System Dependend Drive Permission Examples". + +I strongly discourage to run xorriso with setuid root or via sudo ! +It is not checked for the necessary degree of hacker safety. +Better consider to grant the necessary permissions to group "floppy" +and to add users to it. + + +A possible source of problems are hald or other automounters. +If you can spot a process "hald-addon-storage" with the address of +your desired drive, then consider to kill it. +A similar process "udisks-daemon: polling ..." can be seen on newer Linuxes. + +On Debian GNU/Linux 6.0.2 amd64 there is + /lib/udev/rules.d/80-udisks.rules +where one can remove all CD drives ("sr*") from the list of automountable +devices: + KERNEL=="sd*|hd*|mmcblk*|mspblk*", ENV{UDISKS_PRESENTATION_NOPOLICY}="0" + # KERNEL=="sd*|hd*|sr*|mmcblk*|mspblk*", ENV{UDISKS_PRESENTATION_NOPOLICY}="0" +Copying the recognition criterion from + /etc/udev/rules.d/70-persistent-cd.rules +one can prevent automounting a single drive, too: + SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-2:0:0:0", ENV{UDISKS_PRESENTATION_NOPOLICY}:="1" + +If you cannot get rid of the automounter, try whether it helps to always load +the drive tray manually before starting a write run of xorriso. Wait until the +drive light is off and the mounted media appears. +Then try to unmount the mounted media before a write run. + + +Besides true optical drives, xorriso can also address disk files as input or +output drives. By default paths to files under /dev are accepted only if the +device represents a real optical drive. Other device files may be addressed +by prepending "stdio:" to the path. +Like: + xorriso -dev stdio:/dev/sdb ...more arguments... +This rule may be changed by xorriso option -drive_class. +Prefix "mmc:" causes a path to be accepted only if it is a real optical drive +which is accessible by generic SCSI/MMC commands. + + + Testing + +We are quite sure that libisofs produces accurate representations of the disk +files. This opinion is founded on a lot of test burns and checks by a little +test program which compares files from the mounted image with the orignals +on disk. It uses the normal POSIX filesystem calls, i.e. no libburnia stuff. + +This program is not installed systemwide but stays in the installation +directory of the xorriso tarball as test/compare_file . Usually it is +run as -exec payload of a find command. It demands at least three arguments: +The path of the first file to compare, the prefix1 to be cut off from path +and the prefix2 which gets prepended afterwards to obtain the path of the +second file to compare. +As further argument there can be -no_ctime which suppresses the comparison +of ctime date stamps. +The exit value is 0 if no difference was detected, non-0 else. + +Example: After + xorriso ... -pathspecs on -add /=/original/dir -- -commit_eject all + mount /media/dvd + cd test +compare tree /media/dvd with tree /original/dir : + find /original/dir -exec ./compare_file '{}' /original/dir /media/dvd ';' \ + | less +and vice versa: + find /media/dvd -exec ./compare_file '{}' /media/dvd /original/dir ';' \ + | less + + + File Formats + + Sector Maps + +Sector maps describe the valid and invalid blocks on a media or a disk copy of +a media. xorriso creates and reads these file with its option -check_media. + +The file begins with 32 bytes of cleartext of which the last one is a +newline character. The first 25 say "xorriso sector bitmap v2 ", the +remaining six characters give the size of the info text as decimal number. +This number of bytes follows the first 32 and will not be interpreted +by xorriso. They are rather to inform a human reader about the media type +and its track layout. +After the info text there are two 4 byte signed integers, most significant +byte first. The first one, N, gives the number of bits in the following bitmap +and the second number S gives the number of 2 KiB blocks governed by a single +bit in the map. Then come the bits in form of 8-bit bytes. +Data block M is covered by bit B=M/S in the map, bit number B is stored in +byte B/8 as bit B%8. A valid readable data block has its bit set to 1. + + Checksum Tags + +Checksum tags are data blocks inside an ISO 9660 image which do not belong to +any file but rather tell the MD5 of a certain range of data blocks. + +The superblock checksum tag is written after the ECMA-119 volume descriptors. +The tree checksum tag is written after the ECMA-119 directory entries. +The session checksum tag is written after all payload including the checksum +array. (Then follows padding.) + +The tags are single lines of printable text, padded by 0 bytes. They have +the following format: + + Tag_id pos=# range_start=# range_size=# [session_start|next=#] md5=# self=#\n + +Parameters md5= and self= are 32 digit hex, the others are decimal numbers. + +Tag_id distinguishes the following tag types + "libisofs_rlsb32_checksum_tag_v1" Relocated 64 kB superblock tag + "libisofs_sb_checksum_tag_v1" Superblock tag + "libisofs_tree_checksum_tag_v1" Directory tree tag + "libisofs_checksum_tag_v1" Session end tag + +A relocated superblock may appear at LBA 0 of an image which was produced for +being stored in a disk file or on overwriteable media (e.g. DVD+RW, BD-RE). +xorriso records the first session at LBA 32. A follow-up session +begins at the next block address which is divisible by 32 and higher than the +address of the previous session's end tag. Normally no session starts after the +address given by relocated superblock parameter session_start=. +Session oriented media like CD-R[W], DVD-R, DVD+R, BD-R will have no relocated +superblock but rather bear a table-of-content on media level. + +A tag is valid if pos= tells its own block address and self= tells its own MD5 +up to the last hex digit of md5=. range_start= tells the first block that is +covered by md5=, range_size= tells the number of blocks covered by md5=. +Relocated superblocks tell the block address of their session by session_start=. +Superblock and tree tag tell the block address of the next tag by next=. +The newline character at the end is mandatory. + + + libisoburn + +xorriso is based on libisofs which does ISO 9660 filesystem aspects and on +libburn which does the input and output aspects. Parts of this foundation +are accessed via libisoburn, which is closely related to xorriso. + +libisoburn provides several services: +- Encapsulation of coordination between libisofs and libburn. +- Emulation of ISO 9660 multi-session on overwriteable media + or random access files. +- Implementation of the xorriso API. + +The sourcecode of all three libraries is included in the xorriso standalone +tarball. It is compiled with xorriso and linked statically. +But you may as well get and install releases of libburn and libisofs, in order +to be able to install a release of libisoburn which produces libisoburn.so.1 +and a matching dynamically linked xorriso binary. +This binary is very lean but depends on properly installed libraries of +suitable revision. + +Dynamic library and compile time header requirements for libisoburn-1.1.6 : +- libburn.so.4 , version libburn-1.1.6 or higher +- libisofs.so.6 , version libisofs-1.1.6 or higher +libisoburn and xorriso will not start with libraries which are older than their +headers seen at compile time. So compile in the oldest possible installation +setup unless you have reason to enforce a newer bug fix level. + +GNU xorriso has less runtime dependencies and can be moved more freely. + + + System Dependend Drive Permission Examples + +Accessing the optical drives requires privileges which usually are granted +only to the superuser. GNU/Linux, FreeBSD and Solaris offer quite different +approaches for avoiding the need for unrestricted privileges. + +First check whether some friendly system setting already allows you to +access the drives as normal user: + xorriso -devices +Those drives of which you see address and type strings are already usable. + +If there remain drives invisible which the superuser can see by the same +command, then the following examples might help: + +--------------------- +On all three systems: +--------------------- +Add the authorized users of CD drives to group "floppy" in /etc/group. +If missing: create this group. +Changes to /etc/group often only affect new login sessions. So log out and in +before making the first tests. + +------------- +On GNU/Linux: +------------- +Allow rw-access to the drives + chgrp floppy /dev/sr0 /dev/sr1 + chmod g+rw /dev/sr0 /dev/sr1 +It might be necessary to perform chgrp and chmod after each reboot or to +edit distro dependent device configuration files for permanent settings. + +----------- +On FreeBSD: +----------- +Edit /etc/devfs.rules and make sure to have these lines + [localrules=10] + add path 'acd*' mode 0664 group floppy + add path 'cd*' mode 0664 group floppy + add path 'pass*' mode 0664 group floppy + add path 'xpt*' mode 0664 group floppy + [localrules=5] + add path 'pass*' mode 0664 group floppy + add path 'cd*' mode 0664 group floppy + add path 'xpt*' mode 0664 group floppy + add path 'acd*' mode 0664 group floppy + +Edit /etc/rc.conf and add the following line if missing + devfs_system_ruleset="localrules" + +This gets into effect by reboot or by command + /etc/rc.d/devfs start + +----------- +On Solaris: +----------- +Run xorriso by + pfexec xorriso ...arguments... + +The following settings will make pfexec keep original UID and EUID and prevent +most superuser powers. Be aware that you still can manipulate all device files +if you have the file permissions for that. +Full root privileges for xorriso can then be aquired only by command su. + +Edit /etc/security/exec_attr and add this line to the other "Media Backup" +lines: + Media Backup:solaris:cmd:::/usr/local/bin/xorriso:privs=basic,sys_devices +Edit /etc/user_attr and add profile "Media Backup" to the user's line: + thomas::::profiles=Media Backup,Primary Administrator;roles=root +See also man privileges, man exec_attr, man user_attr. + +Then allow the group r-access to the drives + pfexec chgrp floppy /dev/rdsk/c3t0d0s2 /dev/rdsk/c4t0d0s2 + pfexec chmod g+r /dev/rdsk/c3t0d0s2 /dev/rdsk/c4t0d0s2 +The last two commands have to be executed after each boot. I do not know +the relevant device configuration files yet. + + +------------------------------------------------------------------------------ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 3 or later + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +------------------------------------------------------------------------------ + + GNU xorriso is feature-wise equivalent to the dynamic compilation of + libburnia libraries and libburnia program xorriso. + It restricts itself to a technical form where the legal commitments of the + libburnia project and the legal intentions of FSF match completely. + + Libburnia project is committed to provide support for this copy in the same + way as for its own software releases. It is further committed to keep its + own licenses open for obtaining future copies under GPLv2+. + +------------------------------------------------------------------------------ +libburnia program xorriso is based on and sub project of: +libburnia-project.org +By Mario Danic , libburn, libisofs + Vreixo Formoso , libisofs, libisoburn + Thomas Schmitt , libburn, libisofs, + libisoburn, xorriso +Copyright (C) 2006-2011 Mario Danic, Vreixo Formoso, Thomas Schmitt. + +libburnia-project.org is inspired by and in libburn still containing parts +of old +Libburn. By Derek Foreman and + Ben Jansens +Copyright (C) 2002-2006 Derek Foreman and Ben Jansens + +GNU xorriso contains libjte out of source package jigit >= 1.17 +Copyright (C) 2000-2007 Free Software Foundation, Inc. + 2004-2011 Steve McIntyre + 2010-2011 George Danchev, Thomas Schmitt + +------------------------------------------------------------------------------ + +This text itself is +Copyright (c) 2007 - 2011 Thomas Schmitt +and is freely distributable. +It shall only be modified in sync with the technical properties of xorriso. +If you make use of the license to derive modified versions of xorriso +then you are entitled to modify this text under that same license. + diff --git a/libisoburn/branches/1.1.8/xorriso/aux_objects.c b/libisoburn/branches/1.1.8/xorriso/aux_objects.c new file mode 100644 index 00000000..cd43c62d --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/aux_objects.c @@ -0,0 +1,1019 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the implementations of classes: + + - SplitparT which represents byte intervals of data files. + + - DirseQ which crawls along a directory's content list. + + - ExclusionS which manages the list of excluded file paths and + leaf patterns. + Because of its structural identity it is also used for disk address + oriented hiding at insert time as of mkisofs. + + - Xorriso_lsT which provides a generic double-linked list. + + - LinkiteM, PermiteM which temporarily record relations and states. + +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" + + +/* ---------------------------- SplitparT ------------------------- */ + + +struct SplitparT { + char *name; + int partno; + int total_parts; + off_t offset; + off_t bytes; + off_t total_bytes; +}; + +static char Splitpart_wordS[][16]= {"part_", "_of_", "_at_", "_with_", "_of_"}; + + +int Splitparts_new(struct SplitparT **o, int count, int flag) +{ + int i; + + (*o)= TSOB_FELD(struct SplitparT, count); + if((*o)==NULL) + return(-1); + for(i= 0; i 1.0) + ept++; + *next_pt= ept; + return(1); +} + + +int Splitpart__parse(char *name, int *partno, int *total_parts, + off_t *offset, off_t *bytes, off_t *total_bytes, int flag) + +{ + int ret; + off_t num; + char *cpt, *ept; + + cpt= name; + if(strncmp(cpt, Splitpart_wordS[0], strlen(Splitpart_wordS[0])) != 0) + return(0); + ret= Splitpart__read_next_num(cpt, &ept, &num, 0); + if(ret<=0) + return(ret); + *partno= num; + cpt= ept; + if(strncmp(cpt, Splitpart_wordS[1], strlen(Splitpart_wordS[1])) != 0) + return(0); + ret= Splitpart__read_next_num(cpt, &ept, &num, 0); + if(ret<=0) + return(ret); + *total_parts= num; + cpt= ept; + if(strncmp(cpt, Splitpart_wordS[2], strlen(Splitpart_wordS[2])) != 0) + return(0); + ret= Splitpart__read_next_num(cpt, &ept, offset, 0); + if(ret<=0) + return(ret); + cpt= ept; + if(strncmp(cpt, Splitpart_wordS[3], strlen(Splitpart_wordS[3])) != 0) + return(0); + ret= Splitpart__read_next_num(cpt, &ept, bytes, 0); + if(ret<=0) + return(ret); + cpt= ept; + if(strncmp(cpt, Splitpart_wordS[4], strlen(Splitpart_wordS[4])) != 0) + return(0); + ret= Splitpart__read_next_num(cpt, &ept, total_bytes, 0); + if(ret<=0) + return(ret); + if(*ept != 0) + return(0); + return(1); +} + + +int Splitpart__is_part_path(char *path, int flag) +{ + int partno, total_parts, ret; + off_t offset, bytes, total_bytes; + char *name; + + name= strrchr(path, '/'); + if(name == NULL) + name= path; + else + name++; + ret= Splitpart__parse(name, &partno, &total_parts, &offset, &bytes, + &total_bytes, 0); + return(ret > 0); +} + + +/* part_#_of_#_at_#_with_#_of_# +*/ +int Splitpart__compose(char *adr, int partno, int total_parts, + off_t offset, off_t bytes, off_t total_bytes, int flag) +{ + sprintf(adr, "%s%d%s%d%s", Splitpart_wordS[0], partno, Splitpart_wordS[1], + total_parts, Splitpart_wordS[2]); + if((offset % (1024*1024))==0 && offset>0) { + Sfile_off_t_text(adr+strlen(adr), offset / (1024*1024), 0); + strcat(adr, "m"); + } else + Sfile_off_t_text(adr+strlen(adr), offset, 0); + strcat(adr, Splitpart_wordS[3]); + if((bytes % (1024*1024))==0) { + Sfile_off_t_text(adr+strlen(adr), bytes / (1024*1024), 0); + strcat(adr, "m"); + } else + Sfile_off_t_text(adr+strlen(adr), bytes, 0); + strcat(adr, Splitpart_wordS[4]); + Sfile_off_t_text(adr+strlen(adr), total_bytes, 0); + return(1); +} + + +int Splitparts_cmp(const void *v1, const void *v2) +{ + struct SplitparT *p1, *p2; + + p1= (struct SplitparT *) v1; + p2= (struct SplitparT *) v2; + + if(p1->partno>p2->partno) + return(1); + if(p1->partnopartno) + return(-1); + if(p1->offset>p2->offset) + return(1); + if(p1->offsetoffset) + return(-1); + return(0); +} + + +int Splitparts_sort(struct SplitparT *o, int count, int flag) +{ + qsort(o, (size_t) count, sizeof(struct SplitparT), Splitparts_cmp); + return(1); +} + + +/* ---------------------------- End SplitparT ------------------------- */ + + +/* ------------------------------ DirseQ ------------------------------ */ + + +static int Dirseq_buffer_sizE= 100; + +struct DirseQ { + char adr[SfileadrL]; + DIR *dirpt; + int count; + char **buffer; + int buffer_size; + int buffer_fill; + int buffer_rpt; + + struct DirseQ *next; +}; + +int Dirseq_destroy(struct DirseQ **o, int flag); +int Dirseq_next_adrblock(struct DirseQ *o, char *replies[], int *reply_count, + int max_replies, int flag); + + +int Dirseq_new(struct DirseQ **o, char *adr, int flag) +/* + bit0= with non-fatal errors do not complain about failed opendir() +*/ +{ + int ret,i,severe_error; + struct DirseQ *m; + + m= *o= TSOB_FELD(struct DirseQ,1); + if(m==NULL) + return(-1); + m->adr[0]= 0; + m->dirpt= NULL; + m->count= 0; + m->buffer= NULL; + m->buffer_size= 0; + m->buffer_fill= 0; + m->buffer_rpt= 0; + m->next= NULL; + if(Sfile_str(m->adr, adr, 0)<=0) + {ret= -1; goto failed;} + m->buffer= TSOB_FELD(char *,Dirseq_buffer_sizE); + if(m->buffer==NULL) + {ret= -1; goto failed;} + m->buffer_size= Dirseq_buffer_sizE; + for(i= 0;ibuffer_size;i++) + m->buffer[i]= NULL; + if(adr[0]==0) + m->dirpt= opendir("."); + else + m->dirpt= opendir(adr); + if(m->dirpt==NULL) { + severe_error= (errno && errno!=ENOENT && errno!=EACCES && errno!=ENOTDIR); + if(severe_error || !(flag&1)) + fprintf(stderr,"opendir(%s) failed : %s\n",adr,strerror(errno)); + ret= -severe_error; + goto failed; + } + return(1); +failed:; + Dirseq_destroy(o,0); + return(ret); +} + + +int Dirseq_destroy(struct DirseQ **o, int flag) +{ + int i; + + if(*o==NULL) + return(0); + if((*o)->dirpt!=NULL) + closedir((*o)->dirpt); + if((*o)->buffer!=NULL) { + for(i=0;i<(*o)->buffer_size;i++) + if((*o)->buffer[i]!=NULL) + free((*o)->buffer[i]); + free((char *) (*o)->buffer); + } + free((char *) *o); + (*o)= NULL; + return(1); +} + + +int Dirseq_set_next(struct DirseQ *o, struct DirseQ *next, int flag) +{ + o->next= next; + return(1); +} + + +int Dirseq_get_next(struct DirseQ *o, struct DirseQ **next, int flag) +{ + *next= o->next; + return(1); +} + + +int Dirseq_get_adr(struct DirseQ *o, char **adrpt, int flag) +{ + *adrpt= o->adr; + return(1); +} + + +int Dirseq_rewind(struct DirseQ *o, int flag) +{ + rewinddir(o->dirpt); + return(1); +} + + +int Dirseq_next_adr(struct DirseQ *o, char reply[SfileadrL], int flag) +/* +flag: + bit0= permission to use buffer + bit1= do not increment counter + bit2= ignore buffer in any case + bit3= do not exclude '.' and '..' + bit4= sort buffer + bit5= sort only incomplete last buffer +return: + <0 error + 0= no more entries available + 1= ok, reply is valid +*/ +{ + int ret; + struct dirent *entry; + char *name; + + static int override_flag_0= 0,override_flag_1= 32; + flag= (flag&~override_flag_0)|override_flag_1; + + if((flag&1) && o->buffer_rpt>=o->buffer_fill) { + /* permission to buffer and buffer empty : load a buffer */ + ret= Dirseq_next_adrblock(o,o->buffer,&(o->buffer_fill), + o->buffer_size,2|4|(flag&16)); + if(ret<=0) + return(ret); + o->buffer_rpt= 0; + if((flag&32) && o->buffer_fillbuffer_size && o->buffer_fill>0) + Sort_argv(o->buffer_fill,o->buffer,0); + } + if(o->buffer_rptbuffer_fill && !(flag&4)) { + ret= Sfile_str(reply,o->buffer[o->buffer_rpt],0); + Sregex_string(&(o->buffer[o->buffer_rpt]),NULL,0); + if(ret<=0) + return(-1); + (o->buffer_rpt)++; + if(!(flag&2)) + o->count++; + return(1); + } + do { + entry= readdir(o->dirpt); + if(entry==NULL) { + /* >>> how to distinguish error from EOF , do i need a (FILE *) ? */ + return(0); + } + if(strlen(entry->d_name)>=SfileadrL) { + fprintf(stderr,"--- oversized directory entry (number %d) :\n %s", + o->count+1,entry->d_name); + return(-1); + } + name= entry->d_name; + if(flag&8) + break; + /* skip "." and ".." */ + } while(name[0]=='.' && ((name[1]=='.' && name[2]==0) || name[1]==0)); + if(Sfile_str(reply,name,0)<=0) + return(-1); + if(!(flag&2)) + o->count++; + return(1); +} + + +int Dirseq_next_adrblock(struct DirseQ *o, char *replies[], int *reply_count, + int max_replies, int flag) +/* @param replies A vector of Sregex_string pointers */ +/* +flag: + bit0= permission to use buffer + bit1= do not increment counter + bit2= ignore buffer in any case + bit4= sort replies +return: + <0 error + 0= no more entries available + 1= ok, reply is valid +*/ +{ + int i,ret; + char *reply= NULL; + + reply= TSOB_FELD(char, SfileadrL); + if(reply == NULL) + return(-1); + + *reply_count= 0; + for(i=0;itext= NULL; + s->next= s->prev= NULL; + + if(flag & 4) { + s->text= data; + } else { + if(data_len<=0) + goto failed; + s->text= Smem_malloC(data_len); + if(s->text==NULL) + goto failed; + if(!(flag&2)) + memcpy(s->text,data,data_len); + } + + if(link==NULL) { + ; + } else if(flag&1) { + s->next= link; + s->prev= link->prev; + if(link->prev!=NULL) + link->prev->next= s; + link->prev= s; + } else { + s->prev= link; + s->next= link->next; + if(link->next!=NULL) + link->next->prev= s; + link->next= s; + } + *lstring= s; + return(1); +failed:; + *lstring= s; + Xorriso_lst_destroy(lstring,0); + return(-1); +} + + +/* + @param flag Bitfield for control purposes + see Xorriso_lst_new_binary() +*/ +int Xorriso_lst_new(struct Xorriso_lsT **lstring, char *text, + struct Xorriso_lsT *link, int flag) +{ + int ret; + + ret= Xorriso_lst_new_binary(lstring,text,strlen(text)+1,link,flag); + return(ret); +} + + +/* + @param flag Bitfield for control purposes + bit0= do not set *lstring to NULL +*/ +int Xorriso_lst_destroy(struct Xorriso_lsT **lstring, int flag) +{ + struct Xorriso_lsT *s; + + s= *lstring; + if(s==NULL) + return(0); + if(s->prev!=NULL) + s->prev->next= s->next; + if(s->next!=NULL) + s->next->prev= s->prev; + if(s->text!=NULL) + Smem_freE(s->text); + Smem_freE((char *) s); + if(!(flag&1)) + *lstring= NULL; + return(1); +} + + +int Xorriso_lst_destroy_all(struct Xorriso_lsT **lstring, int flag) +{ + struct Xorriso_lsT *s,*next; + + if(lstring==NULL) + return(-1); + if((*lstring)==NULL) + return(0); + for(s= *lstring; s->prev!=NULL; s= s->prev); + for(;s!=NULL;s= next){ + next= s->next; + Xorriso_lst_destroy(&s,0); + } + *lstring= NULL; + return(1); +} + + +int Xorriso_lst_append_binary(struct Xorriso_lsT **entry, + char *data, int data_len, int flag) +{ + struct Xorriso_lsT *target= NULL,*newby; + + if(*entry!=NULL) + for(target= *entry; target->next!=NULL; target= target->next); + if(Xorriso_lst_new_binary(&newby, data, data_len, target, flag & ~1)<=0) + return(-1); + if(*entry==NULL || (flag & 1)) + *entry= newby; + return(1); +} + + +struct Xorriso_lsT *Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag) +{ + return(entry->next); +} + + +struct Xorriso_lsT *Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag) +{ + return(entry->prev); +} + + +char *Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag) +{ + return(entry->text); +} + + +int Xorriso_lst_detach_text(struct Xorriso_lsT *entry, int flag) +{ + entry->text= NULL; + return(1); +} + + +int Xorriso_lst_get_last(struct Xorriso_lsT *entry, struct Xorriso_lsT **last, + int flag) +{ + *last= NULL; + if(entry != NULL) + for((*last)= entry; (*last)->next != NULL; (*last)= (*last)->next); + return(1); +} + + +/* --------------------------- End Xorriso_lsT ---------------------------- */ + + +/* ------------------------------ ExclusionS ------------------------------ */ + + +struct ExclusionS { + + /* Absolute input patterns which lead to not_paths */ + struct Xorriso_lsT *not_paths_descr; + + /* Actually banned absolute paths */ + struct Xorriso_lsT *not_paths; + + /* Input patterns which lead to not_leafs */ + struct Xorriso_lsT *not_leafs_descr; + + /* Compiled not_leaf patterns. Caution: not char[] but regex_t */ + struct Xorriso_lsT *not_leafs; + +}; + + +int Exclusions_new(struct ExclusionS **o, int flag) +{ + struct ExclusionS *m; + + m= *o= TSOB_FELD(struct ExclusionS, 1); + if(m==NULL) + return(-1); + m->not_paths_descr= NULL; + m->not_paths= NULL; + m->not_leafs_descr= NULL; + m->not_leafs= NULL; + return(1); +} + + +int Exclusions_destroy(struct ExclusionS **o, int flag) +{ + struct Xorriso_lsT *s,*next; + + if((*o)==NULL) + return(0); + Xorriso_lst_destroy_all(&((*o)->not_paths_descr), 0); + Xorriso_lst_destroy_all(&((*o)->not_paths), 0); + Xorriso_lst_destroy_all(&((*o)->not_leafs_descr), 0); + for(s= (*o)->not_leafs; s!=NULL; s= next){ + next= s->next; + regfree((regex_t *) s->text); + Xorriso_lst_destroy(&s, 0); + } + free((char *) *o); + (*o)= NULL; + return(1); +} + + +int Exclusions_add_not_paths(struct ExclusionS *o, int descrc, char **descrs, + int pathc, char **paths, int flag) +{ + struct Xorriso_lsT *s, *new_s; + int i, ret; + + s= NULL; + if(o->not_paths_descr!=NULL) + for(s= o->not_paths_descr; s->next!=NULL; s= s->next); + for(i= 0; inot_paths_descr==NULL) + o->not_paths_descr= new_s; + s= new_s; + } + s= NULL; + if(o->not_paths!=NULL) + for(s= o->not_paths; s->next!=NULL; s= s->next); + for(i= 0; inot_paths==NULL) + o->not_paths= new_s; + s= new_s; + } + return(1); +} + + +/* @return -1=cannot store , 0=cannot compile regex , 1=ok +*/ +int Exclusions_add_not_leafs(struct ExclusionS *o, char *not_leafs_descr, + regex_t *re, int flag) +{ + int ret; + + ret= Xorriso_lst_append_binary(&(o->not_leafs_descr), + not_leafs_descr, strlen(not_leafs_descr)+1, 0); + if(ret<=0) + return(-1); + ret= Xorriso_lst_append_binary(&(o->not_leafs), (char *) re, sizeof(regex_t), 0); + if(ret<=0) + return(-1); + return(1); +} + + +/* @param flag bit0= whole subtree is banned with -not_paths + @return 0=no match , 1=not_paths , 2=not_leafs, <0=error +*/ +int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag) +{ + struct Xorriso_lsT *s; + char *leaf= NULL, *leaf_pt; + regmatch_t match[1]; + int ret, was_non_slash, l; + + /* test abs_paths */ + if(flag&1) { + for(s= o->not_paths; s!=NULL; s= s->next) { + l= strlen(s->text); + if(strncmp(abs_path, s->text, l)==0) + if(abs_path[l]=='/' || abs_path[l]==0) + {ret= 1; goto ex;} + } + } else { + for(s= o->not_paths; s!=NULL; s= s->next) + if(strcmp(abs_path, s->text)==0) + {ret= 1; goto ex;} + } + + /* determine leafname */ + was_non_slash= 0; + for(leaf_pt= abs_path+strlen(abs_path); leaf_pt >= abs_path; leaf_pt--) { + if(*leaf_pt=='/') { + if(was_non_slash) { + leaf_pt++; + break; + } + } else if(*leaf_pt!=0) + was_non_slash= 1; + } + if(strlen(leaf_pt)>=SfileadrL) + {ret= -1; goto ex;} + leaf= strdup(leaf_pt); + leaf_pt= strchr(leaf, '/'); + if(leaf_pt!=NULL) + *leaf_pt= 0; + + /* test with leaf expressions */ + for(s= o->not_leafs; s!=NULL; s= s->next) { + ret= regexec((regex_t *) s->text, leaf, 1, match, 0); + if(ret==0) + {ret= 2; goto ex;} + } + ret= 0; +ex: + if(leaf != NULL) + free(leaf); + return(ret); +} + + +int Exclusions_get_descrs(struct ExclusionS *o, + struct Xorriso_lsT **not_paths_descr, + struct Xorriso_lsT **not_leafs_descr, int flag) +{ + *not_paths_descr= o->not_paths_descr; + *not_leafs_descr= o->not_leafs_descr; + return(1); +} + +/* ---------------------------- End ExclusionS ---------------------------- */ + + +/* ------------------------------ LinkiteM -------------------------------- */ + +struct LinkiteM { + char *link_path; + dev_t target_dev; + ino_t target_ino; + int link_count; + struct LinkiteM *next; +}; + + +int Linkitem_new(struct LinkiteM **o, char *link_path, dev_t target_dev, + ino_t target_ino, struct LinkiteM *next, int flag) +{ + struct LinkiteM *m; + + m= *o= TSOB_FELD(struct LinkiteM,1); + if(m==NULL) + return(-1); + m->target_dev= target_dev; + m->target_ino= target_ino; + m->next= next; + m->link_count= 1; + if(next!=NULL) + m->link_count= m->next->link_count+1; + m->link_path= strdup(link_path); + if(m->link_path==NULL) + goto failed; + return(1); +failed:; + Linkitem_destroy(o, 0); + return(-1); +} + + +int Linkitem_destroy(struct LinkiteM **o, int flag) +{ + if((*o)==NULL) + return(0); + if((*o)->link_path!=NULL) + free((*o)->link_path); + free((char *) (*o)); + *o= NULL; + return(1); +} + + +int Linkitem_reset_stack(struct LinkiteM **o, struct LinkiteM *to, int flag) +{ + struct LinkiteM *m, *m_next= NULL; + + /* Prevent memory corruption */ + for(m= *o; m!=to; m= m->next) + if(m==NULL) { /* this may actually not happen */ + *o= to; + return(-1); + } + + for(m= *o; m!=to; m= m_next) { + m_next= m->next; + Linkitem_destroy(&m, 0); + } + *o= to; + return(1); +} + + +int Linkitem_find(struct LinkiteM *stack, dev_t target_dev, ino_t target_ino, + struct LinkiteM **result, int flag) +{ + struct LinkiteM *m; + + for(m= stack; m!=NULL; m= m->next) { + if(target_dev == m->target_dev && target_ino == m->target_ino) { + *result= m; + return(1); + } + } + return(0); +} + + +int Linkitem_get_link_count(struct LinkiteM *item, int flag) +{ + return(item->link_count); +} + + +/* ------------------------------ PermstacK ------------------------------- */ + + +struct PermiteM { + char *disk_path; + struct stat stbuf; + struct PermiteM *next; +}; + + +int Permstack_push(struct PermiteM **o, char *disk_path, struct stat *stbuf, + int flag) +{ + struct PermiteM *m; + + m= TSOB_FELD(struct PermiteM,1); + if(m==NULL) + return(-1); + m->disk_path= NULL; + memcpy(&(m->stbuf), stbuf, sizeof(struct stat)); + m->next= *o; + + m->disk_path= strdup(disk_path); + if(m->disk_path==NULL) + goto failed; + + *o= m; + return(1); +failed:; + if(m->disk_path!=NULL) + free(m->disk_path); + free((char *) m); + return(-1); +} + + +/* @param flag bit0= minimal transfer: access permissions only + bit1= do not set timestamps +*/ +int Permstack_pop(struct PermiteM **o, struct PermiteM *stopper, + struct XorrisO *xorriso, int flag) +{ + int ret; + struct utimbuf utime_buffer; + struct PermiteM *m, *m_next; + + if((*o)==stopper) + return(1); + for(m= *o; m!=NULL; m= m->next) + if(m->next==stopper) + break; + if(m==NULL) { + sprintf(xorriso->info_text, + "Program error: Permstack_pop() : cannot find stopper"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(-1); + } + + for(m= *o; m!=stopper; m= m_next) { + ret= chmod(m->disk_path, m->stbuf.st_mode); + if(ret==-1) { + if(xorriso!=NULL) { + sprintf(xorriso->info_text, + "Cannot change access permissions of disk directory: chmod %o ", + (unsigned int) (m->stbuf.st_mode & 07777)); + Text_shellsafe(m->disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", + 0); + } + } + if(!(flag&1)) { + ret= chown(m->disk_path, m->stbuf.st_uid, m->stbuf.st_gid); + /* don't complain if it fails */ + if(!(flag&2)) { + utime_buffer.actime= m->stbuf.st_atime; + utime_buffer.modtime= m->stbuf.st_mtime; + ret= utime(m->disk_path,&utime_buffer); + if(ret==-1 && xorriso!=NULL) { + sprintf(xorriso->info_text, + "Cannot change timestamps of disk directory: "); + Text_shellsafe(m->disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", + 0); + } + } + } + m_next= m->next; + free(m->disk_path); + free((char *) m); + *o= m_next; + } + return(1); +} + + +/* ---------------------------- End PermstacK ----------------------------- */ + diff --git a/libisoburn/branches/1.1.8/xorriso/aux_objects.h b/libisoburn/branches/1.1.8/xorriso/aux_objects.h new file mode 100644 index 00000000..3a59a4af --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/aux_objects.h @@ -0,0 +1,183 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of classes: + + - SplitparT which represents byte intervals of data files. + + - DirseQ which crawls along a directory's content list. + + - ExclusionS which manages the list of excluded file paths and + leaf patterns. + + - Xorriso_lsT which provides a generic double-linked list. + + - LinkiteM, PermiteM which temporarily record relations and states. + +*/ + + +#ifndef Xorriso_pvt_auxobj_includeD +#define Xorriso_pvt_auxobj_includeD yes + +struct SplitparT; + +int Splitparts_new(struct SplitparT **o, int count, int flag); + +int Splitparts_destroy(struct SplitparT **o, int count, int flag); + +int Splitparts_set(struct SplitparT *o, int idx, + char *name, int partno, int total_parts, + off_t offset, off_t bytes, off_t total_bytes, int flag); + +int Splitparts_get(struct SplitparT *o, int idx, char **name, int *partno, + int *total_parts, off_t *offset, off_t *bytes, + off_t *total_bytes, int flag); + +int Splitpart__parse(char *name, int *partno, int *total_parts, + off_t *offset, off_t *bytes, off_t *total_bytes, int flag); + +int Splitpart__is_part_path(char *path, int flag); + +int Splitpart__compose(char *adr, int partno, int total_parts, + off_t offset, off_t bytes, off_t total_bytes, int flag); + +int Splitpart__read_next_num(char *base_pt, char **next_pt, off_t *num, + int flag); + +int Splitparts_sort(struct SplitparT *o, int count, int flag); + + + +struct DirseQ; + +int Dirseq_new(struct DirseQ **o, char *adr, int flag); + +int Dirseq_destroy(struct DirseQ **o, int flag); + +int Dirseq_next_adr(struct DirseQ *o, char reply[SfileadrL], int flag); + +int Dirseq_rewind(struct DirseQ *o, int flag); + + + +struct Xorriso_lsT { + char *text; + struct Xorriso_lsT *prev,*next; +}; + +/** Create a new list item with arbitrary byte content. + @param lstring The newly created object or NULL on failure + @param data An array of bytes to be copied into the new object + @param data_len Number of bytes to be copied + @param link Xorriso_lsT object to which the new object shall be linked + @param flag Bitfield for control purposes + bit0= insert before link rather than after it + bit1= do not copy data (e.g. because *data is invalid) + bit2= attach data directly by pointer rather than by copying + @return <=0 error, 1 ok +*/ +int Xorriso_lst_new_binary(struct Xorriso_lsT **lstring, char *data, + int data_len, struct Xorriso_lsT *link, int flag); + + +/** Create a new list item with a 0-terminated text as content. + @param lstring The newly created object or NULL on failure + @param text A 0-terminated array of bytes + @param link Xorriso_lsT object to which the new object shall be linked + @param flag see Xorriso_lst_new_binary + @return <=0 error, 1 ok +*/ +int Xorriso_lst_new(struct Xorriso_lsT **lstring, char *text, + struct Xorriso_lsT *link, int flag); + + +/** Create a new list item at the end of a given list. + @param entry Contains as input a pointer to a pointer to any existing + list item. As output this list item pointer may be + changed to the address of the new list item: + if ((*entry == 0) || (flag & 1)) + @param data An array of bytes to be copied into the new object + @param data_len Number of bytes to be copied + @param flag Bitfield for control purposes + bit0= Return new object address in *entry + bit1= do not copy data (e.g. because *data is invalid) + bit2= attach data directly by pointer rather than by copying + bit2= attach data directly by pointer rather than by copying + @return <=0 error, 1 ok +*/ +int Xorriso_lst_append_binary(struct Xorriso_lsT **entry, + char *data, int data_len, int flag); + + +/** Destroy a single list item and connect its eventual list neighbors. + @param lstring pointer to the pointer to be freed and set to NULL + @param flag unused yet, submit 0 + @return 0= *lstring was alredy NULL, 1= ok +*/ +int Xorriso_lst_destroy(struct Xorriso_lsT **lstring, int flag); + + +struct Xorriso_lsT *Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag); + +struct Xorriso_lsT *Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag); + +char *Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag); + +int Xorriso_lst_detach_text(struct Xorriso_lsT *entry, int flag); + +int Xorriso_lst_get_last(struct Xorriso_lsT *entry, struct Xorriso_lsT **last, + int flag); + + +int Exclusions_new(struct ExclusionS **o, int flag); + +int Exclusions_destroy(struct ExclusionS **o, int flag); + +int Exclusions_get_descrs(struct ExclusionS *o, + struct Xorriso_lsT **not_paths_descr, + struct Xorriso_lsT **not_leafs_descr, int flag); + +/* @param flag bit0= whole subtree is banned with -not_paths + @return 0=no match , 1=not_paths , 2=not_leafs, <0=error +*/ +int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag); + +int Exclusions_add_not_leafs(struct ExclusionS *o, char *not_leafs_descr, + regex_t *re, int flag); + +int Exclusions_add_not_paths(struct ExclusionS *o, int descrc, char **descrs, + int pathc, char **paths, int flag); + + + +struct LinkiteM; /* Trace of hops during symbolic link resolution */ + +int Linkitem_new(struct LinkiteM **o, char *link_path, dev_t target_dev, + ino_t target_ino, struct LinkiteM *next, int flag); + +int Linkitem_destroy(struct LinkiteM **o, int flag); + +int Linkitem_reset_stack(struct LinkiteM **o, struct LinkiteM *to, int flag); + +int Linkitem_find(struct LinkiteM *stack, dev_t target_dev, ino_t target_ino, + struct LinkiteM **result, int flag); + +int Linkitem_get_link_count(struct LinkiteM *item, int flag); + + +struct PermiteM; /* Stack of temporarily altered access permissions */ + +int Permstack_push(struct PermiteM **o, char *disk_path, struct stat *stbuf, + int flag); + +int Permstack_pop(struct PermiteM **o, struct PermiteM *stopper, + struct XorrisO *xorriso, int flag); + + +#endif /* ! Xorriso_pvt_auxobj_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/base_obj.c b/libisoburn/branches/1.1.8/xorriso/base_obj.c new file mode 100644 index 00000000..6878ce85 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/base_obj.c @@ -0,0 +1,650 @@ + + + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which are needed to read data + from ISO image. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STDINT_H +#include +#else +#ifdef HAVE_INTTYPES_H +#include +#endif +#endif + +#ifdef Xorriso_standalonE + +#ifdef Xorriso_with_libjtE +#include "../libjte/libjte.h" +#endif + +#else + +#ifdef Xorriso_with_libjtE +#include +#endif + +#endif /* ! Xorriso_standalonE */ + +#include "xorriso.h" +#include "xorriso_private.h" + +#include "base_obj.h" +#include "lib_mgt.h" + + + +/* See Xorriso__preset_signal_behavior() */ +static int Xorriso_signal_behavioR= 1; + + +void Xorriso__version(int *major, int *minor, int *micro) +{ + *major= Xorriso_header_version_majoR; + *minor= Xorriso_header_version_minoR; + *micro= Xorriso_header_version_micrO; +} + + +int Xorriso__is_compatible(int major, int minor, int micro, int flag) +{ + int own_major, own_minor, own_micro; + + Xorriso__version(&own_major, &own_minor, &own_micro); + return(own_major > major || + (own_major == major && (own_minor > minor || + (own_minor == minor && own_micro >= micro)))); +} + + +char *Xorriso__get_patch_level_text(int flag) +{ + return(Xorriso_program_patch_leveL); +} + + +/** The list of startup file names */ +#define Xorriso_rc_nuM 4 + +static char Xorriso_sys_rc_nameS[Xorriso_rc_nuM][80]= { + "/etc/default/xorriso", + "/etc/opt/xorriso/rc", + "/etc/xorriso/xorriso.conf", + "placeholder for $HOME/.xorrisorc" +}; + + +int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) +{ + int i, ret; + struct XorrisO *m; + char *leafname= NULL; + + leafname= TSOB_FELD(char, SfileadrL); + if(leafname == NULL) + return(-1); + *xorriso= m= TSOB_FELD(struct XorrisO,1); + if(m==NULL) { + free(leafname); + return(-1); + } + m->libs_are_started= 0; + strncpy(m->progname,progname,sizeof(m->progname)-1); + m->progname[sizeof(m->progname)-1]= 0; + if(getcwd(m->initial_wdx,sizeof(m->initial_wdx)-1)==NULL) + m->initial_wdx[0]= 0; + m->no_rc= 0; + m->argument_emulation= 0; + + m->rc_filename_count= Xorriso_rc_nuM; + for(i=0;irc_filename_count-1;i++) + strcpy(m->rc_filenames[i],Xorriso_sys_rc_nameS[i]); + m->rc_filenames[m->rc_filename_count-1][0]= 0; + m->mkisofsrc_done= 0; + + m->wdi[0]= 0; + strcpy(m->wdx, m->initial_wdx); + m->did_something_useful= 0; + m->add_plainly= 0; + m->split_size= 0; + strcpy(m->list_delimiter, "--"); + m->ino_behavior= 7; + m->iso_level= 3; + m->do_joliet= 0; + m->do_iso1999= 0; + m->do_aaip= 0; + m->do_md5= 0; + m->no_emul_toc= 0; + m->do_old_empty= 0; + m->scdbackup_tag_name[0]= 0; + m->scdbackup_tag_time[0]= 0; + m->scdbackup_tag_written[0]= 0; + m->scdbackup_tag_listname[0]= 0; + m->relax_compliance= 0; + m->untranslated_name_len= 0; + m->do_follow_pattern= 1; + m->do_follow_param= 0; + m->do_follow_links= 0; + m->follow_link_limit= 100; + m->do_follow_mount= 1; + m->do_global_uid= 0; + m->global_uid= 0; + strcpy(m->volid, "ISOIMAGE"); + m->volid_default= 1; + m->loaded_volid[0]= 0; + m->assert_volid[0]= 0; + m->assert_volid_sev[0]= 0; + m->preparer_id[0]= 0; + m->publisher[0]= 0; + m->application_id[0]= 0; + m->system_id[0]= 0; + m->volset_id[0]= 0; + m->copyright_file[0]= 0; + m->biblio_file[0]= 0; + m->abstract_file[0]= 0; + m->session_logfile[0]= 0; + m->session_lba= -1; + m->session_blocks= 0; + m->do_global_gid= 0; + m->global_gid= 0; + m->do_global_mode= 0; + m->global_dir_mode= 0555; + m->global_file_mode= 0444; + m->filters= NULL; + m->filter_list_closed= 0; + m->zlib_level_default= m->zlib_level= 6; + m->zisofs_block_size= m->zisofs_block_size_default= (1 << 15); + m->zisofs_by_magic= 0; + m->do_overwrite= 2; + m->do_reassure= 0; + m->drive_blacklist= NULL; + m->drive_greylist= NULL; + m->drive_whitelist= NULL; + m->toc_emulation_flag= 0; + m->image_start_mode= 0; + m->image_start_value[0]= 0; + m->displacement= 0; + m->displacement_sign= 0; + m->drives_exclusive= 1; + m->early_stdio_test= 0; + m->do_calm_drive= 1; + m->indev[0]= 0; + m->in_drive_handle= NULL; + m->in_volset_handle= NULL; + m->in_charset= NULL; + m->isofs_st_out= time(0) - 1; + m->indev_is_exclusive= 1; + m->indev_off_adr[0]= 0; + m->isofs_st_in= 0; + m->volset_change_pending= 0; + m->no_volset_present= 0; + m->in_sector_map= NULL; + m->check_media_default= NULL; + m->check_media_bad_limit= Xorriso_read_quality_invaliD; + m->outdev[0]= 0; + m->out_drive_handle= NULL; + m->out_charset= NULL; + m->dev_fd_1= -1; + m->outdev_is_exclusive= 1; + m->outdev_off_adr[0]= 0; + m->grow_blindly_msc2= -1; + m->ban_stdio_write= 0; + m->do_dummy= 0; + m->do_close= 0; + m->speed= 0; + m->fs= 4*512; /* 4 MiB */ + m->padding= 300*1024; + m->do_padding_by_libisofs= 0; + m->alignment= 0; + m->do_stream_recording= 0; + m->dvd_obs= 0; + m->stdio_sync= 0; + m->keep_boot_image= 0; + m->boot_image_cat_path[0]= 0; + m->boot_image_cat_hidden= 0; + m->boot_count= 0; + m->boot_platform_id= 0x00; /* El Torito Boot Catalog Platform ID: 0 = 80x86 */ + m->patch_isolinux_image= 0; + m->boot_image_bin_path[0]= 0; + m->boot_image_bin_form[0]= 0; + m->boot_image_emul= 0; + m->boot_image_load_size= 4 * 512; /* hearsay out of libisofs/demo/iso.c */ + memset(m->boot_id_string, 0, sizeof(m->boot_id_string)); + memset(m->boot_selection_crit, 0, sizeof(m->boot_selection_crit)); + +#ifdef Xorriso_with_isohybriD + m->boot_image_isohybrid= 1; +#else + m->boot_image_isohybrid= 0; +#endif + + m->boot_efi_default= 0; + m->system_area_disk_path[0]= 0; + m->system_area_options= 0; + m->patch_system_area= 0; + m->partition_offset= 0; + m->partition_secs_per_head= 0; + m->partition_heads_per_cyl= 0; + for(i= 0; i < Xorriso_max_appended_partitionS; i++) { + m->appended_partitions[i]= NULL; + m->appended_part_types[i]= 0; + } + m->ascii_disc_label[0]= 0; + m->vol_creation_time= 0; + m->vol_modification_time= 0; + m->vol_expiration_time= 0; + m->vol_effective_time= 0; + m->vol_uuid[0]= 0; + +#ifdef Xorriso_with_libjtE + m->libjte_handle= NULL; +#endif + + m->jigdo_params= NULL; + m->jigdo_values= NULL; + m->libjte_params_given= 0; + m->loaded_boot_bin_lba= 0; + m->loaded_boot_cat_path[0]= 0; + m->allow_graft_points= 0; + m->allow_restore= 0; + m->do_concat_split= 1; + m->do_auto_chmod= 0; + m->do_restore_sort_lba= 0; + m->do_strict_acl= 0; + m->dialog= 0; + m->bsl_interpretation= 0; + m->search_mode= 0; + m->structured_search= 1; + m->do_iso_rr_pattern= 1; + m->do_disk_pattern= 2; + m->temp_mem_limit= 16*1024*1024; + m->file_size_limit= Xorriso_default_file_size_limiT; + m->disk_exclusions= NULL; + m->iso_rr_hidings= NULL; + m->joliet_hidings= NULL; + m->disk_excl_mode= 1; + m->use_stdin= 0; + m->result_page_length= 0; + m->result_page_width= 80; + m->mark_text[0]= 0; + m->packet_output= 0; + for(i=0; i<4; i++) { + m->logfile[i][0]= 0; + m->logfile_fp[i]= NULL; + } + m->pktlog_fp= NULL; + for(i= 0; i < Xorriso_max_outlist_stacK; i++) { + m->result_msglists[i]= NULL; + m->info_msglists[i]= NULL; + m->msglist_flags[i]= 0; + } + m->msglist_stackfill= 0; + m->status_history_max= Xorriso_status_history_maX; + m->scsi_log= 0; + strcpy(m->report_about_text, "UPDATE"); + Xorriso__text_to_sev(m->report_about_text, &m->report_about_severity, 0); + m->library_msg_direct_print= 0; + strcpy(m->abort_on_text,"FAILURE"); + Xorriso__text_to_sev(m->abort_on_text, &m->abort_on_severity, 0); + m->abort_on_is_default= 1; + m->problem_status= 0; + m->problem_status_text[0]= 0; + m->errfile_log[0]= 0; + m->errfile_mode= 0; + m->errfile_fp= NULL; + + m->img_read_error_mode= 1; /* abort faulty image reading with FAILURE */ + m->extract_error_mode= 1; /* keep extracted files after read error */ + strcpy(m->return_with_text, "SORRY"); + Xorriso__text_to_sev(m->return_with_text, &m->return_with_severity, 0); + m->return_with_value= 32; + m->eternal_problem_status= 0; + m->eternal_problem_status_text[0]= 0; + m->re= NULL; + /* >>> ??? how to initialize m->match[0] ? */ + m->re_constants= NULL; + m->re_count= 0; + m->re_fill= 0; + m->reg_expr[0]= 0; + m->run_state= 0; + m->is_dialog= 0; + m->bar_is_fresh= 0; + m->pending_option[0]= 0; + m->request_to_abort= 0; + m->request_not_to_ask= 0; + m->idle_time= 0.0; + m->re_failed_at= -1; + m->prepended_wd= 0; + m->insert_count= 0; + m->insert_bytes= 0; + m->error_count= 0; + m->pacifier_style= 0; + m->pacifier_interval= 1.0; + m->pacifier_count= 0; + m->pacifier_total= 0; + m->pacifier_byte_count= 0; + m->pacifier_fifo= NULL; + m->start_time= 0.0; + m->last_update_time= 0.0; + m->find_compare_result= 1; + m->find_check_md5_result= 0; + m->last_abort_file_time= 0.0; + + m->node_counter= 0; + m->node_array_size= 0; + m->node_array= NULL; + m->node_disk_prefixes= NULL; + m->node_img_prefixes= NULL; + + m->hln_count= 0; + m->hln_array= NULL; + m->hln_targets= NULL; + m->hln_change_pending= 0; + m->di_do_widen= NULL; + m->di_disk_paths= NULL; + m->di_iso_paths= NULL; + + m->node_targets_availmem= 0; + + m->di_count= 0; + m->di_array= NULL; + + m->perm_stack= NULL; + + m->update_flags= 0; + + m->result_line[0]= 0; + m->result_line_counter= 0; + m->result_page_counter= 0; + m->result_open_line_len= 0; + + m->info_text[0]= 0; + + ret= Sfile_leafname(progname, leafname, 0); + if(ret<=0) + goto failure; + if(strcmp(leafname, "osirrox")==0) { + m->allow_restore= 1; + m->drives_exclusive= 0; + } else if(strcmp(leafname, "xorrisofs")==0 || strcmp(leafname, "genisofs")==0 || + strcmp(leafname, "mkisofs")==0 || strcmp(leafname, "genisoimage")==0) { + m->argument_emulation= 1; + m->pacifier_style= 1; + Xorriso_protect_stdout(*xorriso, 0); + } else if(strcmp(leafname, "xorrecord")==0 || strcmp(leafname, "wodim")==0 || + strcmp(leafname, "cdrecord")==0 || strcmp(leafname, "cdrskin")==0) { + m->argument_emulation= 2; + m->pacifier_style= 2; + } + ret= Exclusions_new(&(m->disk_exclusions), 0); + if(ret<=0) + goto failure; + ret= Exclusions_new(&(m->iso_rr_hidings), 0); + if(ret<=0) + goto failure; + ret= Exclusions_new(&(m->joliet_hidings), 0); + if(ret<=0) + goto failure; + Xorriso_relax_compliance(m, "default", 0); + ret= Xorriso_lst_new(&(m->drive_greylist), "/dev", m->drive_greylist, 1); + if(ret <= 0) + goto failure; + Xorriso_preparer_string(m, m->preparer_id, 1); /* avoids library calls */ + + if(leafname != NULL) + free(leafname); + return(1); +failure:; + Xorriso_destroy(xorriso, 0); + if(leafname != NULL) + free(leafname); + return(-1); +} + + +int Xorriso_destroy_re(struct XorrisO *m, int flag) +{ + int i; + + if(m->re!=NULL) { + for(i=0;ire_fill;i++) { + if(m->re_constants!=NULL) + if(m->re_constants[i]!=NULL) + continue; /* ,->re[i] was never subject to regcomp() */ + regfree(&(m->re[i])); + } + free((char *) m->re); + m->re= NULL; + } + + if(m->re_constants!=NULL) { + for(i=0;ire_fill;i++) + if(m->re_constants[i]!=NULL) + free(m->re_constants[i]); + free((char *) m->re_constants); + m->re_constants= NULL; + } + m->re_count= 0; + m->re_fill= 0; + return(1); +} + + +/* @param flag bit0= global shutdown of libraries */ +int Xorriso_destroy(struct XorrisO **xorriso, int flag) +{ + struct XorrisO *m; + int i; + + m= *xorriso; + if(m==NULL) + return(0); + + /* Give up drives and image to unref all connected xorriso objects */ + Xorriso_give_up_drive(m, 3); + + if(m->in_charset!=NULL) + free(m->in_charset); + if(m->out_charset!=NULL) + free(m->out_charset); + Xorriso_destroy_re(m,0); + Exclusions_destroy(&(m->disk_exclusions), 0); + Exclusions_destroy(&(m->iso_rr_hidings), 0); + Exclusions_destroy(&(m->joliet_hidings), 0); + Xorriso_destroy_all_extf(m, 0); + Xorriso_lst_destroy_all(&(m->drive_blacklist), 0); + Xorriso_lst_destroy_all(&(m->drive_greylist), 0); + Xorriso_lst_destroy_all(&(m->drive_whitelist), 0); + Xorriso_destroy_node_array(m, 0); + Xorriso_destroy_hln_array(m, 0); + Xorriso_destroy_di_array(m, 0); + +#ifdef Xorriso_with_libjtE + if(m->libjte_handle) + libjte_destroy(&(m->libjte_handle)); +#endif + + Xorriso_lst_destroy_all(&(m->jigdo_params), 0); + Xorriso_lst_destroy_all(&(m->jigdo_values), 0); + for(i= 0; i < Xorriso_max_appended_partitionS; i++) + if(m->appended_partitions[i] != NULL) + free(m->appended_partitions[i]); + + Xorriso_detach_libraries(m, flag&1); + + free((char *) m); + *xorriso= NULL; + return(1); +} + + +int Xorriso_destroy_node_array(struct XorrisO *xorriso, int flag) +{ + int i; + + if(xorriso->node_array != NULL) { + for(i= 0; i < xorriso->node_counter; i++) + iso_node_unref((IsoNode *) xorriso->node_array[i]); + free(xorriso->node_array); + } + xorriso->node_array= NULL; + xorriso->node_counter= xorriso->node_array_size= 0; + Xorriso_lst_destroy_all(&(xorriso->node_disk_prefixes), 0); + Xorriso_lst_destroy_all(&(xorriso->node_img_prefixes), 0); + return(1); +} + + +/* @param flag bit0= do not destroy hln_array but only hln_targets +*/ +int Xorriso_destroy_hln_array(struct XorrisO *xorriso, int flag) +{ + int i; + + + if(xorriso->hln_array != NULL && !(flag & 1)) { + for(i= 0; i < xorriso->hln_count; i++) + iso_node_unref((IsoNode *) xorriso->hln_array[i]); + free(xorriso->hln_array); + xorriso->hln_array= NULL; + xorriso->hln_count= 0; + } + if(xorriso->hln_targets != NULL) { + for(i= 0; i < xorriso->hln_count; i++) + if(xorriso->hln_targets[i] != NULL) + free(xorriso->hln_targets[i]); + free(xorriso->hln_targets); + xorriso->hln_targets= NULL; + } + xorriso->node_targets_availmem= 0; + return(1); +} + + +int Xorriso_destroy_di_array(struct XorrisO *xorriso, int flag) +{ + int i; + + if(xorriso->di_array != NULL) { + for(i= 0; i < xorriso->di_count; i++) + if(xorriso->di_array[i] != NULL) + iso_node_unref((IsoNode *) xorriso->di_array[i]); + free(xorriso->di_array); + xorriso->di_array= NULL; + } + if(xorriso->di_do_widen != NULL) { + free(xorriso->di_do_widen); + xorriso->di_do_widen= NULL; + } + Xorriso_lst_destroy_all(&(xorriso->di_disk_paths), 0); + Xorriso_lst_destroy_all(&(xorriso->di_iso_paths), 0); + xorriso->di_count= 0; + +#ifdef NIX + /* <<< */ + fprintf(stderr, "xorriso_DEBUG: get_di_count= %lu\n", + Xorriso_get_di_counteR); +#endif /* NIX */ + + return(1); +} + + +int Xorriso_new_node_array(struct XorrisO *xorriso, off_t mem_limit, + int addon_nodes, int flag) +{ + int i; + + if(xorriso->node_counter <= 0) + return(1); + + xorriso->node_array= calloc(xorriso->node_counter + addon_nodes, + sizeof(IsoNode *)); + if(xorriso->node_array == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + for(i= 0; i < xorriso->node_counter + addon_nodes; i++) + xorriso->node_array[i]= NULL; + xorriso->node_array_size= xorriso->node_counter + addon_nodes; + xorriso->node_counter= 0; + return(1); +} + + +/* @param flag bit0= do not allocate hln_array but only hln_targets +*/ +int Xorriso_new_hln_array(struct XorrisO *xorriso, off_t mem_limit, int flag) +{ + int i; + + Xorriso_destroy_hln_array(xorriso, flag & 1); + if(xorriso->hln_count <= 0) + return(1); + + if(!(flag & 1)) { + xorriso->hln_array= calloc(xorriso->hln_count, sizeof(char *)); + if(xorriso->hln_array == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + for(i= 0; i < xorriso->hln_count; i++) + xorriso->hln_array[i]= NULL; + } + + xorriso->hln_targets= calloc(xorriso->hln_count, sizeof(char *)); + if(xorriso->hln_targets == NULL) { + if(!(flag & 1)) { + free(xorriso->hln_array); + xorriso->hln_array= NULL; + } + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + for(i= 0; i < xorriso->hln_count; i++) + xorriso->hln_targets[i]= NULL; + xorriso->node_targets_availmem= mem_limit + - xorriso->hln_count * sizeof(void *) + - xorriso->hln_count * sizeof(char *); + if(xorriso->node_targets_availmem < 0) + xorriso->node_targets_availmem= 0; + return(1); +} + + +int Xorriso__preset_signal_behavior(int behavior, int flag) +{ + if(behavior < 0 || behavior > 3) + return(0); + Xorriso_signal_behavioR= behavior; + return(1); +} + + +int Xorriso__get_signal_behavior(int flag) +{ + return(Xorriso_signal_behavioR); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/base_obj.h b/libisoburn/branches/1.1.8/xorriso/base_obj.h new file mode 100644 index 00000000..7fb60eba --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/base_obj.h @@ -0,0 +1,31 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which perform the + fundamental operations of the XorrisO object. +*/ + + +#ifndef Xorriso_pvt_base_obj_includeD +#define Xorriso_pvt_base_obj_includeD yes + + +#ifdef NIX +/* <<< */ +unsigned long Xorriso_get_di_counteR= 0; +#endif /* NIX */ + +struct XorrisO; + + +int Xorriso_destroy_re(struct XorrisO *m, int flag); + +int Xorriso__get_signal_behavior(int flag); + + +#endif /* ! Xorriso_pvt_base_obj_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/changelog.txt b/libisoburn/branches/1.1.8/xorriso/changelog.txt new file mode 100644 index 00000000..75824422 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/changelog.txt @@ -0,0 +1,12154 @@ +------------------------------------------------------------------------------ + libburnia-project.org libisoburn , xorriso +------------------------------------------------------------------------------ + +------------------------------------------------------------------------------ + Changelog +------------------------------------------------------------------------------ + + +1 Sep 2007 [983] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Initial content of libisoburn + +1 Sep 2007 [985] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +Should have used copy+paste when writing Vreixos name + +5 Sep 2007 [990] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +Implemented use of stdio-pseudo-drives + +5 Sep 2007 [993] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +Changes in plans as discussed up to Sep 5 2007 + +5 Sep 2007 [994] +libisoburn/libisoburn.h +Updated explanations about the usage principles of libisoburn + +6 Sep 2007 [998] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +Updated to state of discussion + +9 Sep 2007 [1025] +libisoburn/burn_wrap.c +New wrapper isoburn_disc_erasable() declares ISO DVD-RAM, DVD+RW erasable + +10 Sep 2007 [1027] +libisoburn/libisoburn.h +New wrapper isoburn_disc_erasable() declares ISO DVD-RAM, DVD+RW erasable + +11 Sep 2007 [1029] +libisoburn/burn_wrap.c +libisoburn/isoburn.h +New inner function isoburn_set_start_byte() + +12 Sep 2007 [1031] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +Removed isoburn_write_opts_set_start_byte() + +13 Sep 2007 [1043] +libisoburn/burn_wrap.c +Took into respect fabricated_disc_status + +21 Sep 2007 [1092] +Makefile.am +Removed libburn file addresses + +22 Sep 2007 [1093] ++ doc/doxygen.conf.in +Added file demanded by build system + +22 Sep 2007 [1094] +src/burn_wrap.c +Prevented SIGSEGV in isoburn_drive_scan_and_grab() + +22 Sep 2007 [1095] +src/burn_wrap.c +Enabled treatment==2 in isoburn_drive_scan_and_grab() + +22 Sep 2007 [1099] +src/burn_wrap.c +Made use of burn_msgs_submit() for error messages + +23 Sep 2007 [1102] +src/burn_wrap.c +Removed all references to isoburn.treatment from burn_wrap.c + +23 Sep 2007 [1105] +src/burn_wrap.c +Called isoburn_create_data_source() and isoburn_free_data_source() + +28 Sep 2007 [1129] libisofs +libisofs/libiso_msgs.h +Removed apostrophes which my compiler does not like + +29 Sep 2007 [1133] +src/burn_wrap.c +Added optional code for a pseudo CD-RW to test the code for MMC multi-session + +29 Sep 2007 [1134] +src/burn_wrap.c +Released drive in case welcome_media fails + +1 Oct 2007 [1141] +src/burn_wrap.c +Allowed isoburn_disc_get_msc1() for closed media + +2 Oct 2007 [1149] +test/test.c +Function graft_point(),some general polishing, call of iso_volset_free disabled + +8 Oct 2007 [1169] +src/libisoburn.h +src/isoburn.h +src/isoburn.c +src/burn_wrap.c +Introduced fifo reference into isoburn object + +8 Oct 2007 [1170] +test/test.c +Several directories and files in one session, added display of fifo + +12 Oct 2007 [1171] ++ test/xorriso.h ++ test/xorriso.c ++ test/xorriso.txt +The stub of new application xorriso + +12 Oct 2007 [1172] ++ test/compile_xorriso.sh ++ test/make_timestamp.sh ++ test/xorriso_timestamp.h +A build facility to circumvent autotools during development + +12 Oct 2007 [1173] +test/xorriso.c +Introduced version and build timestamps, library headers + +13 Oct 2007 [1174] +test/xorriso.c ++ test/changelog.txt +Made -dialog and -options_from_file work + +2007.10.13.141503 [1175] +test/xorriso.c +Implemented -speed and enlarged -status list + +2007.10.13.152252 [1176] +test/xorriso.c +test/xorriso.txt +Implemented xorriso setter level of -fs, -gid, -uid + +2007.10.14.110003 [1177] +test/xorriso.c +Implemented setter level of -abort_on, fixed bugs about -f,-no_rc,startup files + +2007.10.14.122456 [1178] +test/xorriso.c ++ test/xorriso_private.h ++ test/xorrisoburn.h ++ test/xorrisoburn.c +Began to implement interface to our libraries + +2007.10.15.152705 [1183] +test/xorriso.h +test/xorriso.c +test/xorriso_private.h +test/xorrisoburn.h +test/xorrisoburn.c +Implemented -dev, -add, -commit + +2007.10.15.160303 [1184] +test/xorriso.c +Made -end give up drives + +2007.10.15.203554 [1185] +test/xorriso.c +Some safety precautions against malicious input, enabled -cdx, -cdi for -add + +2007.10.15.203714 [1186] +test/xorrisoburn.c +Corrected image path bug with -add of regular files, and -add /=/some/dir + +2007.10.15.224005 [1187] +test/xorriso.c +test/xorrisoburn.c +Implemented -rollback + +2007.10.16.210911 [1188] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Worked on failure severities, message system, program abort decision + +2007.10.17.130041 [1190] [1191 +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Worked on failure severities, message system, program abort decision + +2007.10.17.130311 [1192] +src/isofs_wrap.c +Told burn_read_data() to stay silent on non-existent drive or read error + +2007.10.17.150142 [1193] +test/xorriso.c +test/xorrisoburn.c +Reinstated the distinction of message sources, respected '#' in dialog + +2007.10.17.165352 [1194] +test/xorriso.c +Prepended a "-" to any input line if missing + +2007.10.17.183024 [1195] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Implemented core of option -toc + +2007.10.17.200241 [1196] +test/xorrisoburn.c +Continued work with -toc + +2007.10.17.213852 [1197] +test/compile_xorriso.sh +Forgot to make off_t 64 bit + +2007.10.17.214228 [1198] +src/libisoburn.h +src/burn_wrap.c +test/xorrisoburn.c +Rounding up fabricated nwa to full 32k addresses, API call for exact image size + +2007.10.17.215809 [1199] +test/xorriso.c +Activated -ban_stdio_write + +2007.10.17.224924 [1200] +test/xorrisoburn.c +Fixed obvious bug with -J. (Still wondering wether it works) + +2007.10.17.225039 [1201] +test/xorriso.c +Fixed bug with -speed. + +2007.10.17.225837 [1202] +test/xorriso.c +Fixed bug with -prompt. Fixed bug with # comments. (of rev 1194) + +18 Oct 2007 [1203] +test/changelog.txt +Updated changelog and todo list + +2007.10.18.144841 [1205] +src/isofs_wrap.c +test/xorrisoburn.c +isoburn_read_volset() now hands out an official volset reference + +2007.10.18.171415 [1206] +test/xorriso.c +test/xorriso.txt +test/xorrisoburn.h +test/xorrisoburn.c +Implemented option -devices + +2007.10.18.183200 [1207] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Implemented option -tell_media_space + +2007.10.18.185731 [1208] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.c +Fixed a SIGSEGV with xorriso -version run + +2007.10.18.221756 [1211] +test/xorrisoburn.c +src/libisoburn.h +Took care of disposal of burn_disc ovbject + +18 Oct 2007 [1212] +test/test.c +Silenced compile warning + +2007.10.18.225654 [1213] +src/isofs_wrap.c +test/xorriso.c +test/xorrisoburn.c +Fixed a SIGSEGV with empty drive + +2007.10.19.140031 [1218] +test/xorrisoburn.c +Made reports with -add normal infos (formerly NOTE events) + +2007.10.19.151339 [1219] +test/xorriso.c +test/xorrisoburn.c +test/xorriso.txt +Implemented -print-size + +2007.10.19.164957 [1220] +test/xorriso_private.h +test/xorriso.c +test/xorriso.h +test/xorrisoburn.c +test/xorriso.txt +Implemented verbosity control by option -report_about + +2007.10.19.173547 [1221] +test/xorriso.c +test/xorrisoburn.c +test/xorriso.txt +Implemented option -eject + +2007.10.19.204155 [1222] +test/xorriso_private.h +test/xorriso.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Implemented option -blank + +2007.10.20.170731 [1223] +src/burn_wrap.c +Directed write mode failure message to libburn queue, repaired wrote_well + +2007.10.20.171046 [1224] +test/xorrisoburn.c +test/xorriso_private.h +test/xorriso.c +Implemented options -format and -blank deformat, -close and closed media + +20 Oct 2007 [1225] +test/xorriso.txt ++ test/xorriso.1 +test/changelog.txt +Splitted think text from emerging man page, formatted man page + +2007.10.20.194918 [1226] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Completed -tell_media_space, checked space before burn, failed -end exits >0 + +20 Oct 2007 [1227] +test/xorriso.1 +Polished man page + +2007.10.21.094818 [1228] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented -rm and -rm_r + +2007.10.21.105228 [1229] +src/data_source.c +Silenced compiler warning about C++ style comment + +2007.10.21.124315 [1230] +test/xorriso.c +test/xorrisoburn.c +test/xorrisoburn.h +Began to implement -ls and -ls_l, enhanced -cdi, not done yet + +2007.10.21.151124 [1231] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.c +test/xorrisoburn.h +Hopefully completed -cd alias -cdi + +2007.10.21.185248 [1232] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Hopefully completed -cdx + +2007.10.21.213303 [1233] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented sorting of -ls by node name, implemented leaf name search patterns + +2007.10.22.211928 [1237] +test/xorrisoburn.c +test/xorriso.1 +Implemented file size and mtime for -ls_l + +2007.10.23.122349 [1238] +src/libisoburn.h +src/isoburn.c +Added fifo_size to struct isoburn_source_opts + +2007.10.23.122753 [1239] +test/xorrisoburn.c +test/xorriso.c +test/xorriso.1 +Made use of isoburn_source_opts.fifo_size + +2007.10.24.100156 [1244] +test/xorriso.c +test/xorrisoburn.c +Normalized paths to target and source before adding or removing from image + +2007.10.24.105424 [1245] +test/xorriso.c +test/xorriso.h +Implemented option -path-list + +2007.10.24.175337 [1247] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Made -cd useable with no image loaded + +2007.10.27.224148 [1257] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented option -mv + +2007.10.27.230512 [1258] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Bug fixes with option -mv + +2007.10.28.125501 [1260] +test/xorriso.c +test/xorrisoburn.c +Prevented some interesting pitfalls with -mv + +2007.10.28.165516 [1261] +test/xorriso.c +test/xorriso.1 +test/xorrisoburn.h +test/xorrisoburn.c +Implemented option -mkdir + +2007.10.28.174550 [1262] +test/xorriso.c +Warning of wildcards in paths + +28 Oct 2007 [1263] +test/xorriso.1 +Updated man page about -path-list + +2007.10.29.213920 [1273] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Structured patterns for options -ls and -ls_l + +2007.10.30.214242 [1274] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +test/compile_xorriso.sh +Multiple structured patterns, changed option -ls from single to multi args + +2007.10.31.103338 [1275] +test/xorriso_private.h +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented new option -temp_mem_limit + +2007.10.31.165413 [1276] +test/xorriso.c +test/xorrisoburn.c +test/xorrisoburn.h +Gave simple -ls an implemention with minimal memory consumption + +31 Oct 2007 [1277] +test/xorriso.1 +Overhauled info paragraphs of man page + +2007.10.31.175916 [1278] +test/xorriso_private.h +Overhauled comments in struct XorrisO + +31 Oct 2007 [1279] +test/changelog.txt +Updating changelog + +2007.11.01.111351 [1280] +test/xorrisoburn.c +Got rid of bad pacifier text at end of CD writing + +2007.11.01.191106 [1281] +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +test/xorrisoburn.h +test/xorriso.1 +Implemented option -du + +2007.11.02.143549 [1282] +test/xorrisoburn.h +test/xorrisoburn.c +Clearer status messages after reading new volume and after burning + +2007.11.02.143658 [1283] +test/xorriso.c +Made -abort_on and -report_about complain with bad severity names + +2007.11.02.184705 [1284] +test/xorrisoburn.c +test/xorriso.1 +Polished write success message and man page + +2007.11.06.163305 [1285] +test/xorriso_private.h +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented -overwrite control + +2007.11.06.163929 [1286] +src/libisoburn.h +Corrected a typo in a comment + +2007.11.06.164029 [1287] +src/isoburn.c +Closed memory leak by freeing session and track in isoburn_prepare_disc_aux() + +2007.11.07.123744 [1288] +test/xorriso_private.h +test/xorriso.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented option -reassure + +2007.11.07.150157 [1289] +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented option -rmdir + +2007.11.07.191915 [1290] +test/xorriso.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +Implemented option -chmod (does not get written into image, though) + +2007.11.07.225624 [1291] +test/xorriso.c +test/xorrisoburn.c +test/xorrisoburn.h +Implemented options -chown and -chgrp (not written into image, though) + +2007.11.08.144451 [1292] +test/xorriso.c +test/xorrisoburn.c +test/xorrisoburn.h +test/xorriso.1 +Implemented option -alter_date, corrected write problem with mode and ownership + +2007.11.08.145016 [1293] +test/xorriso_private.h +Forgotten source file for rev 1292 + +8 Nov 2007 [1294] +test/xorriso.1 +Enhanced man page text for options -chmod, -chown, -chgrp + +2007.11.08.160302 [1295] +test/xorriso.c +Fixed bug with -chmod go=r + +2007.11.08.161215 [1296] +test/xorriso.c +test/xorrisoburn.c +Enlarged string size limit of Text_shellsafe() + +2007.11.09.193142 [1297] +test/xorriso_private.h +test/xorriso.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +New option -iso_rr_pattern, influencing several options with multiple args + +2007.11.11.112321 [1298] +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +Gave problem handling finer granularity within loops + +11 Nov 2007 [1299] +test/xorriso.1 +Clarified man page + +2007.11.11.154453 [1300] +test/xorriso.c +Added missing commit to normal end of program + +11 Nov 2007 [1301] +test/xorriso.1 +Added some examples to man page + +2007.11.14.142904 [1302] +src/libisoburn.h +src/isofs_wrap.c +src/isoburn.c +test/test.c +New API call isoburn_attach_volset(), changes with isoburn_read_volset() + +2007.11.14.143119 [1303] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented options -outdev and -indev + +2007.11.14.175446 [1304] +test/xorriso.c +Corrected premature abort bug with misspelled command words + +14 Nov 2007 [1305] +test/xorriso.1 +Polished xorriso man page + +14 Nov 2007 [1306] +test/changelog.txt +Updated xorriso changelog + +2007.11.26.192113 [1311] +test/xorriso.c +test/xorrisoburn.c +Reacted on warnings on a 64 bit system + +2007.12.04.074340 [1314] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented -disk_pattern, -lsx, ls_lx, -dux, -du_lx + +2007.12.04.205919 [1315] +test/xorrisoburn.c +test/xorriso_private.h +test/xorriso.c +Removed some redundancy of disk_pattern and iso_rr_pattern matching + +4 Dec 2007 [1316] +test/xorriso.1 +Polished man page + +2007.12.05.090438 [1317] +test/xorriso.h +test/xorriso.c +test/xorriso.1 +Option -f-off as counterpart of option -f + +2007.12.05.143632 [1318] +test/xorriso.c +Made dashes at options optional + +5 Dec 2007 [1319] +test/xorriso.1 +Overhauled description of media types, states and expansion methods + +2007.12.06.150102 [1320] +test/xorriso.h +test/xorriso.c +test/xorriso.1 +Changed -f, -f-off to -follow, -graft-points, -graf-points-off to -pathspecs + +6 Dec 2007 [1321] +test/xorriso.1 +Removed references to option -graft-points + +2007.12.06.192437 [1322] +test/xorriso.c +Corrected warning function about wildcards + +8 Dec 2007 [1326] +test/xorriso.1 +Explained result pager + +2007.12.08.175117 [1327] +test/xorriso.c +test/xorriso_private.h +test/xorrisoburn.c +Removed more code redundancies and fd leak with Xorriso_obtain_pattern_files_x() + +2007.12.15.162039 [1328] +test/compile_xorriso.sh +Added -O0 to -g to get better gdb behavior on my new system + +2007.12.15.183022 [1329] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented option -follow + +2007.12.16.103456 [1330] +test/xorriso.c +test/xorriso.1 +Added link hop limit to option -follow + +2007.12.16.122626 [1331] +test/xorrisoburn.c +Added copying of attributes from symbolic link into image + +2007.12.16.144615 [1332] +test/xorrisoburn.c +Removed waste of time in Xorriso_show_du_subs() + +2007.12.18.175924 [1333] +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Changed options -ls* to -lsd*, introduced new family of -ls* without d + +2007.12.20.111338 [1334] +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Changed -du_s* into -dus* + +2007.12.21.131538 [1335] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented option -find alias -findi + +2007.12.21.132017 [1336] +test/xorriso.c +test/xorriso.1 +Corrected documentation about -find + +2007.12.22.143803 [1337] +test/xorriso.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented option -findx + +2007.12.24.161107 [1339] +test/xorriso.c +Repaired options -dus and -dusx + +24 Dec 2007 [1340] +test/changelog.txt +Updated changelog + +2007.12.25.160100 [1341] +test/xorriso.h +test/xorriso.c +test/xorriso.1 +Implemented option -cpr + +2007.12.26.160040 [1342] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Changed option -J to -joliet "on"|"off", implemented option -volid + +2007.12.28.132741 [1343] +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.c +Made leaner the local memory of recursive functions (because of ulimit -s) + +2007.12.30.190138 [1344] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.c +test/xorriso.1 +Implemented -find option -exec echo, chown, chgrp, chmod, alter_date, lsdl + +2007.12.30.203336 [1345] +test/xorriso.c +Corrected superuser behavior of Sfile_lookup_permissions() + +2007.12.31.095229 [1346] +test/xorriso.c +test/xorrisoburn.c +Repaired some bugs in -find and -findx + +2007.12.31.135237 [1347] +test/xorriso.h +test/xorriso.c +test/xorriso.1 +Implemented options -chown_r, -chgrp_r, -chmod_r, -alter_date_r + +2007.12.31.135330 [1348] +test/xorrisoburn.c +Repaired a bug in -find + +2008.01.01.123118 [1349] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorrisoburn.h +test/xorrisoburn.c +test/xorriso.1 +Implemented -find actions chown_r, chgrp_r, chmod_r, alter_date_r, find + +2008.01.02.175011 [1350] +test/xorriso.c +test/xorriso.1 +Implemented -find test -type + +2008.01.09.175418 [1351] +test/xorrisoburn.c +Corrections made during porting to nglibisofs + +2008.01.10.114451 [1352] ++ test/ng_xorrisoburn.h ++ test/ng_xorrisoburn.c +test/compile_xorriso.sh +Begin of porting to next generation libisofs + +2008.01.10.151924 [1353] +Makefile.am ++ ng_src ++ ng_src/libisoburn.h ++ ng_src/isoburn.h ++ ng_src/isoburn.c ++ ng_src/isofs_wrap.c ++ ng_src/data_source.c ++ ng_src/burn_wrap.c +Begin of porting to next generation libisofs + +2008.01.10.152353 [1354] +test/ng_xorrisoburn.c +test/compile_xorriso.sh +Made compile_xorriso.sh -nglibisofs work on ./ng_src + +2008.01.10.154948 [1355] +test/ng_xorrisoburn.c +test/compile_xorriso.sh +Made compile_xorriso.sh -oglibisofs work on ./og_src + +2008.01.11.133319 [1356] +test/compile_xorriso.sh +Adapted to existence of nglibisofs eltorito.o + +2008.01.11.133631 [1357] +test/xorriso.c +test/ng_xorrisoburn.c +test/xorrisoburn.c +Removed old and new bugs + +2008.01.11.174733 [1358] +test/xorriso.c +test/ng_xorrisoburn.c +test/xorrisoburn.c +Tracing the different behavior of isoburn_read_image() + +2008.01.11.175423 [1359] +test/ng_xorrisoburn.c +ng_src/isoburn.c +ng_src/libisoburn.h +Changed isoburn_source_opts.ouput_charset to output_charset + +2008.01.11.212545 [1361] +ng_src/isofs_wrap.c +Made initialization of iso_read_opts safer + +13 Jan 2008 [1364] ++ og_src +- src src/burn_wrap.c +- src/isoburn.c +- src/isoburn.h +- src/data_source.c +- src/isofs_wrap.c +- src/libisoburn.h ++ og_src/burn_wrap.c ++ og_src/isoburn.c ++ og_src/isoburn.h ++ og_src/data_source.c ++ og_src/isofs_wrap.c ++ og_src/libisoburn.h +Moved src to og_src and installed symbolic link instead + +13 Jan 2008 [1365] +ng_src/isofs_wrap.c +Changes about blanking loaded image + +2008.01.13.224929 [1366] +test/ng_xorrisoburn.c +Allowed all filetypes as input, silenced debug during image read + +14 Jan 2008 [1367] +test/compile_xorriso.sh +Added forgotten source module + +14 Jan 2006 [1368] +ng_src/libisoburn.h +ng_src/isoburn.c +New members in isoburn_source_opts + +2008.01.14.163814 [1369] +test/ng_xorrisoburn.c +Closed memory leak, adapted to new members in isoburn_source_opts + +2008.01.14.164628 [1370] +test/ng_xorrisoburn.c +Repaired memory hog and a freshly introduced bug + +2008.01.14.190220 [1371] +test/xorriso.c +test/ng_xorrisoburn.c +test/xorriso.1 +Removed some bugs and made adaptions to nglibisofs + +2008.01.14.224645 [1372] +test/xorriso_private.h +test/xorriso.c +test/ng_xorrisoburn.h +test/ng_xorrisoburn.c +test/xorriso.1 +Made improvements around volume id + +2008.01.15.174409 [1373] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/ng_xorrisoburn.h +test/ng_xorrisoburn.c +test/xorrisoburn.h +test/xorrisoburn.c +Made improvements about pattern matching .., closed small memory leaks + +2008.01.15.204057 [1374] +test/xorriso.c +test/ng_xorrisoburn.h +test/ng_xorrisoburn.c +test/xorrisoburn.h +test/xorrisoburn.c +Closed a small memory leak + +2008.01.15.211511 [1375] +test/ng_xorrisoburn.c +Added a forgotten iso_dir_iter_free() + +2008.01.16.132909 [1376] +ng_src/isofs_wrap.c +Repaired bug about MMC multi-session image loading + +2008.01.16.141631 [1378] +ng_src/isoburn.c +Changed default name of initial image to ISOIMAGE + +16 Jan 2008 [1378] +libisoburn.pc.in +Set correct name of library + +2008.01.16.200942 [1379] +test/xorriso.c +test/ng_xorrisoburn.c +Adaption to Xorriso_standalonE, some consequences from compiler warnings + +16 Jan 2008 [1380] ++ test/make_xorriso_standalone.sh ++ test/xorriso_makefile_am.txt ++ test/configure_ac.txt ++ test/xorriso_pc_in.txt +A sketch of a xorriso source standalone release generator + +16 Jan 2008 [1381] +test/configure_ac.txt +test/xorriso_makefile_am.txt +Added a test for readline.h and eventually enabled use of libreadline + +2008.01.17.145135 [1382] +test/ng_xorrisoburn.c +Silenced -pedantic compiler warnings about type punning + +17 Jan 2008 [1385] +test/make_xorriso_standalone.sh +Silenced most compiler warnings of libisofs in xorriso-standalone + +17 Jan 2008 [1386] ++ test/README +Began a README file for xorriso + +18 Jan 2008 [1387] +test/make_xorriso_standalone.sh +test/README ++ test/xorriso_eng.html +Worked on documentation + +2008.01.18.101933 [1388] +test/xorriso.c +Changed -report_about default to "UPDATE" + +18 Jan 2008 [1389] +test/xorriso.1 +test/make_xorriso_standalone.sh ++ test/convert_man_to_html.sh +Made a generator for HTML man page + +2008.01.19.090417 [1390] +ng_src/libisoburn.h +ng_src/isoburn.c +ng_src/isofs_wrap.c +test/ng_xorrisoburn.c +test/compile_xorriso.sh +test/xorriso_makefile_am.txt +Adaptions to revision 241 of nglibisofs + +2008.01.19.090546 [1391] +test/xorriso.c +Added startup message. Removed helptext sentence about unimplemented options + +19 Jan 2008 [1392] +test/xorriso_eng.html +test/make_xorriso_standalone.sh +Producing a bootstrapped xorriso standalone tarball + +19 Jan 2008 [1393] +test/README +test/xorriso.1 +test/xorriso_eng.html +Some polishing of xorriso documentation + +2008.01.19.162244 [1394] +test/xorriso.c +test/ng_xorrisoburn.c +Small corrections with version number and write counter report + +19 Jan 2008 [1395] +test/changelog.txt +Updated SVN copy of changelog + +2008.01.20.102946 [1397] +ng_src/burn_wrap.c +ng_src/data_source.c +ng_src/isoburn.c +ng_src/isofs_wrap.c +Made forgotten adaption to Xorriso_standalonE + +2008.01.20.131050 [1398] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/ng_xorrisoburn.c +test/xorriso.1 +Made -outdev stdio:/dev/fd/1 safe for single session runs + +2008.01.20.200254 [1399] +test/xorriso.h +test/xorriso_private.h +test/xorriso.c +test/xorriso.1 +New option -add_plainly + +2008.01.21.221939 [1400] +test/xorriso.c +test/xorriso.1 +Rejected unsuitable addresses "stdio:" , "stdio:/", "stdio:-", "stdio:." + +22 Jan 2008 [1401] ++ test/compare_file.c +Program which compares two files in different trees. Attributes and content. + +22 Jan 2008 [1402] +test/configure_ac.txt +Copied test for tm.tm_gmtim from libisofs configure.ac + +22 Jan 2008 [1403] +test/compare_file.c +Prepended type indication letter to report lines + +2008.01.22.224321 [1404] +test/ng_xorrisoburn.c +Better attributes with directories + +2008.01.23.195855 [] +ng_src/burn_wrap.c +test/ng_xorrisoburn.c +Adapted to libisofs revision 261 + +24 Jan 2008 [1410] +test/make_xorriso_standalone.sh +Removed remover of C++ comment lines + +2008.01.24.202206 [1411] +ng_src/isoburn.c +ng_src/burn_wrap.c +ng_src/isoburn.h +Gave up use of libburn fifo. Attached -fs and pacifier to libisofs fifo. + +2008.01.25.150902 [1413] +test/xorriso.h +test/xorriso.c +test/xorriso.1 +New option -rollback_end + +25 Jan 2008 [1414] +test/compare_file.c +Fixed bug about file content comparison. + +25 Jan 2008 [1415] +test/compare_file.c +Better handling of various content difference situations + +2008.01.25.175353 [1416] +test/xorriso.h +test/xorriso.c +test/xorriso.1 +test/ng_xorrisoburn.c +New option -commit_eject + +2008.01.26.002011 [1417] +- og_src/libisoburn.h +- og_src/isoburn.h +- og_src/isoburn.c +- og_src/isofs_wrap.c +- og_src/burn_wrap.c +- og_src/data_source.c +- og_src/ ++ libisoburn/ +- ng_src/libisoburn.h +- ng_src/isoburn.h +- ng_src/isoburn.c +- ng_src/isofs_wrap.c +- ng_src/burn_wrap.c +- ng_src/data_source.c ++ libisoburn/libisoburn.h ++ libisoburn/isoburn.h +*+ libisoburn/isoburn.c +*+ libisoburn/isofs_wrap.c +*+ libisoburn/burn_wrap.c +*+ libisoburn/data_source.c ++ xorriso/ +- test/README +- test/changelog.txt +- test/compare_file.c +- test/compile_xorriso.sh +- test/configure_ac.txt +- test/convert_man_to_html.sh +- test/make_timestamp.sh +- test/make_xorriso_standalone.sh +- test/ng_xorrisoburn.c +- test/ng_xorrisoburn.h +- test/xorriso.1 +- test/xorriso.c +- test/xorriso.h +- test/xorriso_eng.html +- test/xorriso_makefile_am.txt +- test/xorriso_pc_in.txt +- test/xorriso_private.h +- test/xorriso_timestamp.h +- test/xorrisoburn.c +- test/xorrisoburn.h ++ xorriso/README ++ xorriso/changelog.txt ++ xorriso/compare_file.c +*+ xorriso/compile_xorriso.sh ++ xorriso/configure_ac.txt +*+ xorriso/convert_man_to_html.sh +*+ xorriso/make_timestamp.sh +*+ xorriso/make_xorriso_standalone.sh ++ xorriso/xorriso.1 +*+ xorriso/xorriso.c ++ xorriso/xorriso.h ++ xorriso/xorriso_eng.html ++ xorriso/xorriso_makefile_am.txt ++ xorriso/xorriso_pc_in.txt ++ xorriso/xorriso_private.h ++ xorriso/xorriso_timestamp.h +*+ xorriso/xorrisoburn.c ++ xorriso/xorrisoburn.h +Makefile.am +Gave up adapter to old libisofs. Renaming libisoburn and xorriso dirs. + +2008.01.26.113604 [1418] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +INCOMPATIBLE API CHANGE: isoburn_initialize(char msg[1024], int flag) + +2008.01.26.120534 [1419] +libisoburn/libisoburn.h +configure.ac +version.h.in +libisoburn/isoburn.c +libisoburn/burn_wrap.c +Introduced versioning (still pre-release) and new API function isoburn_version() + +2008.01.26.140005 [1423] +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_eng.html +Adapted standalone tarball to version functions + +2008.01.26.142130 [1424] +xorriso/xorriso.c +Set program revision to 0.0.1 (previous 0.1.0 was too early) + +2008.01.26.171156 [1425] +libisoburn/libisoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +INCOMPATIBLE API CHANGE: isoburn_prepare_new_image() now gets output drive + +2008.01.27.174454 [1434] +xorriso/xorriso.c +xorriso/xorriso.1 +Changed meaning of -add relative/path + +2008.01.28.105404 [1435] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Made use of iso_set_abort_severity() with option -abort_on + +2008.01.28.140149 [1436] +libisoburn/libisoburn.h +Updated API introduction and marked API instabilities for mending (soon) + +2008.01.28.171915 [1437] +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +xorriso/xorrisoburn.c +xorriso/compile_xorriso.sh +xorriso/make_xorriso_standalone.sh +Adapted to libisofs revison 294 + +2008.01.28.235717 [1438] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +xorriso/xorrisoburn.c +Changed struct isoburn_source_opts to opaque handle struct isoburn_imgen_opts + +2008.01.29.125956 [1439] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +xorriso/xorrisoburn.c +Changed struct isoburn_read_opts to opaque handle + +2008.01.29.184356 [1440] +configure.ac +version.h.in +libisoburn/libisoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +xorriso/configure_ac.txt +New API call isoburn_is_compatible() + +29 Jan 2008 [1441] +libisoburn/libisoburn.h +Some API documentation enhancements + +2008.01.29.211543 [1443] +libisoburn/burn_wrap.c +Made use of newest libburn version features + +2008.01.31.152131 [1449] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +xorriso/make_xorriso_standalone.sh +Adapted to libisofs revision 313 + +2008.01.31.214647 [1450] +xorriso/xorrisoburn.h +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +xorriso/make_xorriso_standalone.sh +Compile time and runtime checks for library compatibility + +2008.02.01.195817 [1455] +configure.ac +Makefile.am +- libisoburn.pc.in ++ libisoburn-1.pc.in +xorriso/README +Enabled build of dynamically linked xorriso, joined -1.pc club + +2008.02.01.200153 [1456] +xorriso/xorriso_makefile_am.txt +Corrected some false paths in xorriso-standalone Makefile.am + +2008.02.02.131049 [1457] +configure.ac +Added version checks for libburn and libisofs (by Vreixo) + +2008.02.02.131903 [1458] +xorriso/xorriso.h +xorriso/xorriso.c +Added argument to option -commit_eject + +2 Feb 2008 [1459] +xorriso/xorriso_eng.html +Updated to current state of development + +2008.02.02.181200 [1460] +xorriso/xorrisoburn.c +Compile time check of libisoburn. Enforced minimum track size of 300 sectors. + +2008.02.03.131525 [1466] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +xorriso/xorrisoburn.c +Made use of ISO_ERR_SEV() and ISO_ERR_PRIO() + +2008.02.03.155704 [1467] +libisoburn/isofs_wrap.c +Adapted to libisofs revisio 328 + +2008.02.03.164038 [1468] +libisoburn/libisoburn.h +libisoburn/isoburn.c +xorriso/xorrisoburn.c +New API call isoburn_cancel_prepared_write() + +2008.02.03.164916 [1469] +xorriso/xorrisoburn.c +Reacted on compiler warning + +2008.02.03.181259 [1470] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Made -abort_on and -report_about preemptive if given as dashed start arguments + +2008.02.04.093106 [1471] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Adapted to libisofs revision 332 + +2008.02.04.154405 [1472] +libisoburn/libisoburn.h +libisoburn/isoburn.c +xorriso/xorrisoburn.c +New API call isoburn_sync_after_write() + +2008.02.04.184038 [1475] +libisoburn/libisoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +xorriso/xorrisoburn.c +Inserted problem messages where libisoburn API produces own failures + +2008.02.04.214133 [1476] +libisoburn/libisoburn.h +libisoburn/isoburn.c +xorriso/xorrisoburn.c +Added parameter to new API calls isoburn_cancel_prepared_write, isoburn_sync_after_write + +2008.02.05.162621 [1477] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -padding + +2008.02.05.175733 [1478] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +Implemented reassure for -rollback, -rollback_end, -end, -commit, -commit_eject + +2008.02.05.191456 [1479] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +Implemented reassure for -blank, -format, -dev, -indev, -devices + +2008.02.06.131028 [1480] +xorriso/xorriso.c +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +Now loading libraries before -version, pacifier for -add + +2008.02.06.153709 [1481] +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorriso.1 +xorriso/xorrisoburn.c +Rectified SORRY,FAILURE,FATAL classification + +2008.02.06.183423 [1484] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Adapted to libisofs revision 337 + +2008.02.06.183557 [1485] +xorriso/xorriso.c +Removed some unused code + +2009.02.06.184008 [1486] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Added a missing 0 digit + +2008.02.06.214426 [1487] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +xorriso/xorrisoburn.c +Pacifier for isoburn_read_image() + +2008.02.07.074248 [1489] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso_private.h +Added final message to image read pacifier + +2008.02.07.154947 [1490] +libisoburn/data_source.c +Implemented a primitive single tile cache for image reading + +2008.02.07.211424 [1491] +libisoburn/data_source.c +Stuffed memory leak with read cache. Economized on error retries. + +8 Feb 2008 [1494] +- xorriso/compare_file. ++ test/compare_file.c +- ng_src +Cleaning up remainings of move to ng_src + +8 Feb 2008 [1495] +test/compare_file.c +Fixed an endless cycle with early EOF + +2008.02.08.102122 [1496] +xorriso/xorriso_makefile_am.txt +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/README +Added test/compare_file.c to xorriso-standalone tarball + +2008.02.08.173928 [1497] +2008.02.08.174126 [1498] +libisoburn/data_source.c +Renamed macro which controls read caching + +2008.02.08.175152 [1499] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Protecting volume ids from getting overwritten by predecessor + +2008.02.08.195627 [1500] +xorriso/xorriso.c +Warning of -volid which are not ECMA 119 compliant + +2008.02.08.215113 [1501] +xorriso/xorriso.h +xorriso/xorriso.c +Silenced misleading toc messages with -commit_eject "in" + +2008.02.09.092805 [1502] +libisoburn/libisoburn.h +libisoburn/isoburn.c +Adapted to libisofs revision 346 + +2008.02.09.100750 [1503] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +New API function isoburn_disc_available_space() fixes bug with DVD+RW capacity + +10 Feb 2008 [1504] +xorriso/README +Some adjustments in description of compare_file and libisoburn + +2008.02.10.122020 [1505] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Fixed bugs about -mv /im/age . -cdx / -cpr di/sk im/age -- -cpr di/sk . -- + +2008.02.10.130852 [1506] +Makefile.am +Added build of test/compare_file as noinst binary + +2008.02.10.135822 [1507] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Better handling of not-yet-existing -cd + +2008.02.11.094742 [1509] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Discarding, keeping or patching boot images from existing ISO images + +2008.02.11.112917 [1510] +xorriso/xorrisoburn.c +Corrected message about isolinux patch option + +2008.02.11.113235 [1511] +xorriso/xorriso.h +xorriso/xorriso.c +Final UPDATE message after grafting in files from disk + +2008.02.11.135418 [1512] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +New option -return_with + +2008.02.11.150123 [1513] +xorriso/xorrisoburn.c +isoburn_igopt_allow_full_ascii for -bootimage any keep + +2008.02.11.150700 [1514] +xorriso/xorriso.c +xorriso/xorriso.1 +Clarifications about -volid rules + +11 Feb 2008 [1515] +xorriso/README +Adjustments about libisoburn and xorriso dynamic dependencies, compare_file + +2008.02.11.162406 [1516] +xorriso/xorrisoburn.c +xorriso/xorriso.c +Changed failure to find a file for removal from FAILURE to SORRY + +2008.02.11.174517 [1517] +xorriso/xorriso.c +Corrected a bug about -status -return_with + +2008.02.11.194807 [1519] +libisoburn/burn_wrap.c +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New severity MISHAP + +2008.02.11.213918 [1520] +xorriso/xorrisoburn.c +Mapping in burn runs -abort_on MISHAP to SORRY + +2008.02.12.215327 [1521] +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +Improved MISHAP - SORRY mapping and tunneling + +2008.02.14.084342 [1525] ++ README ++ COPYING ++ COPYRIGHT ++ INSTALL +libisoburn/libisoburn.h +Completing documentation + +2008.02.14.101916 [1526] +Makefile.am +Adjusted EXTRA_DIST list of files + +2008.02.14.120557 [1527] +xorriso/xorrisoburn.c +Made a final abort check before burning begins + +2008.02.14.175623 [1528] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Imprinting version of xorriso and libraries into ISO preparer_id + +2008.02.14.182351 [1529] +xorriso/xorrisoburn.c +Made preparer_id more safe against oversize + +14 Feb 2008 [1530] +xorriso/xorriso.1 +Polished man page + +14 Feb 2008 [1531] +xorriso/changelog.txt +Updated changelog + +2008.02.15.100001 [branch 1533] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/compile_xorriso.sh +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Made version number leap to 0.1.0 + +15 Feb 2008 [branch 1534] +xorriso/changelog.txt +Documented initial release and timestamp + +15 Feb 2008 [1536] +configure.ac +Increased libisofs requirement to 0.6.2 + +----------------------------- release - xorriso-0.1.0.pl00 - 2008.02.15.100001 +* Operates on an existing ISO image or creates a new one. +* Copies files from filesystem into the ISO image. +* Renames or deletes file objects in the ISO image. +* Changes file properties in the ISO image. +* Can write result as completely new image to optical media + or filesystem objects. +* Can write result as add-on session to appendable + multi-session media, to overwriteable media, + to regular files, and to block devices. +* Scans for optical drives, blanks re-useable optical media. +* Reads its instructions from command line arguments, dialog, and batch files. +* Provides navigation commands for interactive ISO image manipulation. +* Adjustable thresholds for abort, exit value, and problem reporting. + + +2008.02.15.211836 [1537] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/compile_xorriso.sh +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.1 + +15 Feb 2008 [1538] +COPYRIGHT +Corrected according to content of libisofs/COPYRIGHT + +2008.02.15.212030 [1539] +xorriso/xorriso.c +Changed pacifier text for 0 nodes read from blank image + +------------------------------------ cycle - xorriso-0.1.1 - 2008.02.15.212030 + +15 Feb 2008 [1540] +xorriso/changelog.txt +Updated changelog + +16 Feb 2008 [1543] +xorriso/xorriso.1 +Adjusted CREDITS text + +2008.02.16.202533 [1544] +xorriso/xorriso_private.h +xorriso/xorrisoburn.c +Transfering properties from disk to implicit directories in image path + +2008.02.16.211549 [1545] +xorriso/xorriso_eng.html +xorriso/changelog.txt +Mentioned better directory attribute copying + +------------------------------------ cycle - xorriso-0.1.1 - 2008.02.16.211549 +* Improved attribute transfer from disk for implicit target directories + +2008.02.18.210343 [1546] +xorriso/xorriso.c +Bug fix: -report_about higher than NOTE did not report at all + +19 Feb 2008 [1547] +test/compare_file.c +Improved report format + +2008.02.19.184432 [1548] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -as cdrecord emulates a narrow set of cdrecord gestures + +2008.02.19.212322 [1549] +xorriso/xorriso.c +xorriso/xorriso_private.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Improved -as cdrecord + +20 Feb 2008 [1550] +test/compare_file.c +Revoked inflation of file type characters to words + +2008.02.20.234726 [1551] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -as mkisofs emulates a narrow set of mkisofs gestures + +------------------------------------ cycle - xorriso-0.1.1 - 2008.02.21.090014 +* Bug fix: -report_about HINT or higher did not report at all +* Bug fix: speed=number without unit or media type letter was always CD speed +* Bug fix: it was possible to write to appendable media which was not -indev +* New option -as "cdrecord" emulates a narrow set of cdrecord gestures +* New option -as "mkisofs" emulates a narrow set of mkisofs gestures + +2008.02.21.090014 [1552] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +New option -publisher + +2008.02.21.185203 [1553] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Implemented a more reasonable solution for drive truncation with regular files + +2008.02.21.204613 [1558] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Introduced new severity ERRFILE + +2008.02.21.211101 [1559] +xorriso/xorriso.c +Updated -help text + +2008.02.22.114917 [1561] +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +Producing ERRFILE messages where appropriate + +2008.02.23.101619 [1568] +libisoburn/libisoburn.h +Changed libisofs requirements to 0.6.3 + +2008.02.23.101619 [1569] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Testwise implementation of libisofs.0.6.3 features + +2008.02.23.101619 [1570] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorriso.1 +New option -errfile_log + +2008.02.23.102903 [1571] +xorriso/configure_ac.txt +Made libisofs version leap in xorriso-standalone + +2008.02.23.113902 [1572] +xorriso/xorriso.h +xorriso/xorriso.c +Directed -as mkisofs -print-size to real stdout + +2008.02.23.125537 [1573] +xorriso/xorrisoburn.c +Various bugs and deviations around -as mkisofs -print-size + +2008.02.23.131825 [1574] +xorriso/xorrisoburn.c +Wrong description text + +2008.02.25.090001 [ZeroOneZero-pl01 1576 1577] +libisoburn/burn_wrap.c +xorriso/xorriso_timestamp.h +Safety cap for ABI usage bug towards libisofs >= 0.6.2 + +2008.02.25.174229 [1579] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Adapted to libisofs 362 from Vreixo bzr + +2008.02.25.204402 [1580] +xorriso/xorriso.c +Adaptions of -as mkisofs and -as cdrecord to enable full use by scdbackup + +25 Feb 2008 [1581] +xorriso/changelog.txt +Updated changelog + +------------------------------------ cycle - xorriso-0.1.1 - 2008.02.25.204402 +* New option -publisher +* New option -errfile_log + + +26 Feb 2008 [1582] +test/compare_file.c +Avoided to read content of non-regular files + +2008.02.26.213437 [1583] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -compare + +2008.02.27.185744 [1584] +xorriso/xorriso.c +Installed pacifier for data reading + +2008.02.28.132656 [1587] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Added new action "compare" to -find + +28 Feb 2008 [1588] +xorriso/xorriso_eng.html +Mentioned capability to write DVD+R/DL. + +2008.02.28.212210 [1589] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +New option -compare_r + +28 Feb 2008 [1590] +xorriso/xorriso.1 +New option -compare_r, new -findx -exec in_iso, -exec no_in_iso + +28 Feb 2008 [1591] +test/compare_file.c +Micro bug fix ported from xorriso + +2008.02.28.215343 [1592] +xorriso/xorriso.c +Better handling of disk to iso address mapping during compare runs + +2008.02.29.200510 [1593] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -update (not yet completed) + +2008.03.01.151219 [1594] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option update_r, -find actions "update" and "add_missing" (not yet completed) + +2008.03.02.172751 [1596] +xorriso/xorrisoburn.c +Made -update_r and -find -exec update safe against IsoDirIter pitfalls + +2008.03.02.201455 [1597] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Made IsoDirIter workaround obey -temp_mem_limit + +4 Mar 2008 [libisofs_thomas 1599 1600] +Switch to Vreixo development branch 378 + +2008.03.04.174107 [1601] +xorriso/make_xorriso_standalone.sh +xorriso/xorriso_makefile_am.txt +Adapted to libisofs Vreixo 378 + +2008.03.04.180738 [1602] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Improvements about -update_r and -compare_r + +2008.03.05.125118 [1603] +xorriso/xorrisoburn.c +Bug fix: -follow param did not work for symbolic links + +------------------------------------ cycle - xorriso-0.1.1 - 2008.03.05.125118 +* Support for DVD+R/DL media +* Bug fix: -follow param did not work for adding non-directory symbolic links + + +2008.03.05.173329 [1604] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Made -compare* and -update* obey -follow links (-follow mount still not correct) + +5 Mar 2008 [1605] +xorriso/xorriso.1 +Some man page clarification + +2008.03.06.114233 [1606] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -find actions "rm" and "rm_r", silenced comparison results with -update* + +2008.03.06.174724 [1608] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Fixed bug about non existing disk_path with -update_r + +7 Mar 2008 [1609] +xorriso/xorriso_eng.html +Re-arranged development download part + +2008.03.07.075325 [1610] +xorriso/xorriso.c +xorriso/xorrisoburn.c +New -findx -type "m" for active mount points + +2008.03.07.182411 [1611] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -findx -exec action "empty_iso_dir", workaround for ticket 132 + +2008.03.07.220442 [1612] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Made -update_r and -compare_r obey disabling of -follow "mount" + +8 Mar 2008 [libisofs_thomas 1613] +Switch to Vreixo development branch 383 + +2008.03.08.104231 [1614] +xorriso/xorrisoburn.c +Adapted to iso_tree_add_new_node() + +8 Mar 2008 [1615] +xorriso/xorriso.1 +Example use case for -update_r "Incremental backup of a few directory trees" + +------------------------------------ cycle - xorriso-0.1.1 - 2008.03.08.122747 +* Bug fix: It was not possible to -add /THIS=a /b=THIS +* New options -compare, -compare_r and according -find -exec action +* New options -update, -update_r and according -find -exec action +* New -find actions "rm", "rm_r", new -findx -type "m" -exec "empty_iso_dir" + + +2008.03.09.142200 [1616] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -cut_out + +9 Mar 2008 [libisofs_thomas 1617] +Switch to Vreixo development branch 386 + +2008.03.09.211041 [1618] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Some polishing about -cut_out + +2008.03.11.113444 [1619] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Sketched split file scheme with partno,totalparts,offset,count,totalsize + +11 Mar 2008 [1620] +xorriso/xorriso.1 +Updated description of -cut_out + +------------------------------------ cycle - xorriso-0.1.1 - 2008.03.11.113444 +* New option -cut_out + + +2008.03.12.100001 [XorrisoZeroOneTwo 1626] +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to xorriso-0.1.2 + +---------------------------------- release - xorriso-0.1.2 - 2008.03.12.100001 +* Bug fix: -report_about HINT or higher did not report at all +* Bug fix: speed=number without unit or media type letter was always CD speed +* Bug fix: it was possible to write to appendable media which was not -indev +* Bug fix: -follow param did not work for adding non-directory symbolic links +* Bug fix: It was not possible to -add /THIS=a /b=THIS +* Improved attribute transfer from disk for implicit target directories +* New option -as "cdrecord" emulates a narrow set of cdrecord gestures +* New option -as "mkisofs" emulates a narrow set of mkisofs gestures +* New option -publisher +* New option -errfile_log +* Support for DVD+R/DL media +* New options -compare, -compare_r and according -find -exec action +* New options -update, -update_r and according -find -exec action +* New -find actions "rm", "rm_r", new -findx -type "m" -exec "empty_iso_dir" +* New option -cut_out + + +2008.03.12.130605 [1627] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.3 + +------------------------------------ cycle - xorriso-0.1.3 - 2008.03.12.130605 + +12 Mar 2008 [XorrisoZeroOneTwo 1628] [1629] +xorriso/changelog.txt +Documented changes and release timestamp + +2008.03.19.081837 [1637] +xorriso/xorriso.c +Bug fix: -as mkisofs -nopad must be -no-pad + +19 Mar 2008 [1638] +xorriso/xorriso.1 +Added a hint about alternating media with -update_r + +------------------------------------ cycle - xorriso-0.1.3 - 2008.03.19.081837 +* Bug fix: -as mkisofs -no-pad was misspelled -nopad + + +20 Mar 2008 [1639] +xorriso/README +Added -commit_eject all to an example which involves mount + +2008.03.20.192317 [1640] +xorriso/xorriso.c +Changed messages of -update and -update_r + +2008.03.20.210522 [1641] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Better handling of attempt to manipulate non-existent ISO image + +2008.03.22.130031 [1642] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Working towards coordination of -compare, -update and -cut_out + +2008.03.22.130128 [1643] +xorriso/xorrisoburn.c +Bug fix: Implicite directory attribute copying with -cut_out was wrong + +------------------------------------ cycle - xorriso-0.1.3 - 2008.03.22.130128 +* Bug fix: Implicite directory attribute copying with -cut_out was wrong + + +22 Mar 2008 [1644] +xorriso/xorriso.1 +Correction about Linux mount which does not accept session= with DVD. + +2008.03.25.170747 [1645] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Working towards coordination of -compare, -update and -cut_out + +2008.03.26.092120 [1646] +xorriso/xorrisoburn.c +Gave up obsoleted macros and their code branches + +2008.03.27.103344 [1647] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Working towards coordination of -update and -cut_out + +27 Mar 2008 [1648] +xorriso/xorriso.1 +Published coordination rules for -cut_out, -compare and -update + +2008.03.29.164038 [1649] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -split_size, automated splitting of oversized files + +------------------------------------ cycle - xorriso-0.1.3 - 2008.03.29.164038 +* Coordination of -cut_out, -compare and -update +* New option -split_size, automated splitting of oversized files + +2008.03.31.081347 [1650] +xorriso/xorriso.c +xorriso/xorriso.1 +Adjusted documentation of -split_size + +2008.04.01.213121 [1652] +libisoburn/data_source.c +Replaced single 128 kB cache tile by 32 tiles of 64 kB each + +2 Apr 2008 [1653] +COPYRIGHT +Corrected GPL version + +------------------------------------ cycle - xorriso-0.1.3 - 2008.04.03.074309 +* Improved performance with reading directory trees + +2008.04.03.204051 [1657] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -session_log + +5 Apr 2008 [1658] +xorriso/xorriso.1 +Mentioned that drives close full media automatically + +2008.04.05.112055 [1659] +xorriso/xorrisoburn.c +Reporting amount of non-data with -toc media summary + +5 Apr 2008 [1660] +xorriso/xorriso_eng.html +Mentioned new features + +------------------------------------ cycle - xorriso-0.1.3 - 2008.04.05.112055 +* New option -session_log + +2008.04.07.185727 [1662] +xorriso/xorriso.h +Added prototype of Xorriso_option_session_log() + +2008.04.07.201253 [1664] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Removed some unused code + +8 Apr 2008 [1677] +xorriso/configure_ac.txt +Followed version leaps of libburn + +2008.04.08.153508 [1678] +libisoburn/libisoburn.h +xorriso/xorrisoburn.c +Made libisoburn and xorriso require libburn >= 0.4.4 + +2008.04.09.114815 [1679] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Corrected behavior around image data read error + +2008.04.12.112159 [1682] +xorriso/xorriso.c +Changed behavior of -commit_eject "" + +2008.04.18.184517 [1690] +libisoburn/data_source.c +Restricted ds_read_block() messages about unreadable data to actual data block + +2008.04.20.111054 [1692] +libisoburn/data_source.c +Corrected maximum age value for read buffer tiles + +20 Apr 2008 [1693] +xorriso/xorriso.1 +Mentioned stdin with option -path_list + +2008.04.20.111419 [1694] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Displaying free space rather than "non-data" on drive aquiry and -toc + +28 Apr 2008 [1709] +xorriso/configure_ac.txt +Updated libisofs version number in xorriso-standalone + +------------------------------------ cycle - xorriso-0.1.3 - 2008.04.28.082539 +* Now depending on libisofs-0.6.4 + +2008.04.28.120001 [branch 1711] +configure.ac +README +libisoburn/libisoburn.h (isoburn_header_version_*) +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h (xorriso_libisoburn_req_*) +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.4 + +28 Apr 2008 [branch 1712] +xorriso/changelog.txt +Documented changes and release timestamp + +---------------------------------- release - xorriso-0.1.4 - 2008.04.28.120001 +* Bug fix: -as mkisofs -no-pad was misspelled -nopad +* Bug fix: Implicite directory attribute copying with -cut_out was wrong +* Coordination of -cut_out, -compare and -update +* New option -split_size, automated splitting of oversized files +* Improved performance with reading directory trees +* New option -session_log +* Dynamically linkable with release version 0.6.4 of libisofs + + +2008.04.28.122244 [1713] +configure.ac +README +libisoburn/libisoburn.h (isoburn_header_version_*) +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h (xorriso_libisoburn_req_*) +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.5 + +28 Apr 2008 [1714] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.1.5 - 2008.04.28.122244 + +2008.05.01.124248 [1716] +libisoburn/isofs_wrap.c +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -error_behavior with a first occasion 'image_loading' + +1 May 2008 [1717] +xorriso/convert_man_to_html.sh +Fine tuning of HTML man page appearance + +1 May 2008 [1718] +xorriso/xorriso.1 +Clarified "best_effort" behavior + +2008.05.01.135421 [1719] +libisoburn/data_source.c +Adjusted ds_read_block() to inofficial libisofs expectations + +2008.05.01.174110 [1720] +libisoburn/data_source.c +Adjusted ds_read_block() to inofficial libisofs expectations + +2008.05.02.072505 [1721] +libisoburn/data_source.c +Adjusted ds_read_block() to inofficial libisofs expectations + +2008.05.02.204942 [1722] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Working towards exclusion of user defined absolute paths and leaf patterns + +2008.05.03.151106 [1724] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Working towards exclusion of user defined absolute paths and leaf patterns + +2008.05.03.223204 [1725] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Working towards exclusion of user defined absolute paths and leaf patterns + +2008.05.04.133525 [1726] +xorriso/xorriso.c +xorriso/xorriso.1 +New options -not_paths, -not_leaf, -not_list, -not_mgt, -as mkisofs -m + +4 May 2008 [1727] +xorriso/xorriso_eng.html +xorriso/changelog.txt +Mentioned new options + +------------------------------------ cycle - xorriso-0.1.5 - 2008.05.04.133525 +* New option -error_behavior with a first occasion 'image_loading' +* New options -not_paths, -not_leaf, -not_list, -not_mgt, -as mkisofs -m + + +2008.05.05.210317 [1728] +xorriso/xorrisoburn.c +After formatting DVD-RW write 128 MB and close track to end Intermediate State + +2008.05.06.084439 [1731] +xorriso/xorrisoburn.c +Calling isoburn_cancel_prepared_write() after failed isoburn_disc_write() + +2008.05.06.144606 [1732] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +Experiment for TOC on overwriteables: Keep a target_head copy of session #1 + +2008.05.07.071427 [1737] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Removed some outdated ifdef cases + +2008.05.07.175508 [1738] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/burn_wrap.c +Reading emulated toc info from overwriteable media, new API isoburn_toc_*() + +2008.05.07.175640 [1739] +xorriso/xorrisoburn.c +Making use of new isoburn_toc_* functions + +2008.05.07.214343 [1740] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +New API function isoburn_read_iso_head() + +2008.05.07.214442 [1741] +xorriso/xorrisoburn.c +New format with -toc is more concise and shows volume id + +2008.05.08.141054 [1742] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/burn_wrap.c +Try to read header chain from alleged -ROM media (e.g. DVD+RW in -ROM drive) + +2008.05.08.141920 [1743] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New TOC layout with volume id and sbsector=, new option -rom_toc_scan + +8 May 2008 [1744] +xorriso/xorriso_eng.html +Mentioned new features + +------------------------------------ cycle - xorriso-0.1.5 - 2008.05.08.141920 +* Emulated TOC on overwriteable media +* New TOC layout with volume id and sbsector= +* New option -rom_toc_scan + + +2008.05.08.185350 [1745] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +Adjusted reply of isoburn_disc_get_msc1() to eventual -rom_toc_scan result + +8 May 2008 [1746] +xorriso/xorriso.1 +Updated man page examples + +8 May 2008 [1747] +xorriso/xorriso.1 +Updated man page examples + +------------------------------------ cycle - xorriso-0.1.5 - 2008.05.08.205551 + +9 May 2008 [1751] +xorriso/xorriso_eng.html +Updated details in web page + +2008.05.09.205517 [1752] +libisoburn/isofs_wrap.c +Trying to better handle non ISO images on -indev + +10 May 2008 [1761] +xorriso/configure_ac.txt +Adapted xorriso standalone production to new libburn cycle 0.4.7 + +10 May 2008 [1762] +xorriso/xorriso.1 +xorriso/xorriso_eng.html +Minor change in -update_r example + +2008.05.10.194336 [1763] +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.c +Better behavior of update_r with no image present + +2008.05.12.080812 [1765] +configure.ac +libisoburn/libisoburn.h +Switched requirements to libburn-0.4.6 + +2008.05.12.081331 [1766] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +New API call isoburn_set_msc1() + +2008.05.12.082733 [1767] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -load session|track|sbsector|volid + +------------------------------------ cycle - xorriso-0.1.5 - 2008.05.12.082733 +* New option -load session|track|sbsector|volid +* Now depending on libburn-0.4.6 + + +2008.05.12.193341 [1768] +libisoburn/burn_wrap.c +Reacted on harmless compiler warning + +2008.05.12.193642 [1769] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -blank and -format modes as_needed + +2008.05.13.115901 [1770] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -list_formats + +2008.05.13.135251 [1771] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Corrected strange behavior with non-ISO images on overwriteable media + +2008.05.13.153837 [1772] +xorriso/xorrisoburn.c +Prepared Xorriso_get_profile() for potential call without flag bit1 + +2008.05.13.180624 [1773] +xorriso/xorrisoburn.c +Handled -list_format with non MMC drives + +2008.05.13.180912 [1774] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +Eat up leading dashes with command options, convert inner dashes to underscores + +------------------------------------ cycle - xorriso-0.1.5 - 2008.05.13.180912 +* New -blank and -format modes as_needed +* New option -list_formats + +2008.05.14.114548 [1775] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -format types by_index and fast_by_index + +2008.05.14.173201 [1779] +configure.ac +libisoburn/libisoburn.h +Required libburn version is now 0.4.7 (because of DVD-RAM BD-RE bug fix) + +2008.05.14.173430 [1780] +xorriso/xorrisoburn.c +Automatic fast format on attempt to write to unformatted DVD-RAM or BD-RE + +2008.05.14.174846 [1781] +xorriso/xorriso_private.h +Uploaded forgotten enhancements + +2008.05.15.092028 [1783] +xorriso/xorriso.c +Enabled a pacifier for compare_r + +2008.05.15.150041 [1784] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New options -map and -map_single + +2008.05.15.192118 [1785] +xorriso/xorriso.c +Bug fix: -update_r and others did not work properly with relative paths + +------------------------------------ cycle - xorriso-0.1.5 - +* New options -map and -map_single +* Bug fix: -update_r and others did not work properly with relative paths + + +2008.05.17.162753 [1794] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Corrected ugly message with -update_r and root directory + +2008.05.17.170001 [1796] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.6, requiring libburn-0.4.8 now + +2008.05.18.070001 [1797] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Bug fix: -findi operated on nodes which ceased existence shortly before + +18 May 2008 [1799] +xorriso/changelog.txt +Documented changes and release timestamp + +---------------------------------- release - xorriso-0.1.6 - 2008.05.18.070001 +* New option -error_behavior with a first occasion 'image_loading' +* New options -not_paths, -not_leaf, -not_list, -not_mgt, -as mkisofs -m +* Emulated TOC on overwriteable media +* New TOC layout with volume id and sbsector= +* New option -rom_toc_scan +* New option -load session|track|sbsector|volid +* Now depending on libburn-0.4.8 +* New -blank and -format modes as_needed +* New option -list_formats +* New options -map and -map_single +* Bug fix: -update_r and others did not work properly with relative paths +* Bug fix: -findi operated on nodes which ceased existence shortly before + + +2008.05.18.082208 [1798] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Bug fix: -findi operated on nodes which ceased existence shortly before + +2008.05.18.084729 [1800] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/changelog.txt +Version leap to 0.1.7, requiring libburn-0.4.8 now + +------------------------------------ cycle - xorriso-0.1.7 - 2008.05.18.084729 + +2008.05.20.075142 [1804] +xorriso/xorriso.c +Making Xorriso_prescan_args() safe against misunderstandings + +2008.05.22.192618 [1808] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +First experiments of osirrox ISO-to-disk copying + +2008.05.22.192737 [1809] +libisoburn/data_source.c +Removed outdated code branch + +2008.05.22.210835 [1810] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -osirrox and -cpx + +2008.05.24.092546 [1812] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enabled osirrox of more file types, curbed with device files + +2008.05.24.092853 [1813] +libisoburn/isoburn.c +Bug fix: modifying to overwriteable target yielded unmountable results + +------------------------------------ cycle - xorriso-0.1.7 - 2008.05.24.092853 +* Bug fix: Modifying to overwriteable target yielded unmountable results +* New options -osirrox and -cpx + + +2008.05.24.170109 [1814] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Some polishing with -cpx + +26 May 2008 [1815] +xorriso/configure_ac.txt +standalone version switch to libisofs-0.6.5 + +2008.05.26.181210 [1816] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Improved access permission restauration by osirrox + +2008.05.27.201513 [1817] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -stream_recording + +2008.05.31.174045 [1819] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Implemented concatenation of split files during -cpx + +------------------------------------ cycle - xorriso-0.1.7 - 2008.05.31.174045 +* New option -stream_recording + +2008.06.01.134322 [1820] +xorriso/xorrisoburn.c +Reacted on harmless compiler warning + +2008.06.01.145038 [1821] +xorriso/configure_ac.txt +standalone version switch to libisofs-0.6.6 + +2008.06.01.145155 [1822] +configure.ac +libisoburn/libisoburn.h +Switched requirements to libisofs-0.6.6 + +------------------------------------ cycle - xorriso-0.1.7 - 2008.06.01.145155 +* Bug fix: major,minor numbers of device files appeared as 0,1 in next session + + +2008.06.02.070301 [1824] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.8 + +2 Jun 2008 [1825] +xorriso/changelog.txt +Documented changes and release timestamp + +---------------------------------- release - xorriso-0.1.8 - 2008.06.02.070301 +* Bug fix: Modifying to overwriteable target yielded unmountable results +* Bug fix: major,minor numbers of device files appeared as 0,1 in next session +* New option -stream_recording for full speed with DVD-RAM and BD-RE +* New options -osirrox and -cpx allow to extract single files from ISO image + + +2008.06.02.141334 [1826] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.1.9 + +2 Jun 2008 [1827] +xorriso/changelog.txt +Documented changes and release timestamp + +2 Jun 2008 [1828] +xorriso/xorriso.1 +Beautified documentation of -osirrox + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.02.141334 + +5 Jun 2008 [1834] +xorriso/convert_man_to_html.sh +Beautified HTML man page + +2008.06.05.165023 [1835] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -cpax, -cp_rx, -cp_rax to restore files and trees from ISO to disk + +2008.06.06.083432 [1839] +xorriso/xorriso.c +Bug fix: -chmod unintentionally performed o-x as first operation + +2008.06.06.103735 [1840] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Fine tuning of directory attribute copying with -cp_rx + + +------------------------------------ cycle - xorriso-0.1.9 - +* New options -cpax, -cp_rx, -cp_rax to restore files and trees from ISO to disk +* Bug fix: -chmod unintentionally performed o-x as first operation + + +2008.06.09.134432 [1841] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Allowing to restore from image with pending changes + +2008.06.09.165735 [1842] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Removed some outdated code parts + +2008.06.10.094304 [1844] +libisoburn/isoburn.c +libisoburn/burn_wrap.c +Removed outdated code parts + +2008.06.10.100231 [1845] +xorriso/xorrisoburn.c +Removed outdated code parts + +2008.06.11.131607 [1846] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Proper handling of restore overwrite situations with directories and softlinks + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.11.131607 + +2008.06.12.112644 [1847] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Corrections about restoring of directories + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.12.112644 + +2008.06.13.151630 [1848] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -paste_in + +2008.06.14.104745 [1849] +xorriso/xorriso.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New options -extract and -extract_single + +14 Jun 2008 [1850] +xorriso/convert_man_to_html.sh +Beautification of HTML man page + +2008.06.14.140459 [1851] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Correction about -extract / / + +2008.06.14.184512 [1854] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +xorriso/convert_man_to_html.sh +Gave up the unusual parameter sequences of -extract and -paste_in + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.14.184512 +* New option -paste_in to copy ISO files into parts of disk files +* New option -extract restores with arguments of -map or -update_r + + +2008.06.17.121524 [1857] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +New options -map_l, -compare_l, -update_l, -extract_l + +2008.06.17.133914 [1858] +xorriso/xorriso.c +Reacted on harmless compiler warning + +2008.06.17.170622 [1859] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Fixed a bug about -update_l + +2008.06.18.132057 [1860] +libisoburn/isoburn.h +libisoburn/burn_wrap.c +Made -rom_toc_scan work on closed DVD-R in a DVD-ROM drive + +2008.06.18.161512 [1861] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +libisoburn/data_source.c +New API functions isoburn_preset_msgs_submit(), isoburn_set_msgs_submit() + +2008.06.18.161723 [1862] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Made use of isoburn_preset_msgs_submit() + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.18.161723 +* New options -map_l, -compare_l, -update_l, -extract_l +* New API functions isoburn_set_msgs_submit(), isoburn_drive_set_msgs_submit() + + +2008.06.18.192913 [1863] +libisoburn/burn_wrap.c +Improved pacifier with -rom_toc_scan + +2008.06.19.090436 [1864] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Renamed isoburn_*set_msgs_submit() and slightly changed meaning + +2008.06.19.092458 [1865] +libisoburn/burn_wrap.c +Corrected wrong size unit MB to kB in toc scan pacifier text + +2008.06.20.091647 [1866] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -osirrox option auto_chmod_on + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.20.091647 + + +2008.06.20.164105 [1867] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Fixed several bugs with restore operations + +2008.06.21.180701 [1870] +xorriso/xorriso.1 +Corrected mistake in xorriso man page + +------------------------------------ cycle - xorriso-0.1.9 - 2008.06.21.180701 + +2008.06.22.080000 [1872] +xorriso/xorriso.c +Removed duplicated help text snippet + +2008.06.22.090001 [1873] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.0 + +22 Jun 2008 [1874] +xorriso/changelog.txt +Documented changes and release timestamp + +---------------------------------- release - xorriso-0.2.0 - 2008.06.22.090001 +* Bug fix: -chmod unintentionally performed o-x as first operation +* New options -cpax, -cp_rx, -cp_rax to restore files and trees from ISO to disk +* New option -extract restores with arguments of -map or -update_r +* New option -paste_in to copy ISO files into parts of disk files +* New options -map_l, -compare_l, -update_l, -extract_l +* New API functions isoburn_set_msgs_submit(), isoburn_drive_set_msgs_submit() + +2008.06.22.111236 [1875] +xorriso/xorriso.c +Removed duplicated help text snippet + +2008.06.22.135202 [1876] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.1 + +22 Jun 2008 [1877] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.2.1 - 2008.06.22.135202 + + +2008.06.27.124201 [1880] +xorriso/xorrisoburn.c +Bug fix: -as cdrecord -atip falsely announced overwriteable DVD-RW to sdvdbackup + +2008.06.27.130235 [1881] +xorriso/xorriso.c +Extended -as cdrecord blank= by blank type format_overwrite + +------------------------------------ cycle - xorriso-0.2.1 - 2008.06.27.130235 + + +2008.07.03.133023 [1882] +xorriso/xorriso.c +Flushing stdout after each result text to deconfuse stdout/stderr with SSH + +2008.07.04.070001 [1884] +xorriso/xorriso.c +Supporting option -as cdrecord -waiti + +2008.07.05.132528 [1885] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +libisoburn/data_source.c +New API function isoburn_prepare_blind_grow() for -as mkisofs -multi + +2008.07.05.133721 [1886] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -grow_blindly + +2008.07.05.180241 [1887] +libisoburn/isoburn.c +Fixed a bug with -grow_blindly to overwriteable media + +2008.07.05.182424 [1888] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +New options -C and -M for -as mkisofs + +2008.07.05.184434 [1889] +xorriso/xorriso.c +Cared for a peculiarity of growisofs when using mkisofs -C + +5 Jul 2008 [1890] +xorriso/xorriso_eng.html +Updated xorriso homepage + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.05.184434 +* New API function isoburn_prepare_blind_grow() +* New option -grow_blindly +* New options -C and -M for -as mkisofs emulation + + +2008.07.06.110336 [1891] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Improved effective drive address with -as mkisofs -M + +2008.07.07.095531 [1892] +xorriso/xorriso.c +Fixed bug about -as mkisofs without -C + +2008.07.07.102941 [1893] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +Semi-permanent emulation by start names xorrisofs,genisofs,mkisofs,genioimage + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.07.102941 + +2008.07.07.150241 [1894] +xorriso/xorriso.c +Correction about -as mkisofs -C if already an input device was set + +2008.07.07.150337 [1895] +libisoburn/isoburn.c +Correction about isoburn_igopt_get_effective_lba() with blind growing + +7 Jul 2008 [1896] +xorriso/xorriso.1 +Clarification about -grow_blindly predicted_nwa + +2008.07.07.150337 [1897] +xorriso/xorriso.c +xorriso/xorriso.1 +Made leafname triggered emulation more similar to -as emulation + +2008.07.08.092732 [1898] +Makefile.am +README +xorriso/xorriso_makefile_am.txt +xorriso/README +Installing softlinks xorrisofs and osirrox pointing to the xorriso binary + +2008.07.08.102622 [1899] +xorriso/xorriso_private.h +Header file forgotten with rev 1897 + +2008.07.08.132054 [1900] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Avoided misleading message about emptied ISO image during -as mkisofs -C + +8 Jul 2008 [1901] +xorriso/xorriso_eng.html +Documented newest progress + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.08.132054 +* Can serve growisofs if started as xorrisofs, genisofs, mkisofs, genisoimage +* make install creates xorriso aliases as symbolic links: osirrox, xorrisofs + +2008.07.09.055133 [1901] +xorriso/xorriso.c +Avoided to use MMC code with -as mkisofs -M by prepending stdio: to address + +2008.07.09.055133 [1902] +xorriso/xorriso.h +xorriso/xorriso.c +Fixed bug with -as mkisofs -x and pattern expansion + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.09.055133 + + +2008.07.09.155540 [1903] +Makefile.am +xorriso/xorriso_private.h ++ xorriso/xorriso_buildstamp.h ++ xorriso/xorriso_buildstamp_none.h +xorriso/xorriso_makefile_am.txt +xorriso/make_xorriso_standalone.sh +Opportunity to generate build timestamp via make buildstamped + +9 Jul 2008 [1904] +xorriso/xorriso_makefile_am.txt +Completed (unused) dist rule of standalone-xorriso + +2008.07.10.141731 [1905] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enabled -multi and -msinfo with -as cdrecord + +2008.07.10.141913 [1906] +libisoburn/libisoburn.h +Small correction in API introduction text + +2008.07.10.144535 [1907] +xorriso/xorriso_private.h +Header file forgotten with rev 1903 + +2008.07.10.162809 [1908] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorriso.1 +cdrecord emulation by start names xorrecord, cdrecord, wodim, cdrskin + +2008.07.10.164015 [1909] +xorriso/xorriso.c +Reacted on compiler warning + +2008.07.10.164412 [1910] +Makefile.am +README +xorriso/xorriso_makefile_am.txt +xorriso/README +Installing softlink xorrecord pointing to the xorriso binary + +10 Jul 2008 [1911] +xorriso/xorriso.1 +xorriso/xorriso_eng.html +xorriso/convert_man_to_html.sh +Some documentation updates + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.10.164412 +* New options -multi and -msinfo for -as cdrecord emulation +* make install creates xorriso alias as symbolic link: xorrecord + + +2008.07.12.181846 [1912] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +New info mode 2 with isoburn_read_iso_head() + +2008.07.12.184833 [1913] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options --grow_overwriteable_iso and write_start_address= with -as cdrecord + +2008.07.14.114515 [1918] +libisoburn/libisoburn.h +Required libburn version is now 0.4.9 + +2008.07.14.114613 [1919] +configure.ac +Did LT_CURRENT++, LT_AGE++ which was forgotten with revision 1885 + +2008.07.14.120527 [1920] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +New flag options with isoburn_read_iso_head() + +2008.07.14.125133 [1921] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -isosize with -as cdrecord + +14 Jul 2008 [1923] +xorriso/convert_man_to_html.sh +Small correction with a sed expression + +2008.07.15.063040 [1924] +xorriso/xorriso_makefile_am.txt +Generating automatic build timestamp + +2008.07.15.121754 [1925] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option tsize= with -as cdrecord + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.15.121754 +* New options --grow_overwriteable_iso and write_start_address= with -as cdrecord +* New options -isosize and tsize= with -as cdrecord + + +2008.07.16.130711 [1933] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -pacifier, more compatible pacifier with -as mkisofs + +2008.07.16.130758 [1934] +xorriso/configure_ac.txt +Updated xorriso standalone configure.ac version number BURN_*_VERSION + +2008.07.16.130841 [1935] +libisoburn/libisoburn.h +Required libburn version is now 0.5.0 + +2008.07.16.131110 [1936] +configure.ac +Required libburn version is now 0.5.0 + +2008.07.16.140043 [1937] +xorriso/xorriso.c +xorriso/xorriso.1 +Recognizing "b" as speed factor for BD media + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.16.140043 +* New option -pacifier, more compatible pacifier with -as mkisofs + +2008.07.17.110812 [1939] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +Ability to emulate a featured bug with mkisofs -C : read 16 block too early + +2008.07.17.111411 [1940] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Rectified usage of original xorriso options underneath growisofs + +2008.07.17.183024 [1941] +libisoburn/burn_wrap.c +Recognizing growisofs follow-up sessions on xorriso overwriteables + +2008.07.17.184520 [1942] +libisoburn/burn_wrap.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +Removed MULTI construction site remarks + +------------------------------------ cycle - xorriso-0.2.1 - 2008.07.17.184520 + + +2008.07.18.120001 [1944] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt + +18 Jul 2008 [1946] +README +xorriso/README +Corrected outdated statement about minimum library requirements + + +---------------------------------- release - xorriso-0.2.2 - 2008.07.18.120001 +* New API function isoburn_prepare_blind_grow() +* New option -grow_blindly +* Options -C and -M for -as mkisofs emulation +* Can serve growisofs if started as xorrisofs, genisofs, mkisofs, genisoimage +* make install creates aliases as symbolic links: osirrox, xorrisofs, xorrecord +* Options for -as cdrecord emulation: -multi, -msinfo, -isosize, tsize, + --grow_overwriteable_iso, write_start_address, +* New option -pacifier, more compatible pacifier with -as mkisofs + + +2008.07.18.135540 [1947] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/changelog.txt +Version leap to 0.2.3 + +------------------------------------ cycle - xorriso-0.2.3 - 2008.07.18.135540 + + +2008.07.19.113048 [1949] +Makefile.am +xorriso/compile_xorriso.sh +Introduced automatic buildstamp generation for dynamic library version + +2008.07.21.155324 [1950] +Makefile.am +xorriso/xorriso_makefile_am.txt +Reacting on ticket 138 by stick, revoked buildstamp due to ugly make install + +2008.07.21.161826 [1951] +Makefile.am +xorriso/xorriso_makefile_am.txt +Used quotation marks as does ./bootstrap when generating Makefile.in + +------------------------------------ cycle - xorriso-0.2.3 - 2008.07.21.161826 +* Bug fix: Variable DESTDIR was not properly respected during make install + + +2008.07.23.080001 [xorriso-0.2.2.pl01] +Makefile.in +xorriso/xorriso_timestamp.h +xorriso/changelog.txt +* Bug fix: external make variable DESTDIR was not used by xorriso link creation + +------------------------------- patch - xorriso-0.2.2.pl01 - 2008.07.23.080001 +* Bug fix: Variable DESTDIR was not properly respected during make install + + +2008.07.26.075027 [1953] +libisoburn/burn_wrap.c +Producing on overwriteables a partial TOC up to first damaged superblock + +2008.08.01.101355 [1955] +xorriso/xorrisoburn.c +Better finish time estimation with -pacifier mkisofs + +2008.08.01.141210 [1956] +xorriso/xorrisoburn.c +Better finish time estimation with -pacifier mkisofs + +2008.08.06.143825 [1967] +xorriso/xorriso_private.h +Removed obsolete type definition + +2008.08.06.143922 [1968] +xorriso/xorrisoburn.c +Removed obsolete function + +2008.08.07.112529 [1972] +xorriso/xorriso.c +Minor changes around display of time and byte counts + +2008.08.09.160515 [1977] +configure.ac +libisoburn/libisoburn.h +Demanding libburn-0.5.1 now + +2008.08.09.160947 [1978] +libisoburn/burn_wrap.c +Create emulated toc entry for simple ISO session on overwriteable media + +2008.08.09.161311 [1979] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Evaluating readability of media + +2008.08.11.201604 [1980] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Adapted media evaluation to CD peculiarities + +2008.08.13.185434 [1981] +libisoburn/libisoburn.h +Corrected documentation of isoburn_disc_get_msc1() + +2008.08.13.190704 [1982] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +New capability to redirect program output used for toc in sector map file + +2008.08.14.220520 [1983] +libisoburn/burn_wrap.c +Changed wrong update message from MB to kB + +2008.08.14.221412 [1984] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -check_media + +2008.08.15.102849 [1985] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +Allowed independent redirecton of result and info channel + +2008.08.15.155421 [1986] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enabled printing of sector bitmaps by use=sector_map + +15 Aug 2008 [1987] +xorriso/xorriso_eng.html +Mentioned progress of development version + +2008.08.17.220043 [1988] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +-find tests -damaged and -lba_range, new -find action report_damage + +2008.08.17.221350 [1989] +xorriso/xorrisoburn.c +xorriso/xorriso_eng.html +Reacted on compiler warning + +------------------------------------ cycle - xorriso-0.2.3 - +* Included libburn has enhanced Linux drive access and listing code +* New option -check_media +* New -find test -damaged, new -find action "report_damage" + + +2008.08.18.134140 [1990] +xorriso/xorrisoburn.c +xorriso/README +xorriso/xorriso.1 +New -find action report_lba + +2008.08.20.101410 [2000] +xorriso/configure_ac.txt +Adopted to new libburn version 0.5.3 + +2008.08.20.121008 [2002] +libisoburn/libisoburn.h +configure.ac +Demanding libburn-0.5.2 now + +2008.08.20.181734 [2003] +xorriso/xorrisoburn.c +Made -check_media process first 32 blocks of a multi-session overwriteable + +2008.08.21.070602 [2004] +xorriso/xorriso.c +Synced -lsl display of major,minor numbers with /usr/include/sys/sysmacros.h + +2008.08.22.231051 [2005] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -check_media option -patch_lba0= + +2008.08.24.100552 [2007] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New -error_behavior behavior occasion "file_extraction" + +2008.08.24.124424 [2008] +xorriso/xorrisoburn.c +Fixed a bug with -check_media use=outdev + +2008.08.24.125257 [2009] +xorriso/xorrisoburn.c +Reacted on compiler warning + +------------------------------------ cycle - xorriso-0.2.3 - 2008.08.24.125257 +* New -find action "report_lba" +* New -error_behavior behavior occasion "file_extraction" + + +2008.08.24.160001 [2011] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.4 + +24 Aug 2008 [2012] +xorriso/changelog.txt +Documented changes and release timestamp + +24 Aug 2008 [2013] +configure.ac +Corrected ISOBURN_MICRO_VERSION + +---------------------------------- release - xorriso-0.2.4 - 2008.08.24.160001 +* Included libburn has enhanced Linux drive access and listing code +* New option -check_media +* New -find test -damaged, new -find actions "report_damage", "report_lba" +* New -error_behavior occasion "file_extraction" + + +2008.08.24.173217 [2014] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.5 + +24 Aug 2008 [2015] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.2.5 - 2008.08.24.173217 + +26 Aug 2008 [2017] +xorriso/convert_man_to_html.sh +Adjusted HTML generator to recent man page changes + +2008.08.26.163254 [2018] +libisoburn/libisoburn.h +libisoburn/data_source.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/configure_ac.txt +Adopting next development step of libisofs + +26 Aug 2008 [2019] +xorriso/xorriso.1 +Adjusted man page statements about file size limits + +2008.08.27.121211 [2020] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -file_size_limit, -as mkisofs now supports -iso-level 1 to 3 + +2008.08.27.122127 [2021] +xorriso/xorriso.c +Reacted on compiler warning + +------------------------------------ cycle - xorriso-0.2.5 - 2008.08.27.122127 +* Capability to insert and extract files far larger than 4 GB +* New option -file_size_limit, -as mkisofs now supports -iso-level 1 to 3 + + +27 Aug 2008 [2022] +xorriso/xorriso.1 +Corrected a typo in man page + +2008.09.02.164803 [2025] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -extract_cut + +2008.09.03.143218 [2026] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -error_behavior "file_extraction" behavior "best_effort" + +2008.09.04.100158 [2027] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -check_media_defaults + +------------------------------------ cycle - xorriso-0.2.5 - 2008.09.04.100158 +* New option -extract_cut +* New -error_behavior "file_extraction" behavior "best_effort" +* New option -check_media_defaults + + +2008.09.05.095344 [2028] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -list_delimiter + +5 Sep 2008 [2029] +xorriso/xorriso_eng.html +Updated development feature list + +2008.09.05.114936 [2030] +xorriso/xorriso.c +-commit_eject, -alter_date, -alter_date_r, -pacifier, -prog_help had wrong argument count prediction + +5 Sep 2008 [2031] +xorriso/xorriso.1 +Documented forgotten option -publisher + +5 Sep 2008 [2032] +xorriso/xorriso_eng.html +xorriso/xorriso.1 +Minor documentation polishing + +------------------------------------ cycle - xorriso-0.2.5 - 2008.09.05.114936 +* New option -list_delimiter + + +6 Sep 2008 [2033] +xorriso/xorriso_eng.html +xorriso/xorriso.1 +Documentation polishing + +2008.09.07.144714 [2034] +xorriso/xorrisoburn.c +Removed outdated alternative code for support of libisofs-0.6.6 + +2008.09.08.094748 [2035] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Made use of new libisofs call iso_image_update_sizes() + +2008.09.08.121548 [2036] +xorriso/xorrisoburn.c +Bug fix: -format full did not re-format already formatted DVD+RW + +2008.09.09.082406 [2037] +xorriso/xorrisoburn.c +Smoothened time estimation with pacifier mkisofs style + +9 Sep 2008 [2038] +xorriso/xorriso_eng.html +Updated web page + +------------------------------------ cycle - xorriso-0.2.5 - 2008.09.09.082406 +* Bug fix: -format full did not re-format already formatted DVD+RW + + +2008.09.11.114227 [2040] +xorriso/xorrisoburn.c +Issuing message at begin of image loading + +2008.09.13.204455 [2047] +xorriso/xorrisoburn.c +Correction about -check_media report and message about image loading + +2008.09.16.060427 [2053] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Corrected pacifier text (Ticket 141) + +2008.09.16.185206 [2054] +xorriso/xorriso_private.h +xorriso/xorriso.1 +Corrected falsely computed default setting of -file_size_limit + +2008.09.17.193824 [2056] +xorriso/xorrisoburn.c +Corrected message duplication about emulated sessions on overwriteable media + +2008.09.19.090619 [2057] [2058] +xorriso/configure_ac.txt +standalone version switch to libisofs-0.6.8 + +19 Sep 2008 [2059] +xorriso/xorriso.1 +Small change in man page + +2008.09.19.104424 [2060] +configure.ac +libisoburn/libisoburn.h +Switched requirements to libisofs-0.6.8 + +------------------------------------ cycle - xorriso-0.2.5 - 2008.09.19.104424 + + +2008.09.19.122656 [2061] +xorriso/xorrisoburn.c +Changed WARNING about non-writeable media to NOTE severity of blank messages + + +2008.09.19.180001 [2066] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.6 + +20 Sep 2008 [2067] +xorriso/changelog.txt +Documented changes and release timestamp + +---------------------------------- release - xorriso-0.2.6 - 2008.09.19.180001 +* Capability to insert and extract files far larger than 4 GB +* New option -file_size_limit, -as mkisofs now supports -iso-level 1 to 3 +* New option -extract_cut +* New -error_behavior "file_extraction" behavior "best_effort" +* New option -check_media_defaults +* New option -list_delimiter +* Bug fix: -format full did not re-format already formatted DVD+RW + + +2008.09.20.093140 [2068] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.7 + +20 Sep 2008 [2069] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.2.7 - 2008.09.20.093140 + +2008.09.24.155424 [2077] +xorriso/xorrisoburn.c +Trying to get pacifiers of simultaneously running emulations into sync + +2008.09.26.120934 [2082] +xorriso/xorriso.c +Bug fix: -as mkisofs -iso-level was accused to be an unknown option + +2008.09.26.161331 [2083] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +A first attempt on making bootable ISO images + +2008.09.28.112850 [2084] +xorriso/configure_ac.txt +Standalone version switch to libisofs-0.6.9 (vreixoml 387) to avoid SIGSEGV + +2008.09.28.113256 [2085] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/convert_man_to_html.sh +xorriso/xorriso_eng.html +Made -boot_image isolinux activation obey -overwrite setting + +2008.09.30.102243 [2088] +libisoburn/libisoburn.h +Requiring libisofs-0.6.9 because of bug fixes with El Torito + +2008.09.30.102753 [2089] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Adjustments about -boot_image after testing with various media types + +30 Sep 2008 [2090] +xorriso/xorriso_eng.html +Mentioned progress and bug fixes in 0.2.7 + +------------------------------------ cycle - xorriso-0.2.7 - 2008.09.30.102753 +* Bug fix: -as mkisofs -iso-level was accused to be an unknown option +* Ability to write and maintain bootable ISO images based on ISOLINUX + + +2008.09.30.174925 [2091] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Small adjustments about -boot_image + +2008.10.02.092354 [2092] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Small adjustments about -boot_image + +2008.10.02.092635 [2093] +xorriso/xorriso.c +Enabled -as cdrecord blank=as_needed + +2008.10.02.105442 [2094] +xorriso/README +xorriso/configure_ac.txt +Introduced xorriso-standalone ./configure option --disable-libreadline + +2008.10.02.110828 [2095] +README +xorriso/README +xorriso/configure_ac.txt +Fine tuning about ./configure option --disable-libreadline + +------------------------------------ cycle - xorriso-0.2.7 - 2008.10.02.110828 +* New ./configure option --disable-libreadline to make binary more portable + + +4 Oct 2008 [2099] +xorriso/convert_man_to_html.sh +xorriso/xorriso.1 +Relocated the El Torito paragraph in man xorriso + +2008.10.05.075432 [2101] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +-rom_toc_scan nonrom_off disables toc emulation on overwriteables + +2008.10.05.093703 [2105] +xorriso/xorrisoburn.c +Bug fix: Random target filenames with looping symbolic links + +2008.10.05.125046 [2109] +xorriso/configure_ac.txt +Adapted standalone BURN_*_VERSION to libburn 0.5.5 + +2008.10.05.125242 [2110] +configure.ac +libisoburn/libisoburn.h +libisoburn now demands libburn-0.5.4 + +------------------------------------ cycle - xorriso-0.2.7 - 2008.10.05.125242 +* Bug fix: -follow link attributed random target filenames to looping links + + +2008.10.06.114114 [2113] +xorriso/configure_ac.txt +Adapted standalone LIBISOFS_*_VERSION to libisofs 0.6.10 + +2008.10.06.114845 [2114] +configure.ac +libisoburn/libisoburn.h +libisoburn now demands libisofs-0.6.10 + +------------------------------------ cycle - xorriso-0.2.7 - 2008.10.06.114845 + + +7 Oct 2008 [2115] +xorriso/xorriso.1 +Polished man xorriso + +2008.10.08.135848 [2116] +xorriso/xorriso.c +xorriso/xorriso.1 +Changed newly introduced -rom_toc_scan nonrom_off to off:emul_off + +2008.10.09.145926 [2117] +configure.ac +README +Introduced libburn ./configure option --disable-libreadline + +9 Oct 2008 [2118] +xorriso/compile_xorriso.sh +Introduced xorriso development compiler script option -no_libreadline + +------------------------------------ cycle - xorriso-0.2.7 - 2008.10.09.145926 + + +2008.10.10.131102 [2119] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorriso.1 +Enabled dialog for multi-lines and newline characters in quotation marks + +2008.10.10.134020 [2120] +xorriso/xorriso.c +Polishing multi-line dialog + +2008.10.12.120001 [2122] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.8 + +12 Oct 2008 [2123] +xorriso/changelog.txt +Documented changes and release timestamp + +---------------------------------- release - xorriso-0.2.8 - 2008.10.12.120001 +* Bug fix: -as mkisofs -iso-level was accused to be an unknown option +* Bug fix: -follow link attributed random target filenames to looping links +* Ability to write and maintain bootable ISO images based on ISOLINUX +* New ./configure option --disable-libreadline to make binary more portable + + +2008.10.12.133957 [2124] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.2.9 + +12 Oct 2008 [2125] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.12.133957 + + +15 Oct 2008 [2128] +xorriso/xorriso_eng.html +Corrected a typo in xorriso web page + +2008.10.15.182605 [2130] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -quoted_path_list, -quoted_not_list. Multiline for -options_from_file + +2008.10.17.074953 [2131] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +New option -backslash_codes for expressing weird file names + +2008.10.17.123308 [2132] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorriso.1 +Adjustments and documentation about -backslash_codes + +17 Oct 2008 [2133] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.17.123308 +* New options -quoted_path_list, -quoted_not_list +* New option -backslash_codes for weird file names and terminal safety + +18 Oct 2008 [2134] +xorriso/make_isohybrid_mbr.c +Exposed function make_isohybrid_mbr() for discussion + +19 Oct 2008 [2135] +xorriso/make_isohybrid_mbr.c +Corrected a bug in make_isohybrid_mbr() + +2008.10.19.172237 [2136] +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +Adapted to libisofs 0.6.11 + +19 Oct 2008 [2137] +xorriso/compile_xorriso.sh +Adapted to libisofs 0.6.11 + +19 Oct 2008 [2138] +- xorriso/make_isohybrid_mbr.c +The make_isohybrid_mbr() function is now part of libisofs development + +2008.10.19.182512 [2139] +libisoburn/libisoburn.h +libisoburn now depends on libisofs-0.6.11 + +2008.10.20.180747 [2140] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Made use of new libisofs isohybrid capability + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.20.180747 +* Suitable ISOLINUX boot images are made alternatively bootable via MBR + + +21 Oct 2008 [2141] +xorriso/xorriso_eng.html +Mentioned isohybrid capability in xorriso homepage + +2008.10.21.112523 [2142] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Implemented in xorriso provisory 1 MB alignement for MBR enhanced ISO images + +2008.10.21.123226 [2143] +xorriso/xorrisoburn.c +Showing a "Media summary:" with blank media + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.21.123226 + + +2008.10.22.110204 [2144] +xorriso/xorriso.c +xorriso/xorriso.1 +New options --quoted_path_list , isolinux_mbr= for -as mkisofs + +2008.10.22.201702 [2145] +xorriso/xorriso.1 +xorriso/xorrisoburn.c +Gave up automatic switch to -boot_image "isolinux" "patch" after writing + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.22.201702 + +2008.10.24.130124 [2146] +xorriso/xorrisoburn.c +Fixed image size aligment to 1 MB with follow-up sessions + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.24.130124 + + +2008.10.25.123133 [2147] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Eventually reporting boot info with TOC of -indev, redirected drive aquiration TOC to info channel + +2008.10.25.170010 [2148] +xorriso/xorrisoburn.c +Fixed SIGSEGV introduced with previous revision + +2008.10.26.134421 [2149] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Introduced info option -boot_image "any" "show_status" + +2008.10.26.142422 [2150] +xorriso/xorrisoburn.c +Precautions against patching deleted boot images + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.26.142422 + + +2008.10.27.142720 [2151] +xorriso/xorrisoburn.c +Trying to recognize isohybrid MBR for "Boot record :" message + +------------------------------------ cycle - xorriso-0.2.9 - 2008.10.27.142720 + + +2008.10.30.110049 [2152] +xorriso/xorriso.c +Made -as mkisofs -path-list and --quoted_path_list switch pacifier mode + +2008.10.30.114313 [2153] +xorriso/xorriso.c +Enabled @ as indicator of UTC seconds in timestrings + +2008.11.03.115721 [2159] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/convert_man_to_html.sh +New options -charset, -in_charset, -out_charset + +2008.11.04.162214 [2162] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -application_id + +4 Nov 2008 [2163] +xorriso/xorriso_eng.html +Mentioned new options in xorriso homepage + +2008.11.06.183736 [2164] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -local_charset + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.06.183736 +* New options -charset, -in_charset, -out_charset +* New option -application_id +* New option -local_charset + + +2008.11.07.173315 [2170] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Copying -out_charset to -in_charset after -commit + +2008.11.07.201909 [2171] +xorriso/xorrisoburn.c +Removed some defunct code from xorrisoburn.c + +2008.11.09.102554 [2176] +xorriso/xorriso.c +Added a setlocale() call to xorriso main() + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.09.102554 +* Bug fix in libisofs: ISOLINUX boot images were not patched correctly + +2008.11.10.123332 [2177] +xorriso/xorrisoburn.c +Disabled experimental weight sorting with MBR generation + +2008.11.10.123713 [2178] +xorriso/xorriso.c +xorriso/xorriso.1 +Eventual backslash output conversion outside quotes for more terminal-safety + +11 Nov 2008 [2179] +xorriso/xorriso_eng.html +Updated xorriso home page + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.10.123713 + + +12 Nov 2008 [2190] +xorriso/configure_ac.txt +Version leap to libburn-0.5.7 + +2008.11.12.153437 [2192] +xorriso/xorriso.c +Added forgotten exit value registration to -return_with. Thanks to Steve Dodd. + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.12.153437 +* Bug fix: Forgot exit value registration to -return_with. Thanks to Steve Dodd. + + +15 Nov 2008 [2195] +xorriso/xorriso.1 +Took into respect that xorriso loads non-RR images + +2008.11.15.133724 [2196] +xorriso/xorriso.c +Adaptions to FreeBSD. Thanks to J.R. Oldroyd. + +2008.11.15.231831 [2198] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +Introduced new relax flag isoburn_igopt_always_gmt + +2008.11.15.232058 [2199] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Making use of new relax flag isoburn_igopt_always_gmt + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.18.110100 + +18 Nov 2008 [2204] +test/aaip.c +Demo of the emerging Arbitrary Attribute Interchange Protocol format + +18 Nov 2008 [2205] +README +xorriso/README +xorriso/xorriso.1 +xorriso/xorriso_eng.html +Mentioned FreeBSD peculiarities in our docs + +2008.11.21.160019 [2206] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +Making use of experimental libisofs calls _rrip_version_1_10() _dir_rec_mtime() + +2008.11.21.160632 [2207] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -relax_compliance + +22 Nov 2008 [2209] +- test/aaip.c +Revoked proposal AAIP 0.0 in favor of 0.2 which is nearly like RRIP field SL + + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.21.160632 + +26 Nov 2008 [2210] +xorriso/configure_ac.txt +Promoted standalone libisofs copy to 0.6.12 + +2008.11.26.174940 [2211] +xorriso/xorrisoburn.c +Disabled "Starting up libraries ..." message + +2008.11.26.180935 [2212] +xorriso/xorriso.c +Augmented version message by "and burn program" + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.26.180935 + + +2008.11.29.091030 [2216] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Renamed new option -relax_compliance to -compliance, added _off rules + +------------------------------------ cycle - xorriso-0.2.9 - 2008.11.29.091030 +* New option -compliance allows certain deviations from standards + + +2008.11.29.140837 [2219] +xorriso/xorrisoburn.c +Bug fix: -format as_needed did not recognize unformatted BD-RE + +2008.11.29.165843 [2220] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Re-aquiring outdev after formatting and blanking already in xorrisoburn + +2008.11.29.214208 [2221] +xorriso/xorriso.c +New -as cdrecord option stream_recording=on|off + +2008.11.30.095007 [2222] +xorriso/xorrisoburn.c +Reporting BD speed units with pacifier rather than DVD units + +2008.11.30.123700 [2223] +xorriso/xorriso.c +Gave -as mkisofs problem handlers rather than to let it abort on any error + +2008.11.30.214121 [2224] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Changed layout of xorriso style write pacifier line + +2008.12.01.110022 [2225] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Removed outdated macro case Xorriso_fat_local_meM + +2008.12.01.122825 [2226] +xorriso/xorriso.c +Bug fix: disk patterns with relative addresses were not properly resolved + +1 Dec 2008 [2227] +xorriso/xorriso_eng.html +Updated list of bugfixes in xorriso home page + +------------------------------------ cycle - xorriso-0.2.9 - +* Bug fix: -format as_needed did not recognize unformatted BD-RE +* Bug fix: disk patterns with relative addresses were not properly resolved + + +1 Dec 2008 [2228] +Branching for libisoburn release 0.3.0 + +2008.12.01.200001 [2229] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.3.0 + +1 Dec 2008 [2230] +xorriso/changelog.txt +Documented changes and release timestamp + +1 Dec 2008 [2231] +configure.ac +Corrected values of LIB*_REQUIRED + +---------------------------------- release - xorriso-0.3.0 - 2008.12.01.200001 + +* New options -quoted_path_list, -quoted_not_list +* New option -backslash_codes for weird file names and terminal safety +* New options -charset, -in_charset, -out_charset +* New option -local_charset allows to override locale +* New option -application_id +* New option -compliance allows certain deviations from standards +* Suitable ISOLINUX boot images are made alternatively bootable via an MBR +* Bug fix in libisofs: ISOLINUX boot images were not patched correctly +* Bug fix in libisofs: mkisofs images with empty files got damaged +* Bug fix: Forgot exit value registration to -return_with. Thanks to Steve Dodd. +* Bug fix: -format as_needed did not recognize unformatted BD-RE +* Bug fix: disk patterns with relative addresses were not properly resolved + + +2008.12.01.202911 [2232] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.3.1 + +1 Dec 2008 [2233] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.3.1 - 2008.12.01.202911 + + +2 Dec 2008 [2234] +Promoted libisoburn 0.3.0 from branch to tag + +2 Dec 2008 [2235] [2236] [2237] [2238] +Deleted obsoleted branches + +2008.12.04.175459 [2240] [2241] +xorriso/xorriso.c +Bug fix: Options -extract and -extract_single were enabled with -osirrox off + +2008.12.05.171005 [2242] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +New API function isoburn_get_mount_params() + +2008.12.05.171700 [2243] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -mount and -mount_cmd + +2008.12.06.140828 [2244] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso_eng.html +Using uname() rather than #ifdef __FreeBSD__ + +2008.12.07.122439 [2245] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Got rid of call system() in Xorriso_mount(), new option -session_string + +Dec 7 2008 [2246] [2247] +xorriso/xorriso_eng.html +xorriso/xorriso.1 +Small documentation adjustments + +------------------------------------ cycle - xorriso-0.3.1 - 2008.12.07.122439 +* Bug fix: Options -extract and -extract_single were enabled with -osirrox off +* New API function isoburn_get_mount_params() +* New options -mount , -mount_cmd , -session_string + + +2008.12.08.120712 [2256] +xorriso/configure_ac.txt +Standalone version switch to libburn-0.5.9 + +2008.12.08.121106 [2257] +README +configure.ac +libisoburn/libisoburn.h +xorriso/README +Requiring at least libburn-0.5.8 + +8 Dec 2008 [2258] +xorriso/xorriso.1 +Small documentation adjustments + +2008.12.08.154521 [2259] +Makefile.am +xorriso/xorriso_private.h +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +Got rid of Xorriso_with_regeX + +2008.12.10.093424 [2272] +xorriso/xorrisoburn.c +Enabled formatting of BD-R media to SRM-POW default size + +10 Dec 2008 [2275] +xorriso/xorriso.1 +Mentioned BD-R in man xorriso + +2008.12.11.072427 [2277] +xorriso/xorrisoburn.c +Proper message after failed or refused formatting + +2008.12.13.142726 [2281] [2282] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -format modes by_size_ and fast_by_size_ + +2008.12.13.144622 [2283] +configure.ac +libisoburn/libisoburn.h +Demanding libburn-0.5.9 now + +------------------------------------ cycle - xorriso-0.3.1 - 2008.12.13.144622 +* By using libburn-0.5.9: support for BD-R media +* New -format modes by_size_ and fast_by_size_ + + +2008.12.13.161650 [2285] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Revoked -format mode by_size for DVD-RW + +12 Dec 2008 [2286] +xorriso/xorriso_eng.html +Updated xorriso web page + +2008.12.14.093125 [2288] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -assert_volid + +2008.12.14.151550 [2291] +xorriso/xorriso.c +Removed outdated alternative code + +2008.12.14.231145 [2293] +xorriso/xorriso.c +xorriso/xorriso.1 +Options for -as mkisofs: -input-charset, -output-charset + +2008.12.16.130139 [2295] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -drive_class for safety management of pseudo-drive access + +16 Dec 2008 [2296] +xorriso/README +xorriso/xorriso_eng.html +Updated xorriso documentation + +------------------------------------ cycle - xorriso-0.3.1 - 2008.12.16.130139 +* New option -assert_volid +* New option -drive_class for safety management of pseudo-drive access + + +17 Dec 2008 [2299] ++ doc/comments +Preparations for a more presentable online API documentation + +2008.12.17.102216 [2300] +Makefile.am +Delivering doxygen input for API documentation with releases + +17 Dec 2008 [2301] +doc/comments +Corrected list of authors in libisoburn API documentation + +2008.12.21.101705 [2317] +xorriso/xorrisoburn.c +Corrected message about non-matching volume id + +------------------------------------ cycle - xorriso-0.3.1 - 2008.12.21.154636 + + +21 Dec 2008 [2318] ++ test/aaip_0_2.h ++ test/aaip_0_2.c ++ test/aaip_0_2_test.c +A first implementation of AAIP 0.2 encoding and decoding + +23 Dec 2008 [2326] +test/aaip_0_2.h +test/aaip_0_2.c +test/aaip_0_2_test.c +Gave aaip_0_2 a ring buffer rather than a shifted fifo + +25 Dec 2008 [2336] +test/aaip_0_2.h +test/aaip_0_2.c +test/aaip_0_2_test.c +Encoder for ACL long text form + +26 Dec 2008 [2338] +test/aaip_0_2.h +test/aaip_0_2.c +test/aaip_0_2_test.c +Decoder for ACL to long text form + +1 Jan 2009 [2343] +test/aaip_0_2.h +test/aaip_0_2.c +test/aaip_0_2_test.c ++ test/aaip-os-linux.c ++ test/aaip-os-freebsd.c ++ doc/susp_aaip_0_2.txt +Introduced system adapters for getting and setting EA and ACL + +1 Jan 2009 [2344] +test/aaip_0_2.c +Corrected some bugs with attribute list decoding + +1 Jan 2009 [2345] +test/aaip_0_2.c +Corrected some more bug with attribute list decoding + +4 Jan 2009 [2355] +xorriso/configure_ac.txt +Standalone version switch to libburn-0.6.1 + +5 Jan 2009 [2357] +svn copy -m "Branching for libisoburn release 0.3.2 + http://svn.libburnia-project.org/libisoburn/trunk + http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeTwo + +2009.01.05.120643 [2358] +COPYRIGHT +libisoburn/burn_wrap.c +libisoburn/data_source.c +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +xorriso/compile_xorriso.sh +xorriso/xorrisoburn.c +xorriso/xorriso.h +Updated copyright marks to 2009 + +2009.01.05.123001 [2359] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.3.2 + +5 Jan 2009 [2360] [2361] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.3.2 - 2009.01.05.123001 +* Bug fix: Options -extract and -extract_single were enabled with -osirrox off +* New API function isoburn_get_mount_params() +* New options -mount , -mount_cmd , -session_string +* New -format modes by_size_ and fast_by_size_ +* New option -assert_volid +* New option -drive_class for safety management of pseudo-drive access +* By using libburn-0.6.0: support for BD-R media + + +2009.01.05.145703 [2362] +COPYRIGHT +libisoburn/burn_wrap.c +libisoburn/data_source.c +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +xorriso/compile_xorriso.sh +xorriso/xorrisoburn.c +xorriso/xorriso.h +Updated copyright marks to 2009 + +2009.01.05.153105 [2363] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_timestamp.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +Version leap to 0.3.3 + +5 Jan 2009 [2364] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.05.153105 + + +5 Jan 2009 [2365] +svn move http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeTwo + http://svn.libburnia-project.org/libisoburn/tags/ZeroThreeTwo +Promoted branch to tag + +2009.01.06.123047 [2368] +xorriso/xorriso.c +xorriso/xorriso_eng.html +Some small corrections of documentation + +9 Jan 2009 [2382] +xorriso/xorriso_eng.html +Mentioned bug fix and pl01 + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.09.103251 + +2009.01.10.154018 [2386] +xorriso/xorriso.h +xorriso/xorriso.c +Avoiding use of function parameter name "class" + +14 Jan 2009 [2395] +doc/susp_aaip_0_2.txt +Clarified that AAIP is only allowed if RRIP is present + +2009.01.14.110935 [2396] +Makefile.am +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +Introduced AAIP code. Now linking with libacl. + +2009.01.17.181500 [2400] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +New option -getfacl + +2009.01.18.213952 [2401] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Restoring ACLs with -extract and others + +2009.01.21.150243 [2402] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +New API macro isoburn_ropt_noaaip controls enabling of AAIP loading + +2009.01.21.203852 [2403] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +Had to split isoburn_ropt_noaaip into isoburn_ropt_noacl and isoburn_ropt_noea + +2009.01.21.204513 [2404] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +New option -acl enables ACL loading + +2009.01.22.130107 [2405] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +Now it is isoburn_ropt_noaaip , isoburn_ropt_noacl and isoburn_ropt_noea + +2009.01.22.130255 [2406] +xorriso/xorrisoburn.c +Adapted to new macro situation in libisoburn + +2009.01.22.143210 [2407] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New macro isoburn_igopt_aaip controls writing of AAIP info into images + +2009.01.22.143253 [2408] +xorriso/xorrisoburn.c +Making use of new libisoburn macro isoburn_igopt_aaip + +2009.01.22.152252 [2409] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Restoring ACL only if -acl "on" + +2009.01.22.155049 [2410] +xorriso/xorrisoburn.c +Removing leading slash from -getfacl output of file path + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.22.155049 +* New option -acl enables ACL import and export + + +2009.01.23.101305 [2411] +xorriso/configure_ac.txt +Promoted standalone libisofs to 0.6.13 + +2009.01.23.102843 [2412] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +Demanding libisofs 0.6.13 now + +2009.01.23.140824 [2413] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New find tests -has_acl, -has_no_acl, new action getfacl, new option getfacl_r + +23 Jan 2009 [2414] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.23.140824 +* New find tests -has_acl, -has_no_acl , new find action getfacl +* New option -getfacl_r + +2009.01.23.172652 [2415] +configure.ac +Makefile.am +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso compilation detects availability of libacl and of Linux listxattr call + +2009.01.23.172757 [2416] +xorriso/xorrisoburn.c +Silenced a FAILURE message with -acl if no image is loaded + +23 Jan 2009 [2417] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.23.172757 + + +24 Jan 2009 [2418] +xorriso/compile_xorriso.sh +Took into respect changed .o file names of libisofs + +2009.01.25.141124 [2424] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -setfacl, -setfacl_r, new -find action setfacl + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.25.141124 +* New option -setfacl, -setfacl_r, new -find action setfacl + + +25 Jan 2009 [2425] +- test/aaip_0_2.h +- test/aaip_0_2.c +- test/aaip-os-freebsd.c +- test/aaip-os-linux.c +- test/aaip_0_2_test.c +- doc/susp_aaip_0_2.txt +AAIP code now resides in libisofs + +2009.01.26.173254 [2426] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New macro isoburn_igopt_aaip_susp_1_10 controls writing of AAIP ER and ES + +2009.01.26.173606 [2427] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Gave user control over isoburn_igopt_aaip_susp_1_10 + +26 Jan 2009 [2428] +xorriso/make_xorriso_standalone.sh +Including doc/susp_aaip_0_2.txt in xorriso-standalone + +2009.01.27.121417 [2432] +libisoburn/libisoburn.h +Mentioned the need for 64 bit file i/o + +2009.01.28.074917 [2434] +xorriso/xorrisoburn.c +Bug fixes and enhancements about "default" ACL + +2009.01.28.114755 [2435] +xorriso/xorrisoburn.c +Bug fixes and enhancements about "default" ACL + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.28.114755 + + +2009.01.28.190140 [1436] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Made -getfacl file name escaping more similar to shell command behavior + +2009.01.29.165339 [2437] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorriso.1 +New option -setfacl_list + +28 Jan 2009 [2438] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.29.165339 +* New option -setfacl_list + +29 Jan 2009 [2439] +xorriso/xorriso_makefile_am.txt +Added aaip-os-dummy.c to xorriso-standalone + +2009.01.29.210606 [2440] +xorriso/xorrisoburn.c +Bug fix: included sys/wait.h rather than wrong wait.h + +2009.01.30.145624 [2442] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Followed changes in iso_node_*acl_text API + +------------------------------------ cycle - xorriso-0.3.3 - 2009.01.30.200825 + +2009.01.31.101122 [2443] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Equipped output of lsl with '+' perm if ACL is present + +2009.02.02.134346 [2444] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -xattr, -getfattr, find -has_xattr, -has_aaip, -exec getfattr + +2009.02.02.201124 [2445] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enabled restoring of xattr + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.02.201124 +* New options -xattr, -getfattr, find -has_xattr, -has_aaip, -exec getfattr + + +2009.02.03.162440 [2446] +Makefile.am +xorriso/xorriso_makefile_am.txt +Linking with $LIBBURN_ARCH_LIBS to get -lcam on FreeBSD + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.03.162440 + + +2009.02.04.200055 [2449] +xorriso/xorrisoburn.c +Took into respect eventual resolution of symbolic links + +2009.02.04.200653 [2450] +configure.ac +xorriso/configure_ac.txt +Checking for iconv(3) in separate libiconv (e.g. on FreeBSD) + +2009.02.07.090104 [2453] +xorriso/xorrisoburn.c +Correct group permission bits with -acl off and -extract file that has ACL + +2009.02.07.142605 [2454] +xorriso/xorrisoburn.c +Correct group permission bits with -acl off and disk file that has ACL + +2009.02.08.132116 [2455] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +First code for -setfattr (have to fix some ACL problems before going on) + +2009.02.08.151354 [2456] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Displaying "+" with lslx if ACL is detected + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.08.151354 +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.09.103308 +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.09.170857 + +2009.02.09.185940 [2458] +xorriso/xorriso.c +xorriso/xorrisoburn.c +New options -setfattr, -setfattr_r, new find -exec setfattr + +10 Feb 2009 [2459] +xorriso/xorriso_eng.html +Updated xorriso home page + +2009.02.10.125831 [2460] +xorriso/xorrisoburn.c +Closed a memory leak with unreleased IsoImage in boot image inquiry + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.10.195106 + +12 Feb 2009 [2461] +xorriso/convert_man_to_html.sh +Adapted html man page generator to textchanges + +2009.02.12.110516 [2462] +xorriso/xorriso.h +xorriso/xorriso.c +New -as mkisofs options --acl and --xattr + +12 Feb 2009 [2463] +xorriso/xorriso.1 +Updated xorriso man page + +2009.02.13.202539 [2464] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -setfattr_list + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.13.202539 +* New -as mkisofs options --acl and --xattr +* New option -setfattr_list + + +2009.02.14.133013 [2465] +xorriso/xorriso.c +-as mkisofs --acl and --xattr was not properly recognized + +2009.02.16.082645 [2466] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Took into respect ACL and xattr with -compare and -update + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.16.082645 + + +2009.02.17.184231 [2467] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -disk_dev_ino + +2009.02.19.123524 [2475] +libisoburn/isofs_wrap.c +Adapted to removal of Libburn_with_aaiP macro + +2009.02.19.123607 [2476] +xorriso/xorrisoburn.c +Adapted to removal of Libburn_with_aaiP macro + +19 Feb 2009 [2477] +xorriso/configure_ac.txt +Adapted to version leap libisofs-0.6.14 + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.19.123607 +* New option -disk_dev_ino accelerates incremental backups + + +2009.02.19.183707 [2478] +xorriso/xorriso_private.h +Committing forgotten xorriso_private.h + +20 Feb 2009 [2487] +xorriso/configure_ac.txt +Adapted to version leap libburn-0.6.2 + +2009.02.25.144045 [2496] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +-disk_dev_ino mode ino_only + +2009.02.28.175747 [2502] +configure.ac +Requiring libisofs-0.6.14 now, libburn-0.6.0 still suffices + +2009.02.28.175926 [2503] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New API function isoburn_igopt_get_data_start() + +2009.02.28.181358 [2504] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -stream_recording mode with start address, "on" is now 32s + +2009.02.28.181750 [2505] +xorriso/configure_ac.txt +Switched standalone version to libisofs-0.6.15 + +------------------------------------ cycle - xorriso-0.3.3 - 2009.02.28.181750 + +01 Mar 2009 [2506] +svn copy -m Branching for libisoburn release 0.3.4 + http://svn.libburnia-project.org/libisoburn/trunk + http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeFour + +2009.03.01.103001 [2507] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/xorriso.1 +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to 0.3.4 + +1 Mar 2009 [2508] +xorriso/changelog.txt +Documented changes and release timestamp + +1 Mar 2009 [2509] +README +xorriso/README +Correction about libisofs.so version requirement + +----------------------------------- release - xorriso-0.3.4 - 2009.03.01.103001 +* New option -acl enables ACL import and export +* New options -getfacl, -getfacl_r, -setfacl, -setfacl_r, -setfacl_list +* New find tests -has_acl, -has_no_acl , new find actions getfacl, setfacl +* New option -xattr enables import and export of Extended Attributes +* New options -getfattr, -getfattr_r, -setfattr, -setfattr_r, -setfattr_list +* New find tests -has_xattr, -has_aaip, new find actions getfattr, setfattr +* New -as mkisofs options --acl and --xattr +* New option -disk_dev_ino accelerates incremental backups + + +2009.03.01.113444 [2510] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/xorriso.1 +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to 0.3.5 + +1 Mar 2009 [2511] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.3.5 - 2009.03.01.113444 + +1 Mar 2009 [2512] +svn move -m 'Promoted branch to tag' + http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeFour + http://svn.libburnia-project.org/libisoburn/tags/ZeroThreeFour + +2009.03.03.103421 [2517] +libisoburn/libisoburn.h +isoburn_igopt_get_data_start() @since 0.3.6 because not announced in 0.3.4 + +2009.03.03.103706 [2518] +xorriso/configure_ac.txt +Making optional use of statvfs() in sg-dummy + +------------------------------------ cycle - xorriso-0.3.5 - 2009.03.03.103706 + +2009.03.05.121700 [2519] +acinclude.m4 +Lifted the ban on operating systems other than Linux and FreeBSD + +------------------------------------ cycle - xorriso-0.3.5 - 2009.03.05.121700 +* Dummy MMC adapter for compilation on systems other than Linux, FreeBSD + + +2009.03.08.140002 [2521] +xorriso/xorriso.c +xorriso/xorrisoburn.c +test/compare_file.c +Reacted on compiler warnings of SchilliX-0.6.7 (based on Solaris 5.11) + + +2009.03.10.092227 [2523] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Made -compliance old_rr imply -compliance aaip_susp_1_10 + +------------------------------------ cycle - xorriso-0.3.5 - 2009.03.10.092227 + +2009.03.11.170125 [2524] +configure.ac +libisoburn/libisoburn.h +libisoburn/isoburn.c +Requiring libisofs-0.6.16 now + +2009.03.11.170236 [2525] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.16 + +11 Mar 2009 [2526] +xorriso/xorriso_eng.html +Mentioned bug fixes in libisofs + +11 Mar 2009 [2527] +xorriso/xorriso.1 +Minor changes in xorriso man page + +------------------------------------ cycle - xorriso-0.3.5 - 2009.03.11.170236 + + +2009.03.12.141647 [2528] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Made -compliance old_rr the default + +2009.03.13.150731 [2536] +xorriso/xorrisoburn.c +Defaulting -stream_recording "data" to "100m" + +2009.03.13.150838 [2537] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.6.5 + +2009.03.14.113811 [2539] +xorriso/xorriso.c +Fixed the inappropriate refusal on paths like /u/test/../.. + +2009.03.14.115711 [2540] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.6.4 now + +------------------------------------ cycle - xorriso-0.3.5 - 2009.03.14.115711 +* default of -compliance has been changed to "old_rr", new rule "new_rr" + +16 Mar 2009 [2541] +svn copy -m "Branching for libisoburn release 0.3.6" \ + http://svn.libburnia-project.org/libisoburn/trunk \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeSix + +2009.03.16.090001 [2542] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.3.6 + +16 Mar 2009 [2543] +xorriso/changelog.txt +Documented changes and release timestamp + +16 Mar 2009 [2544] +configure.ac +Adjusted forgotten version number + +----------------------------------- release - xorriso-0.3.6 - 2009.03.16.090001 +* Dummy MMC adapter for compilation on systems other than Linux, FreeBSD +* Default of -compliance has been changed to "old_rr", new rule "new_rr" +* New -stream_recording modes with start address or "data". "on" is now 32s. + + +2009.03.16.112837 [2545] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.3.7 + +16 Mar 2009 [2546] +xorriso/changelog.txt +Documented changes and release timestamp + +17 Mar 2009 [2548] +svn move -m 'Promoted branch to tag' \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeSix \ + http://svn.libburnia-project.org/libisoburn/tags/ZeroThreeSix + +------------------------------------ cycle - xorriso-0.3.7 - 2009.03.16.112837 + + +2009.03.18.103858 [2550] +configure.ac +acinclude.m4 +Makefile.am +Get on FreeBSD pkgconfigdir=.../libdata , on Linux and others: .../lib + +2009.03.18.104037 [2551] +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +Adapted xorriso-standalone to version leap libisofs-0.6.17 and FreeBSD libdata + +18 Mar 2009 [2552] +configure.ac +Removed useless libisoburn configure options --enable-libacl --enable-xattr + +2009.03.19.172806 [2555] +xorriso/xorriso.c +Unified -status filtering decision + +2009.03.20.192910 [2557] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +New API functions isoburn_ropt_[sg]et_auto_incharset() + +2009.03.20.193334 [2558] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -auto_charset based on xattr "isofs.cs" + +------------------------------------ cycle - xorriso-0.3.7 - 2009.03.21.131424 +* New option -auto_charset based on xattr "isofs.cs" + + +22 Mar 2009 [2559] +xorriso/xorriso.1 +Clarification about -auto_charset pitfalls + +2009.03.22.090232 [2560] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Stuffed memory leaks on -commit and loading of El Torito records + +2009.03.29.164336 [2561] +configure.ac +Revoked revision 2552. Dynamic xorriso did not get linked with -lacl any more. + +2009.03.29.164411 [2562] +libisoburn/libisoburn.h +libisoburn now demands libisofs-0.6.17 + +2009.03.29.164703 [2563] +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +Adapted to new libisofs feature iso_file_add_external_filter() + +2009.03.29.164931 [2564] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Experimental -find action -exec set_filter with some hardcoded filter commands + +2009.04.02.162530 [2565] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New options -external_filter , -unregister_filter, -set_filter , -set_filter_r + +------------------------------------ cycle - xorriso-0.3.7 - 2009.04.02.162530 +* New options -external_filter , -unregister_filter, -set_filter , -set_filter_r + + +2009.04.03.172034 [2566] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Fixed a potential blind spot of 1 second in -disk_dev_ino comparison + +2009.04.04.082636 [2567] +xorriso/xorrisoburn.c +Fixed a bug with the error message about external filters and setuid + +2009.04.04.144009 [2568] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -close_filter_list + +2009.04.04.144241 [2569] +configure.ac +Makefile.am +README +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso/compile_xorriso.sh +xorriso/README +configure options to control availability of external filters in xorriso + +2009.04.05.110534 [2570] +xorriso/xorriso.c +Reporting number of processed filters with -set_filter and -set_filter_r + +2009.04.05.110652 [2571] +xorriso/xorrisoburn.c +Fixed a bug about detection of failure with -set_filter + +2009.04.05.131536 [2572] +xorriso/xorriso.c +Included sys/select.h as prescribed by POSIX and Linux, FreeBSD man pages + +2009.04.05.143043 [2573] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorriso.1 +New -osirrox mode "banned" + +5 Apr 2009 [2574] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.3.7 - 2009.04.05.143043 +* New option -close_filter_list +* New -osirrox mode "banned" + + +2009.04.06.100802 [2575] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Suffix rollback with -set_filter --remove-all-filters + +2009.04.06.132007 [2576] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -show_stream, -show_stream_r, -exec show_stream + +2009.04.06.143109 [2577] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Changed appearance of -show_stream, fixed bug introduced with rev 2575 + +2009.04.06.161541 [2578] +xorriso/xorrisoburn.c +Fixed bug introduced with 2575 + +------------------------------------ cycle - xorriso-0.3.7 - 2009.04.06.161541 +* New options -show_stream, -show_stream_r, new -find -exec show_stream + +2009.04.07.120250 [2579] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -find tests -has_filter, -has_no_filter + +2009.04.07.122117 [2580] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Removed some unused old code branches + +2009.04.10.102558 [2581] +configure.ac +Makefile.am +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso/compile_xorriso.sh +Took into respect optional libz dependency of libisofs + +2009.04.10.103130 [2582] +xorriso/xorrisoburn.c +Introduced builtin filters --zisofs and --zisofs-decode + +11 Apr 2009 [2583] +xorriso/make_xorriso_standalone.sh +Included a copy of doc/zisofs_format.txt in xorriso-standalone + +2009.04.11.125331 [2584] +xorriso/xorrisoburn.c +Adjustments with filter --zisofs-decode + +2009.04.11.172644 [2585] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -zisofs, builtin filters --zisofs and --zisofs-decode + +12 Apr 2009 [2586] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.3.7 - 2009.04.12.142252 +* New option -zisofs, builtin filters --zisofs and --zisofs-decode + + +14 Apr 2009 [2588] +README +xorriso/README +Updated README texts of libisoburn and xorriso + +2009.04.14.092306 [2589] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -zisofs option by_magic=on + +------------------------------------ cycle - xorriso-0.3.7 - 2009.04.14.092306 + +2009.04.15.071944 [2590] +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Adopted new libisofs filter module gzip.c, builtin filters --gzip, --gunzip + +2009.04.15.185131 [2591] +libisoburn/isofs_wrap.c +xorriso/xorrisoburn.c +Removed dependency on Libisofs_has_auto_input_charseT + +2009.04.15.185238 [2592] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.18 now + +2009.04.15.185359 [2593] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.18 + +2009.04.16.145617 [2594] +xorriso/make_xorriso_standalone.sh +xorriso/xorriso_makefile_am.txt +Fixed bugs with rarely used make dist + +2009.04.18.090616 [2596][2597] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.19 + +------------------------------------ cycle - xorriso-0.3.7 - 2009.04.18.090616 + +2009.04.18.120001 [2598] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.3.8 + +18 Apr 2009 [2599][2600] +xorriso/xorriso.1 +Last minute correction in xorriso man page + +18 Apr 2009 [2601] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.3.8 - 2009.04.18.120001 +* New options -set_filter , -set_filter_r, -find -exec set_filter +* New option -zisofs, builtin filters --zisofs , --gzip , --gunzip +* New options -external_filter , -unregister_filter, -close_filter_list, +* New options -show_stream, -show_stream_r +* New -osirrox mode "banned" +* New option -auto_charset based on xattr "isofs.cs" + + +2009.04.18.150555 [2602] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.3.9 + +18 Apr 2009 [2603] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.3.9 - 2009.04.18.150555 + +19 Apr 2009 [2608] +svn move -m 'Promoted branch to tag' \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroThreeEight \ + http://svn.libburnia-project.org/libisoburn/tags/ZeroThreeEight + +2009.04.21.173600 [2612] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enhanced -find testing by operators -not, -or, -and, (, ), -if, -else, -endif + +2009.04.21.184214 [2613] +xorriso/xorriso.c +Allowed implicit -and operator with -not, -if and -sub + +22 Apr 2009 [2614] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.3.9 - 2009.04.21.184214 +* Operators with option -find : -not, -or, -and, (, ), -if, -then, -else + + +2009.04.22.173603 [2615] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +New API call isoburn_toc_track_get_emul() + +2009.04.22.173648 [2616] +xorriso/xorrisoburn.c +Made use of new libisoburn call to accelerate option -toc for large TOC + +2009.04.23.103301 [2617] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -find tests -wholename, -prune + +2009.04.25.160022 [2618] +libisoburn/burn_wrap.c +Used isoburn_toc_track_get_emul() in isoburn_set_msc1() + +2009.04.25.162210 [2619] +xorriso/xorrisoburn.c +Moved call of isoburn_set_msgs_submit() to Xorriso_startup_libraries() + +2009.04.25.162858 [2620] +libisoburn/burn_wrap.c +Issueing pacifier messages from within isoburn_set_msc1() + +------------------------------------ cycle - xorriso-0.3.9 - 2009.04.25.162858 +* New -find tests -wholename, -prune + + +2009.05.06.173600 [2626] +xorriso/xorrisoburn.c +Bug fix: SIGSEGV with option -status and no search string + +2009.05.06.174222 [2627] +xorriso/xorrisoburn.c +Bug fix: -load volid did not perform pattern search + +2009.05.08.073642 [2638] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.6.7 + +2009.05.09.201241 [2639] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +New API options isoburn_ropt_noino and isoburn_igopt_hardlinks + +2009.05.09.201742 [2640] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -hardlinks + +2009.05.14.082045 [2641] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enhanced option -extract_cut for handling filtered files + +2009.05.16.165616 [2642] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +LBA sorted processing of -compare_r and -update_r for smoother MMC reading + +2009.05.16.165940 [2643] +xorriso/xorrisoburn.c +Disabled use of iso_tree_add_new_symlink() in favor of iso_tree_add_new_node() + +2009.05.17.115101 [2644] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New pseudo test with -find : -sort_lba which is actually an option + +2009.05.26.140055 [2647] +xorriso/xorrisoburn.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Enabled -hardlinks for options -extract, -extract_l and -cp*x + +2009.05.26.142912 [2648] +xorriso/xorriso.c +Revoked LBA sorted reading with -compare_r. It was ugly. + +------------------------------------ cycle - xorriso-0.3.9 - 2009.05.26.172355 +Bug fix: SIGSEGV with option -status and no search string +Bug fix: -load volid did not perform pattern search +New option -hardlinks +Improved reading performance with -update_r and -extract + + +2009.05.29.110831 [2649] +xorriso/xorriso.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -for_backup as shortcut for -acl -xattr -hardlinks + +2009.05.29.162300 [2650] +xorriso/xorrisoburn.c +Avoided unnecessary sorting during -extract + +2009.05.30.161808 [2561] +xorriso/xorriso.c +Avoided unconditional output of -hardlinks with option -status + +2009.05.31.100140 [2652] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.20 now + +2009.05.31.100315 [2653] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.20 + +2009.05.31.185819 [2654] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.21 + +13 Jun 2009 [2668] +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso/make_xorriso_standalone.sh +Removed xorriso.pc.in from xorriso-standalone tarball + +2009.06.15.121525 [2670] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +With -update_r : detecting hardlink splits and fusions on disk + +2009.06.20.063853 [2671] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Wider scope of hardlink reconstruction with extract operations + +2009.06.22.112850 [2672] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Gave up risky direct update of hardlink siblings + +2009.06.23.065744 [2673] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c ++ xorriso/makefile_libxorriso_am.txt +Introduced alternative Makefile.am for libxorriso production + +2009.06.23.070934 [2674] +xorriso/xorriso_private.h +Added missing function declaration + +2009.06.23.123147 [2675] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +Removed from xorriso main() any dependency on non-API features + +2009.06.23.133210 [2676] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +Rough test for compile time and run time libxorriso version mismatches + +2009.06.23.164351 [2677] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Deprecated -hardlinks modes "start_update", "end_update" for "perform_update" + +23 Jun 2009 [2678] +xorriso/xorriso.1 +Updated xorriso man page + +2009.06.24.133521 [2679] +xorriso/xorriso.c +Reverted order of memorized hardlink update parameters + +2009.06.25.125048 [2680] +libisoburn/burn_wrap.c +Bug fix: Copies of overwriteable media onto sequential were mistaken in ROM drives + +2009.06.27.112408 [2681] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +With -extract : made hardlink registration combinable with sort_lba + +------------------------------------ cycle - xorriso-0.3.9 - 2009.06.27.112408 +New option -for_backup as shortcut for -acl -xattr -hardlinks +Bug fix: Copies of overwriteable media on sequential were mistaken in ROM drives + +28 Jun 2009 [2681] +svn copy -m "Branching for libisoburn release 0.4.0" \ + http://svn.libburnia-project.org/libisoburn/trunk \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroFourZero + +2009.06.28.090001 [2683] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.0 + +28 Jun 2009 [2684] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.4.0 - 2009.06.28.090001 +* New option -hardlinks +* Improved reading performance with -update_r and -extract +* New option -for_backup as shortcut for -acl -xattr -hardlinks +* Operators with option -find : -not, -or, -and, (, ), -if, -then, -else +* New -find tests -wholename, -prune +* Bug fix: SIGSEGV with option -status and no search string +* Bug fix: -load volid did not perform pattern search +* Bug fix: Copies of overwriteable media on sequential were mistaken in ROM drives + +2009.06.28.100124 [2685] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.1 + +28 Jun 2009 [2686] +xorriso/changelog.txt +Documented changes and release timestamp + +28 Jun 2009 [2687] +svn move -m 'Promoted branch to tag' \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroFourZero \ + http://svn.libburnia-project.org/libisoburn/tags/ZeroFourZero + +------------------------------------ cycle - xorriso-0.4.1 - 2009.06.28.100124 + +2009.06.30.120311 [2688] +configure.ac +xorriso/configure_ac.txt +Provisory patch on ticket 152: GNU libiconv needs -liconv but offers no iconv() + +2009.06.30.154606 [2689] +xorriso/xorriso.c +Bug fix: Ticket 149, one byte overflow of local variable. + +2009.07.07.175748 [2690] +configure.ac +xorriso/configure_ac.txt +Aligned configure --help texts provided by own code in configure.ac + +2009.07.07.193955 [2693] +acinclude.m4 +configure.ac +xorriso/configure_ac.txt +configure options --enable-libdir-pkgconfig and --enable-pkgconfig-path=DIR + +2009.07.14.134423 [2701] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.6.9 + +2009.07.19.214008 [2703] +xorriso/xorriso.c +Bug fix: xorriso -as mkisofs did not understand the -C option of growisofs any more + +------------------------------------ cycle - xorriso-0.4.1 - 2009.07.19.214008 +Bug fix: xorriso -as mkisofs did not understand the -C option of growisofs any more + +------------------------------ release - xorriso-0.4.0.pl01 - 2009.07.20.060001 +Bug fix: xorriso -as mkisofs did not understand the -C option of growisofs any more + + +23 Jul 2009 [2704] +xorriso/xorriso.1 +More emphasis on early use of -hardlinks, -acl, -xattr etc. + +2009.07.23.103339 [2705] +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +Adopted new libisofs source module md5.[cho] + +2009.07.23.103728 [2706] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Showing a better link count with -hardlinks on -lsl + +2009.07.25.181857 [2707] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso_eng.html +Updating sorted link array before usage after image manipulations + +------------------------------------ cycle - xorriso-0.4.1 - 2009.07.25.181857 +Options -lsl and lsdl now display correct link counts if -hardlinks is on + + +2009.08.03.075954 [2708] +xorriso/xorrisoburn.c +Bug fix: Use of freed memory with -hardlinks on and -update + +03 Aug 2009 [2709] +xorriso/xorriso.1 +Hints about -hardlinks and file content filtering + +2009.08.10.123146 [2710] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New find actions get_md5, get_any_xattr, test -has_any_xattr + +2009.08.10.192240 [2711] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +New write options session_md5, file_md5, read option nomd5 + +2009.08.10.193843 [2712] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -md5, new -as mkisofs option --md5 + +2009.08.10.194416 [2713] +xorriso/xorriso.h +xorriso/xorrisoburn.h +Missing changes in rev 2710 and 2712 + +2009.08.11.194836 [2714] +configure.ac +libisoburn/libisoburn.h +Requiring at least libisofs-0.6.21 now + +2009.08.11.194836 [2715] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -check_md5, -check_md5_r, find action check_md5, test -has_md5 + +2009.08.12.130401 [2716] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Completed find action check_md5 + +2009.08.12.202423 [2717] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Checking MD5 of whole session with -check_md5 and empty path list + +2009.08.13.203718 [2718] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Better reaction wich -check_md5 if no MD5 array is loaded + +2009.08.14.102355 [2719] +xorriso/xorriso.c +xorriso/xorrisoburn.c +More timely abort of find jobs if the result pager gets aborted + +2009.08.14.211648 [2720] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorriso.1 +Letting -check_media look for session checksum tags + +2009.08.15.173403 [2724] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso.1 +Introduced -check_media event= for mismatch events + +2009.08.16.200906 [2725] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Adapted to a change in iso_util_decode_md5_tag() + +2009.08.17.162456 [2726] +libisoburn/burn_wrap.c +Giving overwriteable media a single-session toc with isoburn_drive_aquire(bit4) + +2009.08.17.162834 [2727] +xorriso/xorrisoburn.c +-check_media recognizes relocated 64kB superblock tag and hops over session gaps + +2009.08.18.173453 [2728] +xorriso/xorrisoburn.c +Making use of new API call iso_md5_match() and adapted to MD5 image mismatches + +2009.08.18.191013 [2729] +xorriso/xorriso.c +xorriso/xorriso.1 +Included -md5 on with option -for_backup + +------------------------------------ cycle - xorriso-0.4.1 - 2009.08.18.191013 +New option -md5, new -as mkisofs option --md5 +New options -check_md5, -check_md5_r +New find actions check_md5 get_md5, get_any_xattr +New find tests -has_md5, -has_any_xattr +libisoburn: New write options session_md5, file_md5, read option nomd5 + + +2009.08.19.180632 [2730] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +Adapted to enhanced iso_write_opts_set_record_md5() + +2009.08.19.180842 [2731] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -md5 mode "all" + +19 Aug 2009 [2732] +xorriso/xorriso_eng.html +Corrections with xorriso web page + +2009.08.20.204309 [2733] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Made -compare and -update work with recorded MD5 sums + +2009.08.22.184241 [2734] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -find action make_md5 to equip files from old images with MD5 + +2009.08.24.182839 [2738] +configure.ac +libisoburn/libisoburn.h +Demanding libburn-0.6.9 now + +2009.08.24.183750 [2739] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -calm_drive + +2009.08.25.191217 [2741] +xorriso/xorrisoburn.c +More timely report of library messages with -check_md5 + +2009.08.25.191325 [2742] +xorriso/xorriso.1 +Updated incremental backup example + +2009.08.25.191433 [2743] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.22 now + +2009.08.25.191543 [2744] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.23 + +------------------------------------ cycle - xorriso-0.4.1 - 2009.08.25.191543 +Options -compare, -compare_r, -update, update_r now can use recorded MD5 +New -find action make_md5 to equip files from old images with MD5 +New option -calm_drive + + +2009.08.27.175608 [2752] +xorriso/xorriso.c +Updated helptext about -find actions, new -as mkisofs option --for_backup + +2009.08.27.175719 [2753] +libisoburn/libisoburn.h +configure.ac +Requiring libburn-0.7.0 now + +2009.08.27.175806 [2754] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.7.1 + +2009.08.28.100829 [2756] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -list_profiles + +2009.08.28.101405 [2757] +xorriso/xorriso.c +Forgot to store before committing + +2009.08.28.101716 [2758] +xorriso/xorriso_private.h +Forgot to commit xorriso_private.h + +2009.08.28.112825 [2759] +xorriso/xorrisoburn.c +Small correction with reporting profile "Removable disk" + +------------------------------------ cycle - xorriso-0.4.1 - 2009.08.28.112825 +New option -list_profiles + + +29 Aug 2009 [2760] +svn copy -m "Branching for libisoburn release 0.4.2" +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFourTwo + +2009.08.29.143001 [2761] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.2 + +29 Aug 2009 [2762] +xorriso/xorriso.1 +Some updates and corrections in xorriso man page + +29 Aug 2009 [2765] +xorriso/changelog.txt +Document changes and release timestamp + +----------------------------------- release - xorriso-0.4.2 - 2009.08.29.143001 +* libisoburn: New write options session_md5, file_md5, file_stability +* libisoburn: New read option nomd5 +* Bug fix: xorriso -as mkisofs did not understand the -C option of growisofs any more +* Options -lsl and lsdl now display correct link counts if -hardlinks is on +* New option -md5, new -as mkisofs option --md5 +* New options -check_md5, -check_md5_r +* New find actions check_md5 get_md5, get_any_xattr +* New find tests -has_md5, -has_any_xattr +* Options -compare, -compare_r, -update, update_r now can use recorded MD5 +* New -find action make_md5 to equip files from old images with MD5 +* New option -calm_drive +* New option -list_profiles + + +29 Aug 2009 [2763] +xorriso/xorriso.1 +Some updates and corrections in xorriso man page + +2009.08.29.180146 [2764] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.3 + +29 Aug 2009 [2766] +xorriso/changelog.txt +Documented changes and release timestamp + +30 Aug 2009 [2767] +move -m 'Promoted branch to tag' +http://svn.libburnia-project.org/libisoburn/branches/ZeroFourTwo +http://svn.libburnia-project.org/libisoburn/tags/ZeroFourTwo + +------------------------------------ cycle - xorriso-0.4.3 - 2009.08.29.180146 + + +31 Aug 2009 [2768] +xorriso/make_xorriso_standalone.sh +Added libisofs/doc/checksums.txt to xorriso standalone tarball + +2009.08.31.162746 [2769] +xorriso/xorriso.c +Bug fix: -for_backup did not enable -xattr and -md5 if no drive was chosen yet + +31 Aug 2009 [2770] +configure.ac +Requiring libisofs-0.6.23 now + +2009.08.31.210528 [2771] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New API call iso_write_opts_set_scdbackup_tag() + +2009.08.31.211005 [2772] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -scdbackup_tag + +2009.09.01.110102 [2776] +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +Removed libburn/lec.c from xorriso standalone and development scripts + + +------------------------------------ cycle - xorriso-0.4.3 - 2009.09.01.110102 +* Bug fix: -for_backup did not enable -xattr and -md5 if no drive was chosen yet +* New option -scdbackup_tag + + +2009.09.06.094209 [2796] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.1 now + +2009.09.06.112851 [2798] +xorriso/xorrisoburn.c +Reporting "Media product:" with xorriso option -toc + +2009.09.06.144813 [2799] +xorriso/xorrisoburn.c +Reporting media product info with -as cdrecord -atip + +2009.09.07.161247 [2800] +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Avoided to use MD5 on filtered streams with compare and update + +------------------------------------ cycle - xorriso-0.4.3 - 2009.09.07.161247 +* Option -toc now reports "Media product:" + + +2009.09.13.095136 [2811] +libisoburn/burn_wrap.c +xorriso/xorrisoburn.c +Eventually truncate stdio: track size to file size and issue warning + +2009.09.16.162424 [2812] +xorriso/xorriso.h +xorriso/xorriso.c +Avoiding a potential memory leak in xorriso main() + +2009.09.17.144453 [2813] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +Expanded new API call isoburn_igopt_set_scdbackup_tag + +2009.09.17.144849 [2814] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Changing new option -scdbackup_tag + +2009.09.19.161026 [2817] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -osirrox sub-options o_excl_on/off. Program osirrox starts with o_excl_off. + +2009.09.20.092811 [2818] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Bug fix: Corrected handling of -as cdrecord -mode2, -xa, -xa2, -xa2, -xamix, xorrisofs -help, xorrecord -help + +2009.09.20.110715 [2819] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Adjusted xorriso -as cdrecord fifo chunk size to -xa1 + +------------------------------------ cycle - xorriso-0.4.3 - 2009.09.20.110715 +* Bug fix: With -as cdrecord : -xa1 and -xamix were ignored although they do matter +* Bug fix: xorrisofs -help, xorrecord -help displayed original xorriso -help + + +2009.09.22.143534 [2821] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Bug fix: -cut_out deleted previously cut-out pieces of the same file + +------------------------------------ cycle - xorriso-0.4.3 - 2009.09.22.143534 +* Bug fix: -cut_out deleted previously cut-out pieces of the same file + + +2009.09.27.080401 [2827] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Narrowed rules for recognizing split file parts + +2009.09.28.173322 [2828] +xorriso/xorrisoburn.c +xorriso/xorriso.1 +Restricted split part recognition to directories with a complete part set + +2009.09.30.092640 [2829] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -check_media sub options bad_limit=, slow_limit=, chunk_size= + +------------------------------------ cycle - xorriso-0.4.3 - 2009.09.30.092640 + + +2009.10.05.165632 [2831] +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +Avoided FAILURE event with welcoming empty disk files + +2009.10.05.172143 [2832] +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -pvd_info + +2009.10.05.183619 [2833] +xorriso/xorrisoburn.c +Adjusted -pvd_info to the peculiarities of -volid + +2009.10.05.190215 [2834] +xorriso/xorrisoburn.c +Added code to xorriso for repairing "_" in all three PVD id file names + +------------------------------------ cycle - xorriso-0.4.3 - 2009.10.05.190215 +* New option -pvd_info + + +2009.10.06.071704 [2835] +xorriso/xorrisoburn.c +Made sure that -pvd_info reports the actual PVD address + +2009.10.07.072645 [2836] +libisoburn/isofs_wrap.c +Declared as closed those media which have read errors in the first 64 kB + +2009.10.07.075634 [2837] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +New bit7 with isoburn_drive_aquire(): pretend read-only + +2009.10.07.080042 [2838] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -rom_toc_scan sub option "force" to get DVD/BD table-of-content on Solaris + +------------------------------------ cycle - xorriso-0.4.3 - 2009.10.07.080042 + + +2009.10.07.124047 [2839] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Aligned sessions on overwriteables to full 32 blocks + +2009.10.07.140521 [2840] +libisoburn/burn_wrap.c +Avoided FATAL event with -rom_toc_scan force and non-ISO media + +2009.10.07.180552 [2841] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -system_id , -volset_id + +------------------------------------ cycle - xorriso-0.4.3 - 2009.10.07.180552 +* New options -system_id , -volset_id +* Bug fix libisofs: Filenames could lose blanks during a multi-session cycle + +------------------------------- patch - xorriso-0.4.2.pl02 - 2009.10.08.080001 +* Bug fix: -for_backup did not enable -xattr and -md5 if no drive was chosen yet +* Bug fix: xorrisofs -help, xorrecord -help displayed original xorriso -help +* Bug fix libisofs: Filenames could lose blanks during a multi-session cycle + + +2009.10.08.155605 [2845] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.24 now + +2009.10.08.155749 [2846] +xorriso/configure_ac.txt +xorriso/xorriso_eng.html +Adapted xorriso-standalone to version leap libisofs-0.6.25 + +2009.10.10.142353 [2851] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +xorriso/xorriso_eng.html +New option -mount_opts + +2009.10.11.141528 [2852] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +Made -application_id, -publisher, -system_id, -volset_id pending image changes + +2009.10.11.141815 [2853] +xorriso/xorriso.c +Changed FreeBSD mount command to mount_cd9660 + +2009.10.14.114830 [2862] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.7.3 + +2009.10.14.115223 [2863] +README +xorriso/README +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.2 now + +------------------------------------ cycle - xorriso-0.4.3 - 2009.10.14.115223 +* New option -mount_opts + + +2009.10.17.191225 [2866] +xorriso/compile_xorriso.sh +xorriso/xorriso_makefile_am.txt +Added libburn/ecma130ab.[cho] to xorriso standalone and development scripts + +2009.10.22.155746 [2869] +xorriso/xorrisoburn.c +Added a "NOT READBLE" result line to -check_md5 + +22 Oct 2009 [2870] +xorriso/xorriso.1 +Added man page example: Burn an existing ISO image file to media + +27 Oct 2009 [2873] +xorriso/xorriso.1 +Adjustments of xorriso man page + +27 Oct 2009 [2874] +svn copy -m "Branching for libisoburn release 0.4.4" \ + http://svn.libburnia-project.org/libisoburn/trunk \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroFourFour + +2009.10.27.153001 [2875] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.4 + +27 Oct 2009 [2876] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.4.4 - 2009.10.27.153001 +* Bug fix: -cut_out deleted previously cut-out pieces of the same file +* Bug fix libisofs: Filenames could lose blanks during a multi-session cycle +* Bug fix: -for_backup did not enable -xattr and -md5 if no drive was chosen yet +* Bug fix: With -as cdrecord : -xa1 and -xamix were ignored although they do matter +* Bug fix: xorrisofs -help, xorrecord -help displayed original xorriso -help +* New option -pvd_info +* Option -toc now reports "Media product:" +* New options -system_id , -volset_id +* New option -mount_opts +* New option -scdbackup_tag + + +2009.10.27.205410 [2877] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.5 + +28 Oct 2009 [2878] +xorriso/changelog.txt +Documented changes and release timestamp + +28 Oct 2009 [2879] +svn move -m "Promoted branch to tag" + http://svn.libburnia-project.org/libisoburn/branches/ZeroFourFour + http://svn.libburnia-project.org/libisoburn/tags/ZeroFourFour + +------------------------------------ cycle - xorriso-0.4.5 - 2009.10.27.205410 + +2009.11.12.204523 [2897] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New -calm_drive mode "revoke" + +------------------------------- patch - xorriso-0.4.4.pl01 - 2009.11.13.120001 +* libburn: Workaround for Pioneer DVR-216D which got stuck on DVD-R burns +* libburn: Workaround for Pioneer DVR-216D refusal to eject + +2009.11.17.123150 [2909] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.3 now + +2009.11.17.134239 [2910] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New options -dvd_obs and -stdio_sync + +2009.11.17.142447 [2911] +configure.ac +Makefile.am +xorriso/configure_ac.txt +xorriso/makefile_libxorriso_am.txt +New configure option --enable-dvd-obs-64k + +------------------------------------ cycle - xorriso-0.4.5 - 2009.11.17.142447 +* New options -dvd_obs and -stdio_sync +* New configure option --enable-dvd-obs-64k + + +2009.11.28.123903 [2927] +xorriso/xorrisoburn.c +Made use of burn_fifo_source_new() flag bit0 and of burn_os_open_track_src() + +2009.11.28.124241 [2928] +README +xorriso/README +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +New configure option --enable-track-src-odirect + +------------------------------------ cycle - xorriso-0.4.5 - 2009.11.28.124241 +------------------------------------ cycle - xorriso-0.4.5 - 2009.12.05.141523 +* Bug fix: SIGSEGV with option -toc on LG GH22LS30 + + +07 Dec 2009 [2944] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.7.5 + +2009.12.07.082130 [2945] +README +xorriso/README +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.4 now + +08 Dec 2009 [2947] +svn copy -m Branching for libisoburn release 0.4.6 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFourSix + +2009.12.08.130001 [2948] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.6 + +08 Dec 2009 [2949] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.4.6 - 2009.12.08.130001 +* libburn: Bug fix: SIGSEGV from NULL pointer with option -toc on LG GH22LS30 +* libburn: Workaround for Pioneer DVR-216D which got stuck on DVD-R burns +* libburn: Workaround for Pioneer DVR-216D refusal to eject +* New options -dvd_obs and -stdio_sync +* New configure option --enable-dvd-obs-64k + + +2009.12.08.144237 [2950] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.7 + +08 Dec 2009 [2961] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.4.7 - 2009.12.08.144237 + + +2009.12.10.120734 [2953] +xorriso/xorrisoburn.c +Silenced harmless compiler warning of FreeBSD 6.3 + +10 Dec 2009 [2954] +xorriso/configure_ac.txt +Corrected a harmless name error in xorriso standalone configuration + +2009.12.14.121636 [2955] +xorriso/xorriso.c +Mentioned stream_recording=number in helptext of xorriso -as cdrecord + +2009.12.26.224409 [2977] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.5 now + +2009.12.26.231134 [2978] +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso/xorrisoburn.c +Made xorriso-standalone aware of libcdio system adaptor + +2009.12.27.095045 [2980] +xorriso/xorrisoburn.c +Reporting system adapter id with xorriso -version + +2009.12.30.163643 [2989] +xorriso/xorriso.c +Handling -mount on Debian kfreebsd like on FreeBSD + +2009.12.31.114951 [2991] +xorriso/xorrisoburn.c +Changed report title "System adapter" to "libburn OS adapter" + +2009.12.31.142331 [2992] +xorriso/xorriso.c +Reacted on compiler warning of Debian buildd + +2009.12.31.144342 [2993] +libisoburn/libisoburn.h +Reacted on doxygen errors of Debian buildd + +2010.01.01.124622 [2996] +libisoburn/isoburn.c +xorriso/xorriso.c +xorriso/xorrisoburn.c +Reacted on compiler warnings of Debian kfreebsd-amd64 buildd + +2010.01.01.125742 [2997] +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Do not believe libburn if it says a role 2 drive is empty + +2010.01.01.130215 [2998] +README +COPYRIGHT +libisoburn/data_source.c +xorriso/README +xorriso/compile_xorriso.sh +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +Updated copyright marks to 2010 + +01 Jan 2010 [2999] +xorriso/xorriso.1 +Removed a stray option argument from xorriso man page + +01 Jan 2010 [3000] +xorriso/xorriso_eng.html +Updated xorriso homepage + +------------------------------------ cycle - xorriso-0.4.7 - 2010.01.01.130215 +* New configure option --enable-libcdio for system adapter to libcdio-0.83git + +2010.01.07.090517 [3003] +configure.ac +xorriso/configure_ac.txt +Changed configure test for zlib from compress2() to compressBound() + +2010.01.11.113303 [3007] +libisoburn/isofs_wrap.c +Re-enabled recognition of missing or empty disk files as blank drive (rev 2997) + +2010.01.11.113457 [3008] +xorriso/xorrisoburn.c +Changed a comment in xorrisoburn.c + +2010.01.17.145019 [3020] +libisoburn/burn_wrap.c +Bug fix: xorriso did not blank CD-RW with images that were prepared on hard disk + +2010.01.17.145139 [3021] +xorriso/xorrisoburn.c +Made xorriso issue a filure message if blanking was not successful + +2010.01.17.145751 [3022] +configure.ac +Fixed a bug in configure.ac introduced with rev 3003 + +2010.01.19.133712 [3023] +xorriso/xorrisoburn.c +Avoided SORRY event for missing disk file during hardlink update + +2010.01.20.105755 [3025] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.26 now + +2010.01.20.105928 [3026] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.27 + +20 Jan 2010 [3027] +xorriso/xorriso_eng.html +Updated xorriso webpage + +------------------------------------ cycle - xorriso-0.4.7 - 2010.01.20.105928 +* Bug fix: xorriso did not blank CD-RW with images that were prepared on hard disk + + +2010.01.23.153510 [3039] +README +xorriso/README +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.6 now + +2010.01.23.153601 [3040] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.7.7 + +25 Jan 2010 [3041] +svn copy -m Branching for libisoburn release 0.4.8 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFourEight + +2010.01.25.120001 [3042] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.8 + +25 Jan 2010 [3043] +xorriso/xorriso_private.h +test/compare_file.c +Lifted ban to derive GPLv3, extended copyright range to 2010 + +25 Jan 2010 [3045] +configure.ac +Corrected wrong micro version number + +25 Jan 2010 [3048] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.4.8 - 2010.01.25.120001 +* Bug fix: xorriso did not blank CD-RW with images that were prepared on hard disk +* New configure option --enable-libcdio for system adapter to libcdio-0.83git + + +2010.01.25.142705 [3046] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.4.9 + +25 Jan 2010 [3047] +xorriso/xorriso_private.h +test/compare_file.c +Lifted ban to derive GPLv3, extended copyright range to 2010 + +25 Jan 2010 [3049] ([3044]) +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.4.9 - 2010.01.25.142705 + + +25 Jan 2010 [3050] +move -m Promoted branch to tag \ + http://svn.libburnia-project.org/libisoburn/branches/ZeroFourEight \ + http://svn.libburnia-project.org/libisoburn/tags/ZeroFourEight + +27 Jan 2010 [3051] +README +Changed leftover text which disallowed GPLv3 + +04 Feb 2010 [3052] +xorriso/xorriso.1 +Small corrections in xorriso man page + +2010.02.04.082710 [3053] +acinclude.m4 +configure.ac +xorriso/configure_ac.txt +Forcing use of /usr/local on FreeBSD by LDFLAGS and CPPFLAGS + +2010.02.08.110814 [3055] +xorriso/xorrisoburn.c +Removed surplus quotes from an error message + +8 Feb 2010 [3056] +svn move -m 'Marked libisofs SVN copy as outdated (use bzr on lp)' +http://svn.libburnia-project.org/libisofs +http://svn.libburnia-project.org/libisofs_outdated + +2010.02.10.150252 [3057] +README +Updated license statement about our legal view and future licenses + +2010.02.10.150501 [3058] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.28 now + +2010.02.10.150547 [3059] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.29 + +10 Feb 2010 [3060] +xorriso/xorriso_eng.html +Updated xorriso web page + +------------------------------------ cycle - xorriso-0.4.9 - 2010.02.10.150547 +Bug fix: Regression in libisofs introduced with xorriso-0.4.2 in August 2009: + -boot_image could lead to SIGSEGV + + +12 Feb 2010 [3061] +xorriso/README +Switched from xorriso-standalone GPLv2+ to GNU xorriso GPLv3+ + +svn move -m 'Renamed xorriso/README to xorriso/README_gnu_xorriso' \ +xorriso/README xorriso/README_gnu_xorriso + +2010.02.12.153945 [3062] +xorriso/xorriso.c +xorriso/make_xorriso_standalone.sh +xorriso/README_gnu_xorriso ++ xorriso/COPYING_gnu_xorriso +xorriso/xorriso_eng.html +Switched from xorriso-standalone GPLv2+ to GNU xorriso GPLv3+ + +2010.02.12.213121 [3065] +xorriso/xorriso.1 +libisoburn/libisoburn.h +xorriso/xorriso_eng.html +Changed docs and comments to "GNU/Linux" where appropriate + +------------------------------------ cycle - xorriso-0.4.9 - 2010.02.12.213121 + +2010.02.14.151045 [3067] +README +COPYRIGHT +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/data_source.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Added or adjusted copyright and license statements in single files + +2010.02.14.151610 [3068] +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso/xorriso.1 +xorriso/xorriso_eng.html ++ xorriso/AUTHORS_gnu_xorriso ++ xorriso/COPYRIGHT_gnu_xorriso +Added or adjusted copyright and license statements in single files + +2010.02.14.172124 [3070] +README +xorriso/make_xorriso_standalone.sh +xorriso/xorriso_makefile_am.txt +Excluded unused libburn source module crc.c from GNU xorriso tarball + +2010.02.15.204530 [3072] +xorriso/xorriso_eng.html +Adjustments with web page of GNU xorriso + +------------------------------------ cycle - xorriso-0.4.9 - 2010.02.15.204530 + +2010.02.17.140002 [3074] +xorriso/xorriso.c +Bug fix for FreeBSD: xorriso could leave the drive tray locked + +2010.02.18.125019 [3076] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.1 +New option -scsi_log + +2010.02.19.172125 [3077] +xorriso/xorrisoburn.c +Bug fix: xorriso -update_r could lead to SIGSEGV if applied to a data file + +19 Feb 2010 [3078] [3079] +xorriso/xorriso_eng.html +Adjustments with web page of GNU xorriso + +------------------------------------ cycle - xorriso-0.4.9 - 2010.02.19.172125 +Bug fix on FreeBSD: xorriso could leave the drive tray locked +Bug fix on FreeBSD: Piped input was falsely attributed a small fixed size +Bug fix: xorriso -update_r could lead to SIGSEGV if applied to a data file +New option -scsi_log + +22 Feb 2010 [3081] +xorriso/README_gnu_xorriso +xorriso/xorriso_eng.html +Mentioned bug-xorriso@gnu.org as a contact address for GNU xorriso + +2010.02.22.195623 [3082] +xorriso/make_xorriso_standalone.sh +xorriso/xorriso.h +xorriso/xorriso.c +Changed versioning and tarball name to match unpack directory name + +22 Feb 2010 [3083] +svn copy -m Branching for libisoburn release 0.5.0 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveZero + +2010.02.22.213001 [3084] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.0 + +22 Feb 2010 [3085] +Makefile.am +Delivering xorriso/README_gnu_xorriso with libisoburn + +22 Feb 2010 [3086] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.5.0 - 2010.02.22.213001 +Bug fix: Regression in libisofs introduced with xorriso-0.4.2 in August 2009: + -boot_image could lead to SIGSEGV +Bug fix on FreeBSD: xorriso could leave the drive tray locked +Bug fix on FreeBSD: Piped input was falsely attributed a small fixed size +Bug fix: xorriso -update_r could lead to SIGSEGV if applied to a data file +New option -scsi_log + + +2010.02.23.093924 [3087] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.1 + +23 Feb 2010 [3088] +Makefile.am +Delivering xorriso/README_gnu_xorriso with libisoburn + +23 Feb 2010 [3089] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveZero +http://svn.libburnia-project.org/libisoburn/tags/ZeroFiveZero + +------------------------------------ cycle - xorriso-0.5.1 - 2010.02.23.093924 + + +28 Feb 2010 [3094] +xorriso/make_xorriso_standalone.sh +Adjusted patcher of Makefile.in for GNU xorriso + +28 Feb 2010 [3095] +xorriso/xorriso.1 +Corrected spelling errors in xorriso man page + +2010.03.09.065117 [3109] +libisoburn/libisoburn.h +Requiring libburn-0.7.7 now + +2010.03.09.065408 [3110] +xorriso/xorriso_private.h +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Adapted xorriso signal handling to new libburn advise + +2010.03.10.183348 [3121] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.7.8 now + +2010.03.10.183426 [3122] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libburn-0.7.9 + +2010.03.18.101202 [3125] +Makefile.am +xorriso/xorriso_makefile_am.txt +xorriso/make_xorriso_standalone.sh ++ xorriso/xorriso.texi ++ xorriso/xorriso.info ++ xorriso/make_xorriso_1.c ++ xorriso/make_docs.sh +xorriso/xorriso.1 +xorriso/convert_man_to_html.sh +Switched xorriso documentation to a hybrid of texinfo and man page + +------------------------------------ cycle - xorriso-0.5.1 - 2010.03.18.101202 +* xorriso documentation now also available in (tex)info format + + +2010.03.20.165317 [3126] +xorriso/make_docs.sh +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/convert_man_to_html.sh +Restructured xorriso documentation and added index + +2010.03.21.124435 [3127] +Makefile.am +xorriso/xorriso_makefile_am.txt +xorriso/xorriso.texi +xorriso/xorriso.info +Distributing and installing xorriso.info + +2010.03.21.124517 [3128] +libisoburn/burn_wrap.c +Silenced a harmless compiler warning + +22 Mar 2010 [3129] +xorriso/xorriso.texi +Changed global info dir entry of xorriso.texi + +22 Mar 2010 [3130] +xorriso/xorriso.info +Changed global info dir entry of xorriso.info + +2010.03.29.103419 [3136] +libisoburn/burn_wrap.c +Avoided to declare empty tray as written media + +2010.03.29.103533 [3137] +xorriso/xorrisoburn.c +Better handling of empty tray when aquiring drive + +------------------------------------ cycle - xorriso-0.5.1 - 2010.03.29.103533 + +29 Mar 2010 [3138] +svn copy -m Branching for libisoburn release 0.5.2 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveTwo + +2010.03.29.190001 [3139] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.2 + +30 Mar 2010 [3141] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.5.2 - 2010.03.29.190001 +* xorriso documentation now also available in (tex)info format +* Prepared FreeBSD system adapter to work with ahci driver + + +2010.03.30.082405 [3140] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.3 + +30 Mar 2010 [3142] +xorriso/changelog.txt +Documented changes and release timestamp + +30 Mar 2010 [3143] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveTwo +http://svn.libburnia-project.org/libisoburn/tags/ZeroFiveTwo + +------------------------------------ cycle - xorriso-0.5.3 - 2010.03.30.082405 + + +2010.04.01.140653 [3144] +libisoburn/burn_wrap.c +libisoburn refused to recognize ISO images smaller than 64 kB + +2010.04.01.140653 [3145] +xorriso/xorriso.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Disabled isohybrid MBR production on request of H. Peter Anvin + +2010.04.05.192817 [3147] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.29 now + +2010.04.06.125013 [3148] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New API call isoburn_igopt_set_system_area() + +2010.04.06.151750 [3149] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New -as mkisofs options -G and --protective-msdos-label for GRUB + +2010.04.06.192328 [3150] +xorriso/xorriso.c +xorriso/xorriso_eng.html +Polishing of new GRUB supporting features + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.06.192328 +* New API call isoburn_igopt_set_system_area() +* New -as mkisofs options -G and --protective-msdos-label for GRUB + + +2010.04.07.073024 [3151] +libisoburn/burn_wrap.c +Fixed image reading bug introduced with revision 3144 + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.07.073024 + +2010.04.07.202148 [3152] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New API call isoburn_igopt_set_pvd_times() + +2010.04.07.202559 [3153] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New option -volume_date, for grub-mkrescue: -as mkisofs --modification-date= + +2010.04.08.185744 [3154] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New find action mkisofs_r and emulation -as mkisofs -r + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.08.185744 +* New API call isoburn_igopt_set_pvd_times() +* New option -volume_date, for grub-mkrescue: -as mkisofs --modification-date= +* New find action mkisofs_r and emulation -as mkisofs -r + + +2010.04.09.171108 [3164] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libburn-0.8.1 + +2010.04.10.150747 [3165] +configure.ac +xorriso/configure_ac.txt +Trying to avoid iconv const warning and multiple -liconv options on FreeBSD + +2010.04.10.170927 [3166] +libisoburn/libisoburn.h +libisoburn/isoburn.c +New options bit1 of isoburn_igopt_set_system_area() for isohybrid production + +2010.04.10.171214 [3167] +xorriso/xorriso.c +xorriso/xorrisoburn.c +New -boot_image isolinux partition_table=on, -as mkisofs -isohybrid-mbr + +2010.04.10.180103 [3168] +xorriso/xorriso.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Updated help text and documentation + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.10.180103 +* New options bit1 of isoburn_igopt_set_system_area() for isohybrid production +* New: -boot_image isolinux partition_table=on, -as mkisofs -isohybrid-mbr + + +2010.04.11.120902 [3169] +xorriso/xorriso.c +test/compare_file.c +Reacted on compiler warnings of cygwin + +2010.04.11.121002 [3170] +xorriso/xorrisoburn.c +Avoided printing of possibly uninitialized integer + +2010.04.11.121418 [3171] +acinclude.m4 +xorriso/configure_ac.txt +Realistic iconv() linking test in ./configure with eventual abort + +2010.04.11.122253 [3172] +xorriso/xorriso.c +test/compare_file.c +xorriso/xorrisoburn.c +acinclude.m4 +xorriso/configure_ac.txt +(Payload files of revisions 3169, 3170, 3171) + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.11.122253 + + +12 Apr 2010 [3173] +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Mentioned xorriso alias names in chapter FILES of documentation + +2010.04.12.111137 [3174] +xorriso/xorriso.c +test/compare_file.c +Decided to put out uid_t and gid_t as unsigned long + +2010.04.13.103037 [3175] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New isoburn_igopt_set_relaxed() options: only_iso_versions, no_j_force_dots + +2010.04.13.103917 [3176] +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New -compliance options only_iso_version, no_j_force_dots + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.13.103917 +* New isoburn_igopt_set_relaxed() options: only_iso_versions, no_j_force_dots +* New -compliance options only_iso_version, no_j_force_dots + + +2010.04.13.154201 [3177] +acinclude.m4 +configure.ac +xorriso/configure_ac.txt +More carefully checking for libreadline suitability + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.13.154201 + + +2010.04.16.195349 [3178] +libisoburn/isofs_wrap.c +libisoburn now always loads the System Area with the ISO image + +2010.04.16.195835 [3179] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Made -boot_image isolinux|grub patch and partition_table=on patch System Area + +2010.04.17.171147 [3180] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.30 now + +2010.04.17.171232 [3181] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.31 + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.17.171232 + +2010.04.18.095808 [3182] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New -find action sort_weight, new -as mkisofs --sort-weight + +2010.04.18.100814 [3183] +xorriso/xorriso.c +Added --sort-weight to -as mkisofs -help + +------------------------------------ cycle - xorriso-0.5.3 - 2010.04.18.100814 +* New -find action sort_weight, new -as mkisofs --sort-weight + + +2010.04.18.141143 [3184] +xorriso/xorrisoburn.c +Corrected image size computation for comparison with partition table + +18 Apr 2010 [3185] +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Updated documentation about MBR + +19 Apr 2010 [3186] +svn copy -m Branching for libisoburn release 0.5.4 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveFour + +2010.04.19.080001 [3187] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.4 + +19 Apr 2010 [3188] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.5.4 - 2010.04.19.080001 +* New API call isoburn_igopt_set_system_area() +* New API call isoburn_igopt_set_pvd_times() +* New isoburn_igopt_set_relaxed() options: only_iso_versions, no_j_force_dots +* New -boot_image any system_area=, -as mkisofs option -G +* New -boot_image grub partition_table=on, --protective-msdos-label +* New -boot_image isolinux partition_table=on, -as mkisofs -isohybrid-mbr +* New option -volume_date, for grub-mkrescue: -as mkisofs --modification-date= +* New -find action mkisofs_r and emulation -as mkisofs -r +* New -compliance options only_iso_version, no_j_force_dots +* New -find action sort_weight, new -as mkisofs --sort-weight + + +2010.04.19.095104 [3189] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.5 + +19 Apr 2010 [3190] +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.5.5 - 2010.04.19.095104 + +19 Apr 2010 [3191] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveFour +http://svn.libburnia-project.org/libisoburn/tags/ZeroFiveFour + +20 Apr 2010 [3192] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.31 now + +2010.04.20.091732 [3193] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +New -boot_image any platform_id= + +2010.04.20.103448 [3194] +xorriso/xorriso.c +Determining boot image size only after it was added to the ISO image + +------------------------------------ cycle - xorriso-0.5.5 - 2010.04.20.103448 +* New -boot_image any platform_id=, -as mkisofs --efi-boot + + +2010.04.20.140151 [3195] +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Raised boot catalog weight to 1000000000 + +2010.04.20.142540 [3196] +xorriso/xorrisoburn.c +Changed iso_image_set_boot_platform_id() to el_torito_set_boot_platform_id() + +2010.04.22.143944 [3197] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Allowing 1 BIOS boot image and 1 EFI boot image: -boot_image grub efi_path= + +2010.04.22.160615 [3198] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Bug fixes and improvements of previous revision 3197 + +------------------------------------ cycle - xorriso-0.5.5 - 2010.04.22.160615 +------------------------------------ cycle - xorriso-0.5.5 - 2010.04.22.221241 + + +2010.04.26.121051 [3199] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Allowing up to 32 boot images, -boot_image any id_string=, sel_crit= + +2010.04.26.141229 [3200] +xorriso/xorriso.c +xorriso/xorrisoburn.c +Fixed minor problems with previous revision 3199 + +2010.04.26.175506 [3201] +xorriso/xorriso.c +xorriso/xorriso_eng.html +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Some documentation updates + +27 Apr 2010 [3202] +xorriso/xorriso_eng.html +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Some more documentation updates + +2010.04.27.072331 [3203] +xorriso/xorriso.c +Downgraded message about stdout redirection from NOTE to DEBUG + +2010.04.27.074834 [3204] +xorriso/xorrisoburn.c +Fixed handling of empty current bin_path and already attached boot images + +2010.04.29.133234 [3205] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Avoided -boot_image patching for images which obviously have no boot-info-table + +------------------------------------ cycle - xorriso-0.5.5 - 2010.04.29.133234 +* Allowing up to 32 boot images +* New -boot_image bootspecs efi_path=, platform_id=, sel_crit=, id_string=, next +* New -as mkisofs options --efi-boot, -eltorito-alt-boot + + +2010.05.03.123759 [3208] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.32 now + +2010.05.03.165446 [3209] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libisofs-0.6.33 + +04 May 2010 [3210] +svn copy -m Branching for libisoburn release 0.5.6 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveSix + +2010.05.04.100001 [3211] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.6 + +04 May 2010 [3212] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.5.6 - 2010.05.04.100001 +* Allowing up to 32 boot images +* New -boot_image bootspecs efi_path=, platform_id=, sel_crit=, id_string=, next +* New -as mkisofs options --efi-boot, -eltorito-alt-boot + + +2010.05.04.120115 [3213] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso.c +xorriso/xorrisoburn.h +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.7 + +04 May 2010 [3214] +xorriso/changelog.txt +Documented changes and release timestamp + +04 May 2010 [3215] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveSix +http://svn.libburnia-project.org/libisoburn/tags/ZeroFiveSix + +------------------------------------ cycle - xorriso-0.5.7 - 2010.05.04.120115 + + +2010.05.05.194248 [3216] +xorriso/xorriso_private.h +xorriso/xorriso.c +xorriso/xorrisoburn.c +Removed development macro Xorriso_multi_booT by making it unconditional + +05 May 2010 [3217] +xorriso/xorriso_eng.html +Avoided to show inappropriate links on www.gnu.org + +------------------------------------ cycle - xorriso-0.5.7 - 2010.05.05.194248 + + +2010.05.15.184604 [3218] +Makefile.am +xorriso/xorriso_makefile_am.txt +xorriso/make_xorriso_standalone.sh +xorriso/compile_xorriso.sh +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +- xorriso/xorriso.c +- xorriso/xorrisoburn.c ++ xorriso/xorriso_main.c ++ xorriso/sfile.h ++ xorriso/sfile.c ++ xorriso/aux_objects.h ++ xorriso/aux_objects.c ++ xorriso/findjob.h ++ xorriso/findjob.c ++ xorriso/check_media.h ++ xorriso/check_media.c ++ xorriso/misc_funct.h ++ xorriso/misc_funct.c ++ xorriso/text_io.h ++ xorriso/text_io.c ++ xorriso/match.h ++ xorriso/match.c ++ xorriso/emulators.h ++ xorriso/emulators.c ++ xorriso/disk_ops.h ++ xorriso/disk_ops.c ++ xorriso/cmp_update.h ++ xorriso/cmp_update.c ++ xorriso/parse_exec.h ++ xorriso/parse_exec.c ++ xorriso/opts_a_c.c ++ xorriso/opts_d_h.c ++ xorriso/opts_i_o.c ++ xorriso/opts_p_z.c ++ xorriso/base_obj.h ++ xorriso/base_obj.c ++ xorriso/lib_mgt.h ++ xorriso/lib_mgt.c ++ xorriso/sort_cmp.h ++ xorriso/sort_cmp.c ++ xorriso/drive_mgt.h ++ xorriso/drive_mgt.c ++ xorriso/iso_img.h ++ xorriso/iso_img.c ++ xorriso/iso_tree.h ++ xorriso/iso_tree.c ++ xorriso/iso_manip.h ++ xorriso/iso_manip.c ++ xorriso/write_run.h ++ xorriso/write_run.c ++ xorriso/read_run.h ++ xorriso/read_run.c ++ xorriso/filters.h ++ xorriso/filters.c +Splitted xorriso.c and xorrisoburn.c into smaller source modules + +2010.05.16.092546 [3220] +libisoburn/burn_wrap.c +libisoburn/data_source.c +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +Eventually including ../config.h generated by autotools + +2010.05.16.093108 [3221] +xorriso/aux_objects.c +xorriso/base_obj.c +xorriso/check_media.c +xorriso/cmp_update.c +xorriso/disk_ops.c +xorriso/drive_mgt.c +xorriso/emulators.c +xorriso/filters.c +xorriso/findjob.c +xorriso/iso_img.c +xorriso/iso_manip.c +xorriso/iso_tree.c +xorriso/lib_mgt.c +xorriso/make_xorriso_1.c +xorriso/match.c +xorriso/misc_funct.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/opts_i_o.c +xorriso/opts_p_z.c +xorriso/parse_exec.c +xorriso/read_run.c +xorriso/sfile.c +xorriso/sort_cmp.c +xorriso/text_io.c +xorriso/write_run.c +xorriso/xorriso_main.c +Eventually including ../config.h generated by autotools + +2010.05.16.113100 [3222] +xorriso/xorriso.h +xorriso/xorriso_main.c +xorriso/make_xorriso_standalone.sh +Made option -version know again whether it is in GNU xorriso + +2010.05.16.171056 [3223] +xorriso/xorriso_main.c +Checking for suitable sizeof(off_t) + +2010.05.17.142656 [3224] ++ xorriso/xorriso_bootstrap.txt +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +Made compilation of GNU xorriso less verbous by use of autoheader config.h + +2010.05.18.174455 [3225] +Makefile.am +- xorriso/makefile_libxorriso_am.txt +xorriso/xorriso_main.c +Moved xorriso implementation into libisoburn + +19 May 2010 [3226] +test/compare_file.c +Eventually including ../config.h generated by autotools + +2010.05.19.160540 [3227] +configure.ac +Makefile.am +xorriso/compile_xorriso.sh +Moved configuration options from xorriso_xorriso_CFLAGS to CFLAGS + +2010.05.21.132725 [3228] +libisoburn/libisoburn.h +Mentioned both levels of API and their mutual exclusiveness + +2010.05.21.133627 [3229] +xorriso/xorriso.h +xorriso/xorriso_main.c +xorriso/base_obj.c +xorriso/opts_p_z.c +xorriso/write_run.c +Adapted version checking to new library situation + +2010.05.21.134500 [3230] +libisoburn/libisoburn.h +Corrected typo in remark + +2010.05.23.072450 [3231] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New write extension option isoburn_igopt_no_emul_toc + +2010.05.23.072616 [3232] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/write_run.c +New -compliance rule no_emul_toc + +2010.05.23.072845 [3233] +xorriso/emulators.c +Implemented -as cdrecord -V, new -as mkisofs option --no-emul-toc + +23 May 2010 [3234] +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Documentation for recent enhancements + +2010.05.26.123017 [3235] +xorriso/emulators.c +Implemented -as mkisofs options -U, -N, -l, -d, -allow-lowercase + +26 May 2010 [3236] +xorriso/xorriso_eng.html +Updated GNU xorriso web page + +------------------------------------ cycle - xorriso-0.5.7 - 2010.05.26.123017 +* xorriso source split into more modules, object code moved into libisoburn +* New write extension option isoburn_igopt_no_emul_toc +* New -compliance rule no_emul_toc, new -as mkisofs --no-emul-toc +* Implemented -as cdrecord -V +* Implemented -as mkisofs options -U, -N, -l, -d, -allow-lowercase + + +2010.05.31.095756 [3238] +xorriso/aux_objects.h +xorriso/aux_objects.c +Corrected a misplaced class description comment + +2010.06.07.180414 [3242] +xorriso/xorriso_makefile_am.txt +Taking care of new Solaris adapter of libburn + +07 Jun 2010 [3243] +README +xorriso/README_gnu_xorriso +xorriso/xorriso_eng.html +Updated documentation about Solaris adapter + +------------------------------------ cycle - xorriso-0.5.7 - 2010.06.07.180414 +* New libburn system adapter for Solaris uscsi (tested on snv134, kernel 5.11) + + +10 Jun 2010 [3249] +xorriso/README_gnu_xorriso +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Mentioned Solaris and system dependent drive permission settings + +2010.06.11.174804 [3258] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.8.2 now + +11 Jun 2010 [3259] +xorriso/configure_ac.txt +Adapted xorriso-standalone to version leap libburn-0.8.3 + +------------------------------------ cycle - xorriso-0.5.7 - 2010.06.11.174804 + + +2010.06.13.105645 [3260] +xorriso/emulators.c +Removed surplus test expression + +2010.06.13.110316 [3261] +README +xorriso/xorriso.h +xorriso/xorriso_main.c +Updated docs about existence of xorriso API in libisoburn + +2010.06.13.133537 [3261] +xorriso/opts_d_h.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Untangled messed-up relation between -hardlinks and -compliance + +13 Jun 2010 [3263] +svn copy -m Branching for libisoburn release 0.5.8 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveEight + +2010.06.13.140001 [3264] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +(forgotten: xorriso/xorriso_main.c) +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.8 + +13 Jun 2010 [3265] +xorriso/opts_p_z.c +Avoided double printing of xorriso version header line + +13 Jun 2010 [3266] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.5.8 - 2010.06.13.140001 +* New libburn system adapter for Solaris uscsi (tested on snv134, kernel 5.11) +* xorriso source split into more modules, object code moved into libisoburn +* New write extension option isoburn_igopt_no_emul_toc +* New -compliance rule no_emul_toc, new -as mkisofs --no-emul-toc +* Implemented -as cdrecord option -V +* Implemented -as mkisofs options -U, -N, -l, -d, -allow-lowercase + + +2010.06.14.073240 [3268] +xorriso/opts_p_z.c +Avoided double printing of xorriso version header line + +2010.06.14.081834 [3269] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.5.9 + +14 Jun 2010 [3270] +xorriso/changelog.txt +Documented changes and release timestamp + +14 Jun 2010 [3271] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroFiveEight +http://svn.libburnia-project.org/libisoburn/tags/ZeroFiveEight + +------------------------------------ cycle - xorriso-0.5.9 - 2010.06.14.081834 + + +2010.06.15.160133 [3275] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.8.3 now (because SIGWINCH handling on Solaris) + +2010.06.15.160501 [3276] +acinclude.m4 +Enabled use of libreadline on Solaris by eventually linking -lcurses + +2010.06.16.105449 [3278] +libisoburn/libisoburn.h +Clarified API description of isoburn_read_iso_head() + +2010.06.16.105652 [3279] +xorriso/write_run.c +Bug fix: check_media patch_lba0= could install wrong image size + +2010.06.16.140253 [3280] +xorriso/write_run.c +Made patch_lba0= more modest with overwriting. + +2010.06.18.053105 [3281] +xorriso/emulators.c +Bug fix: -as mkisofs option -volset was wrongly interpreted like -volid + +2010.06.18.113147 [3282] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.33 now + +2010.06.19.152046 [3283] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/write_run.c +xorriso/opts_a_c.c +xorriso/iso_img.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -boot_image bootspec cat_hidden= + +2010.06.19.152046 [3284] +xorriso/iso_tree.h +xorriso/iso_tree.c +xorriso/findjob.h +xorriso/findjob.c +xorriso/iso_manip.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New find test -disk_name + +2010.06.20.072130 [3285] +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/iso_manip.c +xorriso/findjob.h +xorriso/findjob.c +xorriso/misc_funct.h +xorriso/misc_funct.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New find action -hide, new find test -hidden + +2010.06.20.141555 [3286] +xorriso/aux_objects.c +xorriso/emulators.c +xorriso/opts_p_z.c +xorriso/read_run.c +libisoburn/burn_wrap.c +Trying to silence compiler warnings of OpenSuse Build Service + +2010.06.20.164738 [3287] +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/iso_manip.c +xorriso/disk_ops.c +xorriso/iso_tree.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New option -hide + +2010.06.22.132641 [3288] +xorriso/opts_p_z.c +Made -quoted_path_list continue to execute words after error in the same line + +2010.06.23.134250 [3289] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/aux_objects.c +xorriso/parse_exec.c +xorriso/opts_i_o.c +xorriso/emulators.c +xorriso/disk_ops.c +xorriso/misc_funct.h +xorriso/misc_funct.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs options -hide, -hide-joliet, -hide-list, -hide-joliet-list + +2010.06.23.134250 [3290] +xorriso/emulators.c +Included a missing header file + +2010.06.23.151900 [3291] +xorriso/parse_exec.h +Updated the missing header file + +2010.06.23.152337 [3292] +xorriso/emulators.c +Revoked unneeded change of revision 3290 + +2010.06.23.175357 [3293] +xorriso/xorriso_private.h +xorriso/lib_mgt.c +xorriso/drive_mgt.c +xorriso/iso_img.c +Reset xorriso->boot_count when image gets discarded + +2010.06.23.175613 [3294] +xorriso/write_run.c +Moved call of iso_image_set_boot_catalog_hidden() to Xorriso_write_session() + +------------------------------------ cycle - xorriso-0.5.9 - 2010.06.23.175613 +Bug fix: -check_media patch_lba0= could install wrong image size +Bug fix: -as mkisofs option -volset was wrongly interpreted like -volid +Enabled use of libreadline on Solaris +New find test -disk_name +New option -hide, -find action -hide, -find test -hidden +New -boot_image bootspec cat_hidden=on +New -as mkisofs options -hide, -hide-joliet, -hide-list, -hide-joliet-list + + +2010.06.24.084800 [3295] +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs option --boot-catalog-hide + +2010.06.25.095836 [3296] +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs option -dir-mode + +2010.06.25.102140 [3297] +xorriso/emulators.c +New -as mkisofs option -file-mode + +2010.06.25.174329 [3298] +xorriso/text_io.c +Appending eventual strerror() to event message line rather than to new line + +2010.06.25.175810 [3299] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/parse_exec.h +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/opts_p_z.c +xorriso/sfile.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New option -read_mkisofsrc interprets .mkisofsrc + +2010.06.26.113947 [3300] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/parse_exec.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/drive_mgt.c +xorriso/iso_img.c +xorriso/text_io.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New options -copright_file , -biblio_file , -abstract_file + +2010.06.26.114315 [3301] +xorriso/emulators.c +New -as mkisofs options -abstract, -biblio, -copyright + +------------------------------------ cycle - xorriso-0.5.9 - 2010.06.26.114315 +New -as mkisofs option --boot-catalog-hide +New options -copright_file , -biblio_file , -abstract_file +New option -read_mkisofsrc interprets .mkisofsrc +New -as mkisofs options -dir-mode, -file-mode +New -as mkisofs options -abstract, -biblio, -copyright + + +2010.06.28.100903 [3302] +xorriso/text_io.c +Supressing "Thank you for being patient" with times smaller than 2 + +2010.06.28.101019 [3303] +xorriso/iso_tree.c +Made option -lsl mark files in hidden directories as hidden + +27 Jun 2010 [3304] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Removed outdated doc statement about hidden files + +2010.06.29.102043 [3305] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.34 now + +2010.06.29.102229 [3306] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libisofs-0.6.35 + +2010.06.30.181822 [3315] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.8.4 now + +2010.06.30.181908 [3316] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libburn-0.8.5 + +02 Jul 2010 [3317] +svn copy -m Branching for libisoburn release 0.6.0 \ +http://svn.libburnia-project.org/libisoburn/trunk \ +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixZero + +2010.07.02.090001 [3318] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.0 + +02 Jul 2010 [3319] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.6.0 - 2010.07.02.090001 +Bug fix: -check_media patch_lba0= could install wrong image size +Bug fix: -as mkisofs option -volset was wrongly interpreted like -volid +Enabled use of libreadline on Solaris +New find test -disk_name +New option -hide, -find action -hide, -find test -hidden +New -boot_image bootspec cat_hidden=on +New options -copright_file , -biblio_file , -abstract_file +New option -read_mkisofsrc interprets .mkisofsrc +Implemented -as mkisofs options -hide,-hide-joliet,-hide-list,-hide-joliet-list +New -as mkisofs option --boot-catalog-hide +Implemented -as mkisofs options -dir-mode, -file-mode +Implemented -as mkisofs options -abstract, -biblio, -copyright + + +2010.07.02.195907 [3320] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.1 + +2 Jul 2010 [3321] +xorriso/changelog.txt +Documented changes and release timestamp + +2 Jul 2010 [3322] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixZero +http://svn.libburnia-project.org/libisoburn/tags/ZeroSixZero + +------------------------------------ cycle - xorriso-0.6.1 - 2010.07.02.195907 + +4 Jul 2010 [3324] +acinclude.m4 +Added -L/usr/local/lib to libisoburn LDFLAGS for Solaris + +2010.07.05.090409 [3327] +xorriso/xorriso.h +Removed definition of phantom xorriso options + +2010.07.05.122901 [3328] +configure.ac +Makefile.am +README ++ libisoburn/libisoburn.ver +Hiding all non-API symbols from the linker by use of --version-script + +2010.07.06.114102 [3331] +configure.ac +acinclude.m4 +Let configure perform linker test with --version-script if enabled + +2010.07.06.114503 [3332] +libisoburn/libisoburn.h +xorriso/xorriso.h +Mentioned that public API calls must be in libisofs/libisofs.ver + +2010.07.08.155900 [3333] +xorriso/emulators.c +Made behavior of -as mkisofs with unknown options more similar to original + +------------------------------------ cycle - xorriso-0.6.1 - 2010.07.08.155900 +* Made behavior of -as mkisofs with unknown options more similar to original + + +2010.07.29.164843 [3338] +Makefile.am +Detached make target "doc" from target "all". + +29 Jul 2010 [3339] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Corrected manual text about -read_mkisofsrc + +2010.07.30.155123 [3340] +libisoburn/libisoburn.ver +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/parse_exec.c +xorriso/opts_a_c.c +xorriso/opts_p_z.c +xorriso/emulators.c +xorriso/text_io.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New option -preparer_id, -as mkisofs options -p and -preparer + +30 Jul 2010 [3342] +doc/doxygen.conf.in +Removed problematic DETAILS_AT_TOP to silence warning of Debian buildd + +30 Jul 2010 [3343] +doc/doxygen.conf.in +Corrected FILE_PATTERNS + +2010.07.31.085437 [3344] +xorriso/cmp_update.c +Missing device,inode numbers caused -compare_r to report a difference + +------------------------------------ cycle - xorriso-0.6.1 - 2010.07.31.085437 +* New option -preparer_id, -as mkisofs options -p and -preparer + + +2010.08.09.092037 [3351] +libisoburn/libisoburn.h +doc/comments +Hopefully silenced warnings of doxygen on Debian buildd + +2010.08.18.102709 [3353] +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs option -e from Fedora genisoimage + +2010.08.18.181640 [3354] +xorriso/xorriso_private.h +xorriso/opts_a_c.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -boot_image specifier emul_type=none|hard_disk|floppy + +2010.08.18.181855 [3355] +xorriso/emulators.c +New -as mkisofs option -hard-disk-boot, enabled -b without -no-emul-boot + +2010.08.21.103003 [3357] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorriso_eng.html +Mentioned support for DVD-R DL as single-session media + +2010.09.04.100823 [3359] +xorriso/iso_manip.c +This was obviously forgotten to commit with rev 3289 + +2010.09.05.113621 [3360] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New API function isoburn_igopt_set_part_offset(), requiring libisofs 0.6.35 + +2010.09.05.113655 [3361] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/opts_a_c.c +xorriso/text_io.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New boot_image boot specs partition_offset, partition_hd_cyl, partition_sec_hd + +2010.09.05.113945 [3362] +xorriso/emulators.c +New -as mkisofs options -partition_offset, -partition_hd_cyl, -partition_sec_hd + +------------------------------------ cycle - xorriso-0.6.1 - 2010.09.05.113945 +* New API function isoburn_igopt_set_part_offset() +* New -boot_image specifier emul_type=none|hard_disk|floppy +* New -as mkisofs option -hard-disk-boot, enabled -b without -no-emul-boot +* New -as mkisofs option -e from Fedora genisoimage +* New boot_image boot specs partition_offset, partition_hd_cyl, partition_sec_hd +* New -as mkisofs options -partition_offset, -partition_hd_cyl, -partition_sec_hd + + +2010.09.06.103347 [3363] +libisoburn/isoburn.c +Bug fix: Re-enabled use of iso_write_opts_set_rrip_1_10_px_ino() + +2010.09.10.170925 [3364] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +Enabled multi-session with partition offset + +2010.09.10.171223 [3365] +xorriso/drive_mgt.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Enabled multi-session with partition offset + +2010.09.11.125002 [3366] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +Removed development marks + +2010.09.11.125039 [3367] +xorriso/xorriso_private.h +Removed development marks + +------------------------------------ cycle - xorriso-0.6.1 - 2010.09.11.125039 +* Bug fix: Regression with -hardlinks and -compliance old_rr, 0.4.2, Aug 2009 + + +2010.09.15.065722 [3370] +Makefile.am +ChangeLog +Meaningful change log file derived by George Danchev from web site + +2010.09.15.091546 [3371] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.36 now + +2010.09.15.092023 [3372] +xorriso/configure_ac.txt +Version leap to 0.6.37 + +17 Sep 2010 [3380] +xorriso/configure_ac.txt +Version leap to libburn-0.8.7 + +18 Sep 2010 [3382] +svn copy -m Branching for libisoburn release 0.6.0 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixZero + +18 Sep 2010 [3383] +svn delete http://svn.libburnia-project.org/libisoburn/branches/ZeroSixZero +Removed falsely named branch + +18 Sep 2010 [3384] +svn copy -m Branching for libisoburn release 0.6.2 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixTwo + +2010.09.18.120001 [3385] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.2 + +18 Sep 2010 [3386] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +2010.09.18.210001 [3387] +libisoburn/isoburn.c +Fixed a bug with uninitialized variable introduced by rev 3364 + +19 Sep 2010 [3388] +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.6.2 - 2010.09.18.210001 +libisoburn novelties: +* New API function isoburn_igopt_set_part_offset() +* Hiding all non-API symbols from the linker by use of --version-script +* Now with history of release notes in ./ChangeLog file. +xorriso novelties: +* Bug fix: Regression with -hardlinks and -compliance old_rr, 0.4.2, Aug 2009 +* New option -preparer_id, -as mkisofs options -p and -preparer +* New -boot_image specifier emul_type=none|hard_disk|floppy +* New boot_image boot specs partition_offset, partition_hd_cyl, partition_sec_hd +* Made behavior of -as mkisofs with unknown options more similar to original +* New -as mkisofs option -hard-disk-boot, enabled -b without -no-emul-boot +* New -as mkisofs option -e from Fedora genisoimage +* New -as mkisofs options -partition_offset,-partition_hd_cyl,-partition_sec_hd + +2010.09.19.134042 [3389] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.3 + +2010.09.19.135354 [3390] +libisoburn/isoburn.c +Fixed a bug with uninitialized variable introduced by rev 3364 + +19 Sep 2010 [3391] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-0.6.3 - 2010.09.19.135354 + + +19 Sep 2010 [3392] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixTwo +http://svn.libburnia-project.org/libisoburn/tags/ZeroSixTwo + +2010.09.21.142424 [3393] +acinclude.m4 +configure.ac +Makefile.am +On Linux: Run ldconfig during make install,if not --disable-ldconfig-at-install + +2010.09.21.150325 [3394] +acinclude.m4 +configure.ac +Makefile.am +On Linux: More tolerance towards failures of ldconfig + +22 Sep 2009 [3396] +README +Mentioned --disable-ldconfig-at-install + +2010.09.23.135551 [3400] +Makefile.am +xorriso/make_xorriso_standalone.sh ++ doc/partition_offset.wiki +Explaining the partition offset feature + +2010.09.24.110727 [3406] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.8.7 now + +2010.09.24.110841 [3407] +xorriso/drive_mgt.c +Reporting BD spare area info with -list_formats + +29 Sep 2010 [3409] +doc/partition_offset.wiki +Updated partition offset wike about GRUB experiment + +2010.09.29.091541 [3410] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/libisoburn.ver +ChangeLog +New API calls isoburn_igopt_attach_jte() and isoburn_igopt_detach_jte() + +2010.09.29.092348 [3411] +configure.ac +xorriso/xorriso.h +libisoburn/libisoburn.ver +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/base_obj.c +xorriso/parse_exec.c +xorriso/opts_i_o.c +xorriso/emulators.c +xorriso/lib_mgt.c +xorriso/write_run.c +ChangeLog +New -as mkisofs options -jigdo-* and -md5-list as of genisoimage + +2010.09.29.092537 [3412] +xorriso/configure_ac.txt +Enabled use of libjte for GNU xorriso + +2010.09.29.124423 [3413] +xorriso/write_run.c +Avoided trailing 64 kB alignment with -compliance no_emul_toc + +2010.09.29.152827 [3414] +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/lib_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/convert_man_to_html.sh +ChangeLog +New option -jigdo + +2010.09.29.164121 [3415] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/text_io.c +xorriso/aux_objects.h +xorriso/aux_objects.c +Enabled -status -jigdo + +2010.09.30.074208 [3416] +xorriso/lib_mgt.c +Switched from old libjte API names to new ones + +2010.10.01.190235 [3417] +xorriso/xorriso_private.h +xorriso/base_obj.c +Made two non-public parameters independent of Xorriso_with_libjtE + +------------------------------------ cycle - xorriso-0.6.3 - 2010.10.01.190235 +* New API calls isoburn_igopt_attach_jte() and isoburn_igopt_detach_jte() +* New -as mkisofs options -jigdo-* and -md5-list as of genisoimage +* New option -jigdo + + +2010.10.02.121147 [3418] +xorriso/emulators.c +xorriso/lib_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs option -jigdo-template-compress + +2010.10.02.150240 [3419] +xorriso/lib_mgt.c +Added a blank to xorriso Preparer Id string + +2010.10.02.164306 [3420] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.37 now + +2010.10.02.210023 [3421] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/libisoburn.ver +ChangeLog +New API call isoburn_igopt_set_tail_blocks() + +2010.10.02.210305 [3422] +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Letting libisofs do the padding with -jigdo, rather than disabling padding + +2010.10.03.082304 [3423] +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/lib_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs options -checksum_algorithm_iso, -checksum_algorithm_template + +03 Oct 2010 [3424] +ChangeLog +Forgot to commit ChangeLog + +2010.10.03.171305 [3425] +xorriso/lib_mgt.c +Reacting with FATAL event on failure to create libjte_handle + +03 Oct 2010 [3426] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Corrected xorriso docs about meaning of -jigdo-map and .md5 file addresses + +------------------------------------ cycle - xorriso-0.6.3 - 2010.10.03.171305 +* New API call isoburn_igopt_set_tail_blocks() +* New -as mkisofs options -checksum_algorithm_iso, -checksum_algorithm_template + + +2010.10.04.112234 [3427] +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/lib_mgt.c +xorriso/write_run.c +Enabled use of libjte message list + +2010.10.04.113140 [3428] +xorriso/lib_mgt.c +Silenced compiler warning about unused variable + +2010.10.04.155110 [3429] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +libisoburn/libisoburn.ver +ChangeLog +Tests for version of libjte, new API call isoburn_libjte_req() + +2010.10.04.155226 [3430] +xorriso/lib_mgt.c +Reporting libjte version with option -version + +2010.10.05.180016 [3431] +xorriso/iso_manip.c +Fixed a potential SIGSEGV by pointer offset -1. Detected by valgrind. + +2010.10.06.162230 [3432] +xorriso/write_run.c +Fixed a theoretically possible race condition of burn end and ISO generator end + +2010.10.07.114916 [3433] +libisoburn/burn_wrap.c +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/write_run.c +Preparing for GNU xorriso to include libjte source + +7 Oct 2010 [3434] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Enhanced xorriso docs about meaning of .md5 file addresses + +2010.10.07.180935 [3435] +libisoburn/burn_wrap.c +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/write_run.c +Corrected compile problems introduced with rev 3433 + +2010.10.08.093338 [3436] +libisoburn/burn_wrap.c +Fixed inability to compile without enabled libjte. Introduced by rev 3429. + +8 Oct 2010 [3437] +COPYRIGHT +Removed unrelated copyright statements from libisoburn COPYRIGHT + +2010.10.12.103027 [3438] +libisoburn/libisoburn.h +libisoburn/isoburn.c +Allowed to set System Area type via isoburn_igopt_set_system_area() + +2010.10.12.103157 [3439] +xorriso/xorriso_private.h +xorriso/opts_a_c.c +xorriso/emulators.c +Provisorily: -boot_image mips_path= , -as mkisofs -mips-boot. No Eltorito then. + +2010.10.12.183125 [3440] +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/opts_a_c.c +xorriso/emulators.c +xorriso/iso_img.c +Lifted the ban to combine MIPS Big Endian boot with El Torito + +2010.10.13.170641 [3441] +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/iso_img.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Polished and documented MIPS booting option + +2010.10.15.112050 [3442] +xorriso/xorriso_private.h +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/iso_img.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +-boot_image mipsel_path= , -as mkisofs -mipsel-boot. + +2010.10.15.121533 [3443] +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +xorriso/COPYRIGHT_gnu_xorriso +xorriso/README_gnu_xorriso +xorriso/AUTHORS_gnu_xorriso +xorriso/xorriso_eng.html +Included libjte in GNU xorriso + +2010.10.15.125440 [3444] +libisoburn/burn_wrap.c +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/configure_ac.txt +United macro Xorriso_jte_standalonE with macro Xorriso_standalonE + +------------------------------------ cycle - xorriso-0.6.3 - 2010.10.15.125440 +* New API call isoburn_libjte_req() +* New bootspecs mips_path= and mipsel_path= for Debian MIPS releases +* New -as mkisofs options -mips-boot and -mipsel-boot + + +2010.10.18.155353 [3446] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/libisoburn.ver +New API calls isoburn_igopt_set_partition_img, isoburn_igopt_get_partition_img + +2010.10.18.160132 [3448] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/parse_exec.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/iso_img.c +xorriso/write_run.c +libisoburn/libisoburn.ver +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New option -append_partition, -as mkisofs -append_partition + +------------------------------------ cycle - xorriso-0.6.3 - 2010.10.18.160132 +* New option -append_partition, -as mkisofs -append_partition + + +2010.10.19.104814 [3449] +xorriso/xorriso.h +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Minor adjustments + +------------------------------------ cycle - xorriso-0.6.3 - 2010.10.19.104814 + +2010.10.19.170704 [3451] +ChangeLog +xorriso/write_run.c +Avoiding potential endless write pacifier loop. Introduced with rev 3432. + +2010.10.20.075221 [3452] +xorriso/write_run.c +Cancelling libisofs write thread in case of early libburn end + +2010.10.20.170430 [3461] +xorriso/configure_ac.txt +Version leap to libburn-0.8.9 + +2010.10.20.170546 [3462] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-0.8.8 now + +2010.10.21.180343 [3463] +xorriso/drive_mgt.c +Corrected -check_media handling of last track on BD-R resp. BD-ROM + +2010.10.23.162213 [3464] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.38 now + +2010.10.23.162302 [3465] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libisofs-0.6.39 + +26 Oct 2010 [3466] +svn copy -m Branching for libisoburn release 0.6.4 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixFour + +2010.10.26.100001 [3467] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.4 + +26 Oct 2010 [3468] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.6.4 - 2010.10.26.100001 +* New API call isoburn_libjte_req() +* New API calls isoburn_igopt_attach_jte() and isoburn_igopt_detach_jte() +* New API call isoburn_igopt_set_tail_blocks() +* New API call isoburn_libjte_req() +* New option -jigdo +* New -as mkisofs options -jigdo-* and -md5-list as of genisoimage +* New -as mkisofs options -checksum_algorithm_iso, -checksum_algorithm_template +* New bootspecs mips_path= and mipsel_path= for Debian MIPS releases +* New -as mkisofs options -mips-boot and -mipsel-boot +* New option -append_partition, -as mkisofs -append_partition + + +2010.10.26.104219 [3469] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.5 + +26 Oct 2010 [3470] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +26 Oct 2010 [3471] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixFour +http://svn.libburnia-project.org/libisoburn/tags/ZeroSixFour + +------------------------------------ cycle - xorriso-0.6.5 - 2010.10.26.104219 + + +2010.10.27.063628 [3472] +xorriso/emulators.c +Bug fix: -as mkisofs -print-size printed the size but also produced ISO image + +2010.10.27.063705 [3473] +xorriso/emulators.c +New -as mkisofs option -joliet-long + +------------------------------------ cycle - xorriso-0.6.5 - 2010.10.27.063705 +* Bug fix: -as mkisofs -print-size printed the size but also produced ISO image +* New -as mkisofs option -joliet-long + + +2010.10.29.164503 [3475] +xorriso/write_run.c +Added necessary isoburn_cancel_prepared_write() calls + +------------------------------------ cycle - xorriso-0.6.5 - 2010.10.29.164503 + +------------------------------------ cycle - xorriso-0.6.5 - 2010.11.01.113243 +* Build problem fix on Linux 2.4 in GNU xorriso libjte/checksum.c + + +2010.11.01.191542 [3477] +xorriso/iso_manip.c +Allowed to perform -rm_r / + +2010.11.03.081124 [3478] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/drive_mgt.h +xorriso/drive_mgt.c +xorriso/findjob.c +xorriso/read_run.c +Testing for abort file during -check_media + +2010.11.05.143916 [3470] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/libisoburn.ver +New API calls isoburn_igopt_set_disc_label(), isoburn_igopt_get_disc_label() + +2010.11.05.144616 [3480] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/iso_img.c +xorriso/write_run.c +New bootspec sparc_label=, new -as mkisofs options -sparc-boot , -sparc-label + +05 Nov 2010 [3481] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Documentation changes of rev 3480 + +------------------------------------ cycle - xorriso-0.6.5 - 2010.11.05.144616 +* New API calls isoburn_igopt_set_disc_label(), isoburn_igopt_get_disc_label() +* New bootspec sparc_label=, new -as mkisofs options -sparc-boot , -sparc-label + + +2010.11.06.133454 [3482] +libisoburn/libisoburn.h +xorriso/write_run.c +ChangeLog +Declared that isoburn_cancel_prepared_write() waits until iso write thread ends + +2010.11.21.065727 [3484] +xorriso/make_xorriso_standalone.sh +Included jigdo-gen-md5-list in GNU xorriso + +------------------------------------ cycle - xorriso-0.6.5 - 2010.11.21.065727 + + +2010.11.23.193708 [3485] +xorriso/iso_img.c +Improved behavior with loading multiple boot images of identical content + +2010.11.23.200346 [3486] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/write_run.c +Avoided to bother libjte if no output paths are given + +------------------------------------ cycle - xorriso-0.6.5 - 2010.11.23.200346 + +2010.11.24.100845 [3487] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New pseudo extension isoburn_igopt_will_cancel to avoid MISHAP event + +2010.11.24.101056 [3488] +xorriso/write_run.c +Making use of isoburn_igopt_will_cancel with xorriso -print_size + +------------------------------------ cycle - xorriso-0.6.5 - 2010.11.24.101056 + + +2010.11.27.134702 [3489] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.39 now + +2010.11.30.093929 [3490] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/data_source.c +libisoburn/libisoburn.ver +New API calls isoburn_ropt_set_displacement(), isoburn_ropt_get_displacement() + +2010.11.30.094310 [3491] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/drive_mgt.c +xorriso/text_io.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +libisoburn/libisoburn.ver +ChangeLog +New option -displacement + +2010.11.30.104719 [3492] +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/opts_i_o.c +xorriso/disk_ops.h +xorriso/disk_ops.c +Improved messages at the end of partially failed -extract runs + +2010.11.30.112050 [3493] +xorriso/opts_p_z.c +Processing output of -as mkisofs by -pkt_output if enabled + +2010.11.30.170112 [3494] +xorriso/parse_exec.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Clarified occasions of -mark message and removed surplus -mark message emitter + +2010.12.01.173750 [3495] +libisoburn/libisoburn.h +Clarified description of isoburn_ropt_set_displacement() + +2010.12.02.063209 [3496] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/xorriso_main.c +xorriso/opts_d_h.c +xorriso/emulators.c +xorriso/iso_img.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +No -rollback in -as mkisofs -print-size. New flag in Xorriso_change_is_pending. + +2010.12.02.111029 [3497] +xorriso/xorrisoburn.h +xorriso/opts_d_h.c +xorriso/disk_ops.c +xorriso/iso_manip.c +xorriso/findjob.h +xorriso/findjob.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New action estimate_size for -find and -findx + +------------------------------------ cycle - xorriso-0.6.5 - 2010.12.02.111029 +* New API calls isoburn_ropt_set_displacement(), isoburn_ropt_get_displacement() +* New option -displacement +* New action estimate_size for -find and -findx + + +2010.12.04.174311 [3498] +libisoburn/isofs_wrap.c +Fixed a bug about read displacement introduced with rev 3490 + +2010.12.04.174431 [3499] +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Preliminarily banned writing while read displacement is non-zero + +2010.12.06.094347 [3500] +xorriso/opts_a_c.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Allowed writing with read displacement if target media is blank + +2010.12.07.174921 [3501] +xorriso/iso_img.c +Made -rom_toc_scan emul_off work with -mount ... sbsector ... + +2010.12.08.194225 [3510] +xorriso/opts_d_h.c +Fixed a potential bug introduced with rev 3497 + +2010.12.08.194325 [3511] +xorriso/iso_img.c +Fixed a bug introduced with rev 3501 + +08 Dec 2010 [3512] +xorriso/configure_ac.txt +GNU xorriso version leap to libburn-0.9.1 + +2010.12.10.123534 [3513] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.40 now + +2010.12.10.123634 [3514] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libisofs-0.6.41 + +11 Dec 2010 [3515] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Clarification about -md5, -check_media and -find ... -damaged + +12 Dec 2010 [2516] +svn copy -m Branching for libisoburn release 0.6.6 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/ZeroSixSix + +2010.12.12.090001 [3517] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.6 + +12 Dec 2010 [3518] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-0.6.6 - 2010.12.12.090001 +* New API calls isoburn_igopt_set_disc_label(), isoburn_igopt_get_disc_label() +* New API calls isoburn_ropt_set_displacement(), isoburn_ropt_get_displacement() +* Bug fix: -as mkisofs -print-size printed the size but also produced ISO image +* Build problem fix on Linux 2.4 in GNU xorriso libjte/checksum.c +* New -as mkisofs option -joliet-long +* New bootspec sparc_label=, new -as mkisofs options -sparc-boot , -sparc-label +* New option -displacement + + +2010.12.12.120823 [3519] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-0.6.7 + +12 Dec 2010 [3520] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +12 Dec 2010 [3521] +svn move -m Promoted branch to tag +ttp://svn.libburnia-project.org/libisoburn/branches/ZeroSixSix +http://svn.libburnia-project.org/libisoburn/tags/ZeroSixSix + +------------------------------------ cycle - xorriso-0.6.7 - 2010.12.12.120823 + + +2010.12.13.123226 [3523] +configure.ac +xorriso/configure_ac.txt +Prepending ./configure generated options to CFLAGS rather than appending them + +2010.12.22.133742 [3524] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/libisoburn.ver +New API call isoburn_igopt_set_untranslated_name_len() + +2010.12.22.133936 [3525] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -compliance options untranslated_names , untranslated_name_len= + +2010.12.22.151542 [3526] +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs option -untranslated_name_len + +23 Dec 2010 [3527] ++ doc/faq.wiki +Took source file of libburnia-project.org/wiki/FAQ into SVN + +2010.12.23.190134 [3529] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/emulators.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +ChangeLog +New -compliance option iso_9660_1999, -as mkisofs option -iso-level 4 + +------------------------------------ cycle - xorriso-0.6.7 - +* New API call isoburn_igopt_set_untranslated_name_len() +* New -compliance options untranslated_names , untranslated_name_len= +* New -as mkisofs option -untranslated_name_len +* New -compliance option iso_9660_1999, -as mkisofs option -iso-level 4 + + +24 Dec 2010 [3530] +doc/faq.wiki +New q in faq + +2010.12.24.135515 [3531] +libisoburn/libisoburn.h +Mentioned ISO 9660 level 3 in libisoburn API + +2010.12.25.071212 [3532] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-0.6.41 now + +2010.12.25.071522 [3533] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/write_run.c +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -compliance option iso_9660_level=number + +2010.12.25.091515 [3534] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New isoburn_igopt_set_relaxed() option isoburn_igopt_allow_dir_id_ext + +2010.12.25.092828 [3535] +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -compliance option allow_dir_id_ext + +2010.12.25.094309 [3536] +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs option -disallow_dir_id_ext, allow_dir_id_ext is default + +------------------------------------ cycle - xorriso-0.6.7 - 2010.12.25.094309 +* New -compliance option iso_9660_level=number +* New -compliance option allow_dir_id_ext +* New -as mkisofs option -disallow_dir_id_ext + + +2010.12.28.093144 [3538] +xorriso/write_run.c +Made -print_size take into account the toc emulation on blank overwriteables + +2010.12.28.123348 [3539] +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Disabled TOC emulation with -as mkisofs. May be re-enabled by --emul-toc. + +------------------------------------ cycle - xorriso-0.6.7 - 2010.12.28.123348 +* Disabled TOC emulation with -as mkisofs. May be re-enabled by --emul-toc. + + +2010.12.29.104047 [3540] +xorriso/emulators.c +Bug fix: -as mkisofs -print-size did not account for -partition_offset + +------------------------------------ cycle - xorriso-0.6.7 - 2010.12.29.104047 +* Bug fix: -as mkisofs -print-size did not account for -partition_offset + + +30 Dec 2010 [3541] +doc/partition_offset.wiki +Mentioned Debian daily and weekly builds as examples of partiton_offset + +2011.01.04.193042 [3543] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/opts_a_c.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Default -abort_on value is now "FAILURE", for dialog it stays "FATAL" + +2011.01.06.111034 [3544] +xorriso/parse_exec.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Changed dialog default -abort_on value to "NEVER" + +6 Jan 2011 [3545] +ChangeLog +Updated change log + +------------------------------------ cycle - xorriso-0.6.7 - 2011.01.06.111034 +* Default -abort_on value is now "FAILURE" with batch and "NEVER" with dialog + + +2011.01.16.182558 [3557] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-1.0.0 and libburn-1.0.0 now + +16 Jan 2011 [3558] +xorriso/configure_ac.txt +Adapted GNU xorriso to version leap libisofs-1.0.1 , libburn-1.0.1 + +16 Jan 2011 [3559] +doc/partition_offset.wiki +Updated partition offset wiki text about --no-emul-toc + +16 Jan 2011 [3560] +svn copy -m "Branching for libisoburn release 1.0.0" \ + http://svn.libburnia-project.org/libisoburn/trunk \ + http://svn.libburnia-project.org/libisoburn/branches/1.0.0 + +2011.01.16.193257 [3562] +xorriso/emulators.c +xorriso/opts_p_z.c +Updated copyright messages to 2011 + +2011.01.16.200001 [3563] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.0 + +16 Jan 2011 [3564] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.0.0 - 2011.01.16.200001 +* New API call isoburn_igopt_set_untranslated_name_len() +* New -compliance options untranslated_names , untranslated_name_len= +* New -as mkisofs option -untranslated_name_len +* New -compliance option iso_9660_1999, -as mkisofs option -iso-level 4 +* New -compliance option iso_9660_level=number +* New -compliance option allow_dir_id_ext +* New -as mkisofs option -disallow_dir_id_ext +* Disabled TOC emulation with -as mkisofs. May be re-enabled by --emul-toc. +* Default -abort_on value is now "FAILURE" with batch and "NEVER" with dialog +* Bug fix: -as mkisofs -print-size did not account for -partition_offset + + +2011.01.16.193257 [3561] +xorriso/emulators.c +xorriso/opts_p_z.c +Updated copyright messages to 2011 + +2011.01.17.092111 [3565] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.1 + +17 Jan 2011 [3566] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +17 Jan 2011 [3567] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.0.0 +http://svn.libburnia-project.org/libisoburn/tags/1.0.0 + +------------------------------------ cycle - xorriso-1.0.1 - 2011.01.17.092111 + + +2011.01.18.154443 [3568] +libisoburn/isoburn.h +Avoiding if not available. Trying to use in that case. + +2011.01.18.154717 [3569] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/lib_mgt.c +xorriso/write_run.c +Avoiding if not available. Trying to use in that case. + +------------------------------------ cycle - xorriso-1.0.1 - 2011.01.18.154717 +* Removed compiler obstacles of GNU xorriso on Solaris 9 + + +18 Jan 2011 [3571] +doc/faq.wiki +Small change in FAQ wiki text + +19 Jan 2011 [3572] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Mentioned missing mkisofs -old-root functionality in man page + +------------------------------------ cycle - xorriso-1.0.1 - 2011.01.24.141621 +* Bug fix: ECMA-119 standards violation with Volume Descriptor Set Terminator + + +2011.01.26.132843 [3573] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New isoburn_igopt_set_extensions() option isoburn_igopt_old_empty + +2011.01.26.133107 [3574] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -compliance option old_empty + +26 Jan 2011 [3575] +configure.ac +Requiring libisofs-1.0.1 now + +------------------------------------ cycle - xorriso-1.0.1 - 2011.01.26.133107 +* New isoburn_igopt_set_extensions() option isoburn_igopt_old_empty + + +2011.01.26.184140 [3576] +libisoburn/isoburn.c +Followed name change in the yet unstable part of libisofs API + +2011.01.26.210359 [3577] +xorriso/emulators.c +New -as mkisofs option --old-empty + +------------------------------------ cycle - xorriso-1.0.1 - +* New -as mkisofs option --old-empty + + +2011.01.31.135917 [3578] +xorriso/iso_manip.c +Bug fix: Option -mkdir yielded SIGSEGV due to a NULL pointer + +2011.02.01.185830 [3579] +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/parse_exec.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/iso_manip.c +libisoburn/libisoburn.ver +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorriso_eng.html +ChangeLog +New option -clone + +2011.02.02.174154 [3580] +xorriso/xorrisoburn.h +xorriso/iso_manip.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Disallowed -clone to overwrite existing nodes + +2011.02.04.191922 [3581] +xorriso/xorriso.h +xorriso/parse_exec.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/iso_manip.c +xorriso/sfile.c +libisoburn/libisoburn.ver +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New option -cp_clone + +2011.02.07.182947 [3582] +xorriso/cmp_update.c +xorriso/sort_cmp.c +Do not regard file as changed just because no ino was recorded + +2011.02.07.184304 [3583] +xorriso/xorrisoburn.h +xorriso/opts_p_z.c +xorriso/emulators.c +xorriso/iso_tree.h +xorriso/iso_tree.c +xorriso/iso_manip.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs options -root , -old-root, --old-root-no-md5, --old-root-no-ino, --old-root-dev + +2011.02.07.202851 [3584] +xorriso/emulators.c +xorriso/iso_manip.c +xorriso/sort_cmp.c +xorriso/iso_tree.h +xorriso/iso_tree.c +Some corrections of the previous commit + +2011.02.08.133624 [3585] +xorriso/emulators.c +-as mkisofs: Enabled reading of xattr and md5 before image loading + +2011.02.12.171423 [3587] +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/base_obj.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/opts_p_z.c +xorriso/emulators.c +xorriso/cmp_update.h +xorriso/cmp_update.c +xorriso/disk_ops.c +xorriso/iso_manip.h +xorriso/iso_manip.c +xorriso/findjob.h +xorriso/lib_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -find actions update_merge, rm_merge, clear_merge. -cp_clone now merges. + +2011.02.12.172930 [3588] +xorriso/cmp_update.c +Reacted on compiler warning about uninitialized variable + +2011.02.14.090737 [3590] +xorriso/base_obj.c +xorriso/parse_exec.c +xorriso/filters.c +xorriso/write_run.c +Closed memory leaks detected by valgrind + +14 Feb 2011 [3591] +xorriso/xorriso_eng.html +ChangeLog +Updated change log + +------------------------------------ cycle - xorriso-1.0.1 - 2011.02.14.090737 +* Bug fix: Option -mkdir yielded SIGSEGV due to a NULL pointer +* New options -clone and -cp_clone +* New -find actions update_merge, rm_merge, clear_merge +* New -as mkisofs options -root , -old-root +* New -as mkisofs options --old-root-no-md5, --old-root-no-ino, --old-root-dev + + +2011.02.19.112243 [3593] +xorriso/emulators.c +Small adjustments in mkisofs emulation +Bug fix: -as mkisofs -l resp. -full-iso9660-filenames did not work + +2011.02.19.112439 [3594] +xorriso/filters.c +Updated copyright + +2011.02.19.112541 [3595] +xorriso/xorriso.texi +Corrections in xorriso man page + +19 Feb 2011 [3596] +xorriso/xorriso_eng.html +ChangeLog +Updated change log + +19 Feb 2011 [3597] +xorriso/xorriso.info +xorriso/xorriso.1 +info document and man page for recent texi corrections + +------------------------------------ cycle - xorriso-1.0.1 - 2011.02.19.112541 +* Bug fix in libisofs: + Images produced with -for_backup might be unreadable and + also fail -check_md5 verification. +* Bug fix: mkisofs emulation options -l , -full-iso9660-filenames did not work. + + +2011.02.21.130729 [3598] +xorriso/emulators.c +Correction about -as mkisofs --old-root-no-ino + +2011.02.22.073504 [3599] +xorriso/opts_a_c.c +xorriso/iso_manip.c +Issueing messages with -clone and -cp_clone + +2011.02.22.073641 [3600] +xorriso/emulators.c +Corrected a bug that prevented -as mkisofs option -output + +2011.02.22.123730 [3601] +xorriso/emulators.c +Made -as mkisofs ignore option -disable-deep-relocation rather than failing + +2011.02.22.143131 [3602] +xorriso/emulators.c +New -as mkisofs option -max-iso9660-filenames + +22 Feb 2011 [3603] +xorriso/xorriso_eng.html +ChangeLog +Updated change log + +------------------------------------ cycle - xorriso-1.0.1 - 2011.02.22.143131 +* New -as mkisofs option -max-iso9660-filenames + + +23 Feb 2011 [3608] +svn copy -m Branching for libisoburn release 1.0.2 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.0.2 + +2011.02.23.140001 [3609] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.2 + +23 Feb 2011 [3610] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.0.2 - 2011.02.23.140001 +* Bug fix: Images produced with -for_backup might be unreadable and + also fail -check_md5 verification. +* Bug fix: mkisofs emulation options -l , -full-iso9660-filenames did not work. +* Bug fix: Option -mkdir yielded SIGSEGV due to a NULL pointer +* Bug fix: ECMA-119 standards violation with Volume Descriptor Set Terminator +* Removed compiler obstacles of GNU xorriso on Solaris 9 +* New isoburn_igopt_set_extensions() option isoburn_igopt_old_empty +* New options -clone and -cp_clone +* New -find actions update_merge, rm_merge, clear_merge +* New -as mkisofs option -max-iso9660-filenames +* New -as mkisofs option --old-empty +* New -as mkisofs options -root , -old-root +* New -as mkisofs options --old-root-no-md5, --old-root-no-ino, --old-root-dev + + +2011.02.23.202632 [3616] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.3 + +23 Feb 2011 [3617] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-1.0.3 - 2011.02.23.202632 + + +23 Feb 2011 [3618] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.0.2 +http://svn.libburnia-project.org/libisoburn/tags/1.0.2 + +2011.02.24.191908 [3620] +libisoburn/isofs_wrap.c +Corrected a flaw found by George Danchev with cpp + +2011.02.24.192029 [3621] +xorriso/opts_d_h.c +xorriso/text_io.c +xorriso/filters.c +Corrected flaws found by George Danchev with cpp + +2011.02.26.100158 [3622] +xorriso/emulators.c +Bug fix: -as mkisofs -old-root did not work with -graft-points + +2011.02.28.190842 [3623] +xorriso/emulators.c +Bug fix: -as mkisofs -partition_hd_cyl had no effect + +28 Feb 2011 [3624] +xorriso/make_xorriso_1.c +When producing man page from texi: substitute @minus{} within @item + +2011.03.01.145125 [3626] +libisoburn/burn_wrap.c +Bug fix: -as mkisofs -C attempts to read volume header of blank media + +2011.03.01.152159 [3627] +libisoburn/burn_wrap.c +Installed a test against non-zero msc1 on blank input drives + +2011.03.02.093009 [3628] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/emulators.c +xorriso/write_run.c +Counting padding as part of the image with -as mkisofs + +2011.03.02.094049 [3629] +xorriso/opts_d_h.c +xorriso/opts_p_z.c +xorriso/text_io.c +New -padding modes "included" and "excluded" + +02 Mar 2011 [3630] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Updated documentation + +02 Mar 2011 [3631] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.3 - 2011.03.02.094049 +* Bug fix: -as mkisofs -old-root did not work with -graft-points +* Bug fix: -as mkisofs -partition_hd_cyl had no effect +* Bug fix: -as mkisofs -C attempted to read volume header of blank media +* Bug fix: isohybrid image size was not aligned to cylinder boundary +* New -padding modes "included" and "appended" + + +2011.03.03.181601 [3632] +libisoburn/libisoburn.h +libisoburn/isoburn.c +New bits 8 and 9 with options of isoburn_igopt_set_system_area() + +2011.03.03.181850 [3633] +xorriso/xorriso_private.h +xorriso/opts_a_c.c +xorriso/emulators.c +xorriso/text_io.c +New bootspec partition_cyl_align=, new -as mkisofs option -partition_cyl_align + +03 Mar 2011 [3634] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Updated documentation + +04 Mar 2011 [3635] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Clarifications about cylinder size and alignment + +04 Mar 2011 [3626] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.3 - 2011.03.03.181850 +* New bootspec partition_cyl_align=, new -as mkisofs option -partition_cyl_align + + +2011.03.05.090434 [3637] +xorriso/parse_exec.c +xorriso/emulators.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -as mkisofs and -as cdrecord option --no_rc + +2011.03.05.141534 [3638] ++ xorriso/xorrisofs.texi ++ xorriso/xorrisofs.info ++ xorriso/xorrisofs.1 +Makefile.am +xorriso/make_xorriso_standalone.sh +xorriso/xorriso_makefile_am.txt +xorriso/make_docs.sh +Own man page and info document for xorrisofs + +05 Mar 2011 [3639] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Mentioned man xorrisofs in man xorriso + +2011.03.06.153741 [3640] +xorriso/emulators.c +Helptext of -as mkisofs now points to man xorrisofs + +06 Mar 2011 [3641] +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Polished xorrisofs documentation + +2011.03.07.101547 [3642] +xorriso/opts_a_c.c +xorriso/emulators.c +Bug fix: -as mkisofs did not properly unescape target part of pathspecs + +07 Mar 2011 [3643] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.3 - 2011.03.07.101547 +* New -as mkisofs and -as cdrecord option --no_rc +* Own man page and info document for xorrisofs +* Bug fix: -as mkisofs did not properly unescape target part of pathspecs + + +2011.03.09.071325 [3644] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +New isoburn_ropt_set_extensions() option isoburn_ropt_nomd5tag + +2011.03.09.071502 [3645] +xorriso/xorriso_private.h +xorriso/opts_i_o.c +xorriso/emulators.c +xorriso/text_io.c +xorriso/drive_mgt.c +New -md5 modes load_check_off and load_check_on + +08 Mar 2011 [3646] +doc/partition_offset.wiki +Updated partition offset wiki + +2011.03.09.123847 [3647] +xorriso/xorriso.h +Marked options introduced since 0.5.8 by the promised @since tags + +09 Mar 2011 [3648] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Corrections and updates of documentation + +10 Mar 2011 [3649] +xorriso/README_gnu_xorriso +xorriso/make_xorriso_standalone.sh +xorriso/convert_man_to_html.sh ++ xorriso/man_xorrisofs_to_html.sh ++ xorriso/man_xorriso_to_html.sh +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +xorriso/xorriso_eng.html +HTML version of man xorrisofs + +10 Mar 2011 [3654] +svn copy -m Branching for libisoburn release 1.0.4 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.0.4 + +2011.03.10.110001 [3655] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.4 + +10 Mar 2011 [3656] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.0.4 - 2011.03.10.110001 +* New isoburn_ropt_set_extensions() option isoburn_ropt_nomd5tag +* Bug fix: xorrisofs did not work under growisofs -M (version 1.0.0 was ok) +* Bug fix: -as mkisofs -C attempted to read volume header of blank media +* Bug fix: -as mkisofs -old-root did not work with -graft-points +* Bug fix: -as mkisofs -partition_hd_cyl had no effect +* Bug fix: -as mkisofs did not properly unescape target part of pathspecs +* Bug fix: isohybrid image size was not aligned to cylinder boundary +* Bug fix: Compilation without zlib failed +* New -padding modes "included" and "appended" +* New bootspec partition_cyl_align=, new -as mkisofs option -partition_cyl_align +* New -as mkisofs and -as cdrecord option --no_rc +* Own man page and info document for xorrisofs + + +2011.03.10.135207 [3661] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.5 + +10 Mar 2011 [3662] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +10 Mar 2011 [3663] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.0.4 +http://svn.libburnia-project.org/libisoburn/tags/1.0.4 + +------------------------------------ cycle - xorriso-1.0.5 - 2011.03.10.135207 + + +13 Mar 2011 [3668] +COPYRIGHT +Updated copyright year + +2011.03.13.131305 [3669] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-1.0.5 + +2011.03.13.131557 [3670] +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Prepared libisoburn for drive role 4 + +2011.03.21.093208 [3679] +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Prepared libisoburn for drive role 5 + +2011.03.21.093705 [3680] +xorriso/xorriso.h +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/write_run.c +xorriso/text_io.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +libisoburn/libisoburn.ver +New option -early_drive_test + +2011.03.21.113720 [3681] +libisoburn/libisoburn.h +libisoburn/burn_wrap.c +libisoburn/libisoburn.ver +New API call isoburn_set_truncate() + +2011.03.21.113858 [3682] +xorriso/write_run.c +Made use of new API call isoburn_set_truncate + +2011.03.21.165533 [3683] +xorriso/xorriso_private.h +xorriso/opts_d_h.c +xorriso/drive_mgt.c +xorriso/text_io.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -early_stdio_test option appendable_wo + +2011.03.22.081408 [3684] +libisoburn/burn_wrap.c +Fixed use of uninitialized variable when blanking rol5 pseudo drives + +24 Mar 2011 [3686] +xorriso/README_gnu_xorriso +Fixed typos in GNU xorriso readme file + +2011.03.24.182518 [3688] +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Better handling of pseudo-drive without read-permission + +2011.03.25.191936 [3689] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-1.0.5 + +2011.03.26.100519 [3690] +xorriso/iso_manip.c +Reporting target name if adding of new node fails with ISO_WRONG_ARG_VALUE + +2011.03.26.143944 [3691] +xorriso/write_run.c +Unconditionally reporting iso_level with -status -compliance + +2011.03.26.144233 [3692] +libisoburn/libisoburn.h +libisoburn/isoburn.h +libisoburn/isoburn.c +New relax option isoburn_igopt_joliet_long_names + +2011.03.26.144541 [3693] +xorriso/emulators.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +New -compliance option joliet_long_names + +26 Mar 2011 [3694] +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Small adjustments to xorrisofs.texi + +26 Mar 2011 [3695] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.5 - 2011.03.26.144541 +* New API call isoburn_set_truncate() +* New relax option isoburn_igopt_joliet_long_names +* New option -early_stdio_test +* New -compliance option joliet_long_names +* -as mkisofs option -joliet-long is now fully functional +* Burning DVD-R DAO with 2 kB size granularity rather than 32 kB + + +2011.03.26.203042 [3696] +xorriso/iso_manip.c +Interpreting new libisofs error codes ISO_RR_NAME_TOO_LONG ISO_RR_NAME_RESERVED + +2011.03.29.150930 [3697] +xorriso/iso_manip.c +Interpreting new libisofs error code ISO_RR_PATH_TOO_LONG + +2011.03.29.151144 [3698] +xorriso/write_run.c +Bug fix: -as mkisofs padding did not work (regression in 1.0.4) + +30 Mar 2011 [3699] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.5 - 2011.03.29.151144 +* Bug fix: -as mkisofs padding did not work (regression in 1.0.4) + + +2011.04.01.133116 [3700] +xorriso/emulators.c +Allowing double dashes with all long xorrisofs options + +3 Apr 2011 [3701] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Clarified relation of startup files, -options_from_file and quoted input. + +3 Apr 2011 [3702] +xorriso/COPYRIGHT_gnu_xorriso +xorriso/README_gnu_xorriso +Updated info about GNU xorriso copyright and libjte + +2011.04.03.094634 [3703] +xorriso/xorriso.h +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/opts_p_z.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New options -print_info and -print_mark + +2011.04.04.064909 [3704] +xorriso/write_run.c +Bug fix: Options -gid and -uid had no effect + +2011.04.04.071443 [3705] +xorriso/drive_mgt.c +Avoided to report Volume Id when aquiring drive with blank media + +4 Apr 2011 [3706] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.5 - 2011.04.04.071443 +* Bug fix: Options -gid and -uid had no effect +* New options -print_info and -print_mark + + +2011.04.04.140752 [3707] +Makefile.am +xorriso/xorriso_makefile_am.txt +xorriso/make_xorriso_standalone.sh ++ doc/startup_file.txt +Added an example of a startup file + +2011.04.05.072141 [3708] +xorriso/xorriso_main.c +xorriso/write_run.c +Fixed a typo in messages and goto label + +07 Apr 2011 [3709] +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Clarification about -as mkisofs pathspecs + +07 Apr 2011 [3710] +doc/partition_offset.wiki +Updated partition offset wiki about cylinder alignment + +08 Apr 2011 [3711] +doc/faq.wiki +FAQ about release version numbers + +08 Apr 2011 [3716] +svn copy -m Branching for libisoburn release 1.0.6 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.0.6 + +2011.04.08.193001 [3717] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.6 + +08 Apr 2011 [3718] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.0.6 - 2011.04.08.193001 +* Bug fix: -as mkisofs padding did not work (regression in 1.0.4) +* Bug fix: Options -gid and -uid had no effect +* New API call isoburn_set_truncate() +* New relax option isoburn_igopt_joliet_long_names +* New option -early_stdio_test +* New options -print_info and -print_mark +* New -compliance option joliet_long_names +* -as mkisofs option -joliet-long is now fully functional +* Burning DVD-R DAO with 2 kB size granularity rather than 32 kB + + +2011.04.09.105219 [3723] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.7 + +09 Apr 2011 [3724] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +09 Apr 2011 [3725] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.0.6 +http://svn.libburnia-project.org/libisoburn/tags/1.0.6 + +------------------------------------ cycle - xorriso-1.0.7 - 2011.04.09.105219 + + +2011.04.13.204236 [3726] +xorriso/emulators.c +Bug fix: mkisofs emulation could ignore options (regression in 0.1.6) + +14 Apr 2011 [3727] +svn copy -m Branching for libisoburn release 1.0.8 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.0.8 + +2011.04.15.073001 [3278] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.8 + +14 Apr 2011 [3729] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +2011.04.14.073001 [3730] +xorriso/xorriso_timestamp.h +ChangeLog +xorriso/changelog.txt +Corrected release date + +----------------------------------- release - xorriso-1.0.8 - 2011.04.13.073001 +* Bug fix: mkisofs emulation could ignore options (regression in 0.1.6) + + +2011.04.14.081721 [3731] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +Version leap to libisoburn-1.0.9 + +14 Apr 2011 [3732] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +14 Apr 2011 [3733] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.0.8 +http://svn.libburnia-project.org/libisoburn/tags/1.0.8 + +------------------------------------ cycle - xorriso-1.0.9 - 2011.04.14.081721 + + +15 Apr 2011 [3734] +doc/doxygen.conf.in +Disabled HAVE_DOT in doxygen.conf + +18 Apr 2011 [3736] +doc/partition_offset.wiki +doc/faq.wiki +Mentioned success and failure reports of partition offset + +2011.04.22.081847 [3737] +libisoburn/isoburn.h +libisoburn/isoburn.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Avoiding repeated PVD read attempts if first reading of PVD yielded error + +2011.04.23.152348 [3738] +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/base_obj.c +xorriso/lib_mgt.h +xorriso/lib_mgt.c +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/opts_p_z.c +xorriso/write_run.c +xorriso/text_io.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +libisoburn/libisoburn.ver +New option -signal_handling + +23 Apr 2011 [3739] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.9 - 2011.04.23.152348 +* New option -signal_handling + + +2011.04.27.143713 [3740] +xorriso/iso_manip.c +Saved some CPU cycles when adding wide directory trees + +2011.04.27.150829 [3741] +xorriso/read_run.c +Downgraded extraction error from FAILURE to SORRY (for new -abort_on default) + +2011.04.30.121138 [3742] +xorriso/iso_manip.c +Saved more CPU cycles by optimistic adding of file objects + +2011.05.02.090908 [3744] +xorriso/aux_objects.c +Replaced some large local variables by other means which save stack space + +2011.05.02.091632 [3745] +xorriso/base_obj.c +Replaced some large local variables by other means which save stack space + +2011.05.02.100332 [3746] +xorriso/check_media.c +Replaced some large local variables by other means which save stack space + +2011.05.02.121907 [3747] +xorriso/cmp_update.c +Replaced some large local variables by other means which save stack space + +2011.05.02.191704 [3748] +xorriso/disk_ops.c +Replaced some large local variables by other means in xorriso/disk_ops.c + +2011.05.02.191905 [3749] +xorriso/cmp_update.c +Better reporting of memory shortage with rev 3747 + +2011.05.02.211310 [3750] +xorriso/drive_mgt.c +Replaced some large local variables by other means in xorriso/drive_mgt.c + +2011.05.02.211401 [3751] +xorriso/xorriso.h +Clarified and updated API documentation of Xorriso_prescan_args() + +2011.05.03.063012 [3752] +xorriso/drive_mgt.c +Closed a memory leak found by valgrind + +2011.05.03.085459 [3753] +xorriso/write_run.c +Closed memory leaks found by valgrind + +2011.05.03.091059 [3754] +xorriso/emulators.c +Replaced some large local variables by other means in xorriso/emulators.c + +2011.05.03.095849 [3755] +xorriso/filters.c +Replaced some large local variables by other means in xorriso/filters.c + +2011.05.03.100744 [3756] +xorriso/findjob.c +Replaced some large local variables by other means in xorriso/findjob.c + +2011.05.03.115103 [3757] +xorriso/iso_img.c +Replaced some large local variables by other means in xorriso/iso_img.c + +2011.05.03.115146 [3758] +libisoburn/burn_wrap.c +Closed a memory leak found by valgrind + +2011.05.03.115226 [3759] +xorriso/findjob.c +Closed a memory leak found by valgrind + +2011.05.04.151605 [3760] +xorriso/iso_manip.c +Replaced some large local variables by other means in xorriso/iso_manip.c + +2011.05.04.151721 [3761] +xorriso/cmp_update.c +Replaced some large local variables by other means in xorriso/cmp_update.c + +2011.05.04.151820 [3762] +xorriso/findjob.c +Closed a memory leak found by valgrind + +2011.05.04.152314 [3763] +xorriso/drive_mgt.c +xorriso/emulators.c +Reacted on compiler warning about rev 3750 and 3754 + +2011.05.04.165840 [3764] +xorriso/iso_tree.c +Replaced some large local variables by other means in xorriso/iso_tree.c + +2011.05.04.171628 [3765] +xorriso/lib_mgt.c +Replaced some large local variables by other means in xorriso/lib_mgt.c + +2011.05.05.075233 [3766] +xorriso/match.c +Replaced some large local variables by other means in xorriso/match.c + +2011.05.05.081436 [3767] +xorriso/misc_funct.c +Replaced some large local variables by other means in xorriso/misc_funct.c + +2011.05.05.105152 [3768] +xorriso/opts_a_c.c +Replaced some large local variables by other means in xorriso/opts_a_c.c + +2011.05.05.105310 [3769] +xorriso/iso_img.c +Closed a memory leak found by valgrind + +2011.05.05.121640 [3770] +xorriso/opts_d_h.c +Replaced some large local variables by other means in xorriso/opts_d_h.c + +2011.05.05.121957 [3771] +xorriso/opts_d_h.c +Reacted on compiler warning about rev 3770 + +2011.05.05.122855 [3772] +xorriso/text_io.c +Added newline character to output of -errfile_log plain -I + +2011.05.05.163832 [3773] +xorriso/opts_i_o.c +Replaced some large local variables by other means in xorriso/opts_i_o.c + +2011.05.05.163926 [3774] +xorriso/opts_a_c.c +Corrected a mistake introduced with rev 3768 + +2011.05.06.120600 [3775] +xorriso/misc_funct.c +Introduced flag bit1 with Text_shellsafe() for double sized target string + +2011.05.06.120655 [3776] +xorriso/opts_p_z.c +Replaced some large local variables by other means in xorriso/opts_p_z.c + +2011.05.06.120834 [3777] +xorriso/disk_ops.c +Corrected use of unitialized variables found by valgrind + +2011.05.06.121218 [3778] +xorriso/sfile.h +Commited definition of Xorriso_alloc_meM which is needed since 30 revisions + +2011.05.06.132058 [3779] +xorriso/disk_ops.c +xorriso/iso_tree.c +xorriso/iso_manip.c +xorriso/opts_i_o.c +Made use of Text_shellsafe bit1 for messages with two file names + +2011.05.06.151905 [3780] +xorriso/parse_exec.c +Replaced some large local variables by other means in xorriso/parse_exec.c + +2011.05.07.104932 [3781] [3782] +xorriso/iso_img.c +Bug fix: -mount_opts "shared" worked only with -osirrox "o_excl_off" + +2011.05.07.105142 [3783] +xorriso/iso_img.c +Enabled drive addresses of form mmc:/dev/srX with option -mount + +2011.05.07.165758 [3784] +xorriso/read_run.c +Replaced some large local variables by other means in xorriso/read_run.c + +2011.05.07.184625 [3785] +xorriso/text_io.c +Replaced some large local variables by other means in xorriso/text_io.c + +2011.05.08.083929 [3786] +xorriso/write_run.c +Replaced some large local variables by other means in xorriso/write_run.c + +2011.05.08.174805 [3787] +xorriso/opts_a_c.c +xorriso/cmp_update.c +xorriso/drive_mgt.c +xorriso/iso_img.c +xorriso/sort_cmp.c +xorriso/text_io.c +xorriso/write_run.c +Replaced some large local variables by other means + +2011.05.09.155010 [3788] +libisoburn/isoburn.c +libisoburn/burn_wrap.c +libisoburn/isofs_wrap.c +Replaced some large local variables by other means in + +2011.05.09.181239 [3789] +xorriso/parse_exec.c +xorriso/opts_p_z.c +xorriso/drive_mgt.c +xorriso/iso_img.c +xorriso/iso_tree.c +xorriso/iso_manip.c +xorriso/sort_cmp.c +xorriso/filters.c +xorriso/write_run.c +xorriso/match.c +xorriso/text_io.c +xorriso/findjob.c +xorriso/misc_funct.c +xorriso/sfile.c +Reacted on -Wsign-compare warnings of gcc + +2011.05.09.181449 [3790] +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +Reacted on -Wsign-compare warnings of gcc + +2011.05.12.175155 [3797] +configure.ac +libisoburn/libisoburn.h +Requiring libisofs-1.0.8 now + +2011.05.12.175423 [3798] +xorriso/configure_ac.txt +GNU xorriso now contains libisofs-1.0.9 + +13 May 2011 [3799] +xorriso/xorrisofs.texi +Corrected a typo in man page of xorrisofs + +13 May 2011 [3800] +xorriso/make_xorriso_1.c +xorriso/xorriso.texi +xorriso/xorriso.1 +Added a rule to the conversion prescription for man pages + +13 May 2011 [3801] +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +Added a rule to the conversion prescription for man pages + +14 May 2011 [3802] +xorriso/make_xorriso_1.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Patch by Mats Erik Anderson: wrap @command{} around the word xorriso + +2011.05.16.132939 [3809] +xorriso/parse_exec.c +Bug fix: xorriso command -add_plainly "any" did not add all file sto the image + +2011.05.16.133231 [3810] +xorriso/sfile.h +Replaced german macro parameter name by an english one + +2011.05.16.134341 [3811] +xorriso/xorriso.h +xorriso/parse_exec.c +Checking for unknown xorriso commands already in Xorriso_prescan_args() + +16 May 2011 [3812] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Made xorriso version number visible in manuals + +16 May 2011 [3813] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Adjusted line lengths to less than 80 chars in source of xorriso manual + +17 May 2011 [3814] +xorriso/make_xorriso_1.c +Implemented texi-to-man translation rule about {...} recursion + +17 May 2011 [3815] +xorriso/xorriso.texi +xorriso/xorrisofs.texi +Added to the manual instructions for bug reporting + +17 May 2011 [3816] +xorriso/xorrisofs.texi +Wrapped @command{} around the word xorrisofs in its manual + +17 May 2011 [3817] +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Updated generated manuals + +2011.05.17.115159 [3818] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.9 - 2011.05.17.115159 +* Bug fix: -mount_opts shared worked only with -osirrox o_excl_off +* Bug fix (libisofs): Production of MIPS bootable images caused SIGSEGV +* Bug fix: xorriso command -add_plainly "any" did not add all files to the image + + +2011.05.17.151719 [3819] +xorriso/xorriso.h +xorriso/parse_exec.c +xorriso/xorriso_main.c +New flag bit1 of API call Xorriso_prescan_args() reports unknown commands + +17 May 2011 [3820] +xorriso/make_xorriso_1.c +xorriso/xorriso.texi +xorriso/xorrisofs.texi +New rules for translating several texi @-commands to man page + +------------------------------------ cycle - xorriso-1.0.9 - 2011.05.17.151719 + + +2011.05.18.063511 [3821] +xorriso/parse_exec.c +Fixed refusal to run with command -as introduced by rev 3819 + +18 May 2011 [3822] +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Polished node "Bugreport" in manuals + +------------------------------------ cycle - xorriso-1.0.9 - 2011.05.18.063511 + + +2011.05.19.111229 [3823] +libisoburn/libisoburn.h +Mentioned the need to define uint32_t when including libisoburn.h + +2011.05.19.133735 [3824] +xorriso/write_run.c +Bug fix: The attempt to blank already blanked DVD-RW was not gracefully blocked + +2011.05.19.133840 [3825] +xorriso/check_media.c +Replaced some large local variables by other means in xorriso/check_media.c + +2011.05.19.133940 [3826] +xorriso/opts_p_z.c +Reacted on -Wsign-compare warnings of gcc + +2011.05.19.134432 [3827] +libisoburn/isofs_wrap.c +Revoked experimental change which sneaked into SVN by rev 3737 + +20 May 2011 [3828] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.0.9 - 2011.05.19.134432 +* Bug fix: The attempt to blank already blank DVD-RW was not gracefully blocked + + +2011.05.20.175842 [3829] +xorriso/iso_img.c +Reacted on compiler warning about inactivated if statement + +2011.05.22.143652 [3832] +configure.ac +xorriso/configure_ac.txt +Added options -Wextra -Wno-unused-parameter for gcc + +2011.05.22.181525 [3833] +xorriso/opts_a_c.c +xorriso/opts_i_o.c +xorriso/findjob.c +Reacted on static code checker warning reported by George Danchev + +2011.05.26.151635 [3841] +configure.ac +libisoburn/libisoburn.h +Requiring libburn-1.0.7 now + +2011.05.26.151744 [3842] +xorriso/drive_mgt.c +Report damaged track with "Media status :" + +2011.05.29.095524 [3843] +xorriso/drive_mgt.c +Removed quotation marks in message introduced by rev3842 + +2011.05.29.100055 [3844] +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Improved error messages if DVD-RW media can only be written with -close on + +2011.05.31.092902 [3845] +xorriso/text_io.c +With -status : always display setting of -abort_on + +2011.06.01.165129 [3847] +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/parse_exec.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/write_run.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +libisoburn/libisoburn.ver +New option -close_damaged + +2011.06.07.144548 [3857] +xorriso/write_run.c +Fixed a typo in a hint about fast blanked DVD-RW + +8 Jun 2011 [3862] +configure.ac +Makefile.am +xorriso/configure_ac.txt +xorriso/xorriso_makefile_am.txt +Introduced AC_CONFIG_MACRO_DIR() and ACLOCAL_AMFLAGS on advise of George Danchev + +9 Jun 2011 [3865] +bootstrap +xorriso/xorriso_bootstrap.txt +Added option -I . to aclocal in bootstrap script on advise of George Danchev + +------------------------------------ cycle - xorriso-1.0.9 - 2011.06.15.153630 +* New option -close_damaged +* Bug fix (libisofs) : -as mkisofs -isohybrid-mbr without -no-pad was not cylinder aligned + + +2011.06.17.143813 [3867] +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +README +doc/faq.wiki +doc/partition_offset.wiki +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorriso_eng.html +ChangeLog +Avoided the use of the term 'eventual' for the meaning 'if applicable'. + +18 Jun 2011 [3872] +svn copy -m Branching for libisoburn release 1.1.0 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.1.0 + +2011.06.18.123001 [3973] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.0 + +18 Jun 2011 [3874] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.1.0 - 2011.06.18.123001 +* Bug fix: -mount_opts shared worked only with -osirrox o_excl_off +* Bug fix: xorriso command -add_plainly "any" did not add all files to the image +* Bug fix: The attempt to blank already blank DVD-RW was not gracefully blocked +* Bug fix: -as mkisofs -isohybrid-mbr without -no-pad was not cylinder aligned +* Bug fix: Production of MIPS bootable images caused SIGSEGV +* New option -signal_handling +* New option -close_damaged + + +2011.06.18.173208 [3879] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.1 + +18 Jun 2011 [3880] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +18 Jun 2011 [3881] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.1.0 +http://svn.libburnia-project.org/libisoburn/tags/1.1.0 + +------------------------------------ cycle - xorriso-1.1.1 - 2011.06.18.173208 + +------------------------------------ cycle - xorriso-1.1.1 - 2011.06.19.210656 +* Bug fix: GNU xorriso-1.1.0 compiled only on Linux, FreeBSD, and Solaris + +------------------------------ release - xorriso-1.1.0.pl01 - 2011.06.20.110001 +* Bug fix: GNU xorriso-1.1.0 compiled only on Linux, FreeBSD, and Solaris + + +22 Jun 2011 [3887] +releng/releng_build_jigdo +releng/README.releng +Beginning to create a test suite for libisoburn and xorriso + +27 Jun 2011 [3943] ++ releng/test_hardlinks +New test test_hardlinks + +27 Jun 2011 [3944] +releng/TODO +Added rules to releng/TODO, new options -keep, -clean_up, deprecated -clean + +27 Jun 2011 [3945] [3948] [3952] [3957] +releng/test_hardlinks +Polished hardlink test + +2011.06.27.160728 [3956] +xorriso/opts_p_z.c +Bug fix: -update_r scheduled non-existing files for hardlink update + +2011.06.27.172423 [3958] +xorriso/parse_exec.c +Reporting commands and their arguments as DEBUG messages before execution + +28 Jun 2011 [3964] +releng/test_hardlinks ++ tmp +Adapted test_hardlinks to newly defined general test rules + +28 Jun 2011 [3965] +releng/test_hardlinks +Adjusted names of config variables in test_hardlinks + +28 Jun 2011 [3968] +releng/test_hardlinks +- tmp ++ releng/tmp +Option -fail for test_hardlinks to simulate failure, moved tmp to releng/tmp + +28 Jun 2011 [3969] +releng/test_hardlinks +Removed suffix .result from tmp/test_hardlinks + +2011.06.28.084751 [3970] +A test with non-added file releng/tmp/test + +28 Jun 2011 [3973] ++ releng/releng_generated_data +- releng/tmp +Renamed releng/tmp to releng/releng_generated_data + +28 Jun 2011 [3974] +releng/test_hardlinks +Adapted test_hardlinks to newest agreements with George + +28 Jun 2011 [3975] ++ releng/releng_hardlinks +- releng/test_hardlinks +Renamed test_hardlinks to releng_hardlinks + +2011.07.02.153320 [3991] +libisoburn/burn_wrap.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.085629 [4003] +xorriso/aux_objects.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.091220 [4006] +xorriso/misc_funct.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.091706 [4007] +xorriso/misc_funct.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.092353 [4008] +xorriso/disk_ops.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.093500 [4010] +xorriso/parse_exec.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.093500 [4015] +xorriso/sfile.c +Reacted on warnings of -Wtype-limits + +2011.07.03.181840 [4020] +configure.ac +libisoburn/libisoburn.h +Requiring libsofs-1.1.1 now + +2011.07.03.193627 [4029] +xorriso/iso_tree.c +xorriso/read_run.c +Enabled extraction of the boot catalog file to disk filesystem + +2011.07.03.194138 [4030] +xorriso/opts_a_c.c +xorriso/opts_i_o.c +xorriso/opts_p_z.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.194723 [4031] +xorriso/drive_mgt.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.03.203013 [4033] +xorriso/opts_i_o.c +Removed a premature reference to upcomming function + +2011.07.04.092828 [4034] +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/opts_i_o.c +xorriso/drive_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +libisoburn/libisoburn.ver +New option -list_speeds + +4 Jul 2011 [4035] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.1.1 - 2011.07.04.092828 +* Bug fix: -update_r scheduled non-existing files for hardlink update +* New option -list_speeds +* Enabled extraction of the boot catalog file to disk filesystem + + +2011.07.04.105800 [4036] +xorriso/iso_manip.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.04.105854 [4037] +xorriso/write_run.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.04.121342 [4038] +xorriso/read_run.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.04.121501 [4039] +xorriso/filters.c +Reacted on warnings of -Wunused-but-set-variable + +2011.07.05.145103 [4062] +libisoburn/libisoburn.h +Made libisoburn.h ready for use with C++ without importing namespace "burn" + +2011.07.06.190111 [4078] +libisoburn/isofs_wrap.c +Hopefully fixed Debian bug 632865: blank ISO images with drive role 5 + +2011.07.07.113930 [4082] +libisoburn/isoburn.c +libisoburn/isofs_wrap.c +libisoburn/burn_wrap.c +Bug fix: Since 1.0.6: Unreadable image produced by: xorrisofs ... >image.iso + +------------------------------------ cycle - xorriso-1.1.1 - 2011.07.07.113930 +* Bug fix: Since 1.0.6: Unreadable image produced by: xorrisofs ... >image.iso + + +7 Jul 2011 [4086] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +8 Jul 2011 [4092] +svn copy -m Branching for libisoburn release 1.1.2 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.1.2 + +2011.07.08.100001 [4094] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.2 + +8 Jul 2011 [4095] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.1.2 - 2011.07.08.100001 +* Bug fix: -update_r scheduled non-existing files for hardlink update +* New option -list_speeds +* Enabled extraction of the boot catalog file to disk filesystem +* Bug fix: Since 1.0.6: Unreadable image produced by: xorrisofs ... >image.iso + + +2011.07.08.131032 [4099] [4100] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.3 + +8 Jul 2011 [4101] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +8 Jul 2011 [4102] +svn move -m Promoted branch to tag +http://svn.libburnia-project.org/libisoburn/branches/1.1.2 +http://svn.libburnia-project.org/libisoburn/tags/1.1.2 + +------------------------------------ cycle - xorriso-1.1.3 - 2011.07.08.131032 + + +2011.07.10.112539 [4126] +libisoburn/isofs_wrap.c +Recognizing overwritable media, blanked by cdrskin --grow_overwriteable_iso + +2011.07.11.175609 [4134] +xorriso/drive_mgt.c +Reacted on warnings of cppcheck + +2011.07.12.092010 [4137] +xorriso/drive_mgt.c +Improved output of -list_speeds with CD drives. Empty list now cause SORRY. + +2011.07.12.135452 [4146] +xorriso/drive_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +Improved output of -list_speeds with ROM media and ROM drives. + +13 Jul 2011 [4158] [4159] [4160] ++ releng/manual_devices_ts +Proposal for test ./manual_devices + +14 Jul 2011 [4161] [4162] +releng/manual_devices_ts ++ releng/inc/releng_getopts_ts.inc +Proposal for test ./manual_devices and inc/releng_getopts_ts.inc + +14 Jul 2011 [4163] +releng/manual_devices_ts +releng/inc/releng_getopts_ts.inc +Prepared test proposal for option -f and for incomplete option -x + +14 Jul 2011 [4165] +releng/manual_devices_ts +Issueing failure message and non-zero exit value if manual_devices_ts fails + +14 Jul 2011 [4166] +releng/inc/releng_getopts_ts.inc +Corrected a misunderstanding about meaning of code piece + +2011.07.15.083052 [4171] +libisoburn/burn_wrap.c +Reacted on warnings of cppcheck about libisoburn/burn_wrap.c + +15 Jul 2011 [4172] +releng/manual_devices +Removed remnant reference to releng_getopts_ts.inc + +15 Jul 2011 [4173] +releng/inc/releng_getopts.inc +Removed usage of getopts in releng_getopts.inc + +15 Jul 2011 [4174] +releng/inc/releng_getopts.inc +Removed obsolete input checks from releng_getopts.inc + +15 Jul 2011 [4175] +releng/inc/releng_getopts.inc +releng/manual_devices +New function check_for_xorriso in releng_getopts.inc + +15 Jul 2011 [4176] +releng/inc/releng_getopts.inc +Removed call to print_specific_help from releng_getopts.inc + +15 Jul 2011 [4177] +releng/inc/releng_getopts.inc +Changed general option -k -c -f in releng_getopts.inc + +17 Jul 2011 [4185] +releng/run_all_releng +Issueing pacifier messages in run_all_releng about logged line + +17 Jul 2011 [4186] +releng/run_all_releng +Making run_all_releng recognize exit values again (fixing rev 4185) + +17 Jul 2011 [4187] +releng_printsize +Issueing pacifier messages during tree generation of releng_printsize + +17 Jul 2011 [4186] +releng/run_all_releng +Using a more elegant way to obtain pipe component exit value + +17 Jul 2011 [4192] +releng/run_all_releng +Switched error message away from stderr, only pacifier remains on stderr + +17 Jul 2011 [4194] +releng/run_all_releng +Added my copyright to run_all_releng + +23 Jul 2011 [4208] [4209] +svn mv releng/README releng/README.old +releng/README +Began to sketch an releng/README file + +2011.07.24.193433 [4213] +xorriso/drive_mgt.c +Improved media summary with overwritable media and unknown content + +2011.07.24.203919 [4214] +xorriso/drive_mgt.c +Improved -check_media with overwritable media and unknown content + +2011.07.25.095843 [4215] +xorriso/check_media.h +xorriso/check_media.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New -check_media option what=image + +2011.07.25.103809 [4216] +xorriso/drive_mgt.c +Issueing a warning messages if BD-R with more than 299 sessions is loaded + +27 Jul 2011 [4217] +releng/auto_printsize +Reduced runtime of auto_printsize and balanced xorriso versus genisoimage + +2011.07.27.211423 [4218] +xorriso/xorriso.h +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/opts_i_o.c +xorriso/drive_mgt.c +xorriso/aux_objects.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +New option -device_links + +27 Jul 2011 [4219] +releng/manual_devices +Switched releng/manual_devices from -devices to -device_links + +2011.07.28.111814 [4220] +xorriso/drive_mgt.c +xorriso/xorriso.texi +xorriso/xorriso.info +xorriso/xorriso.1 +Prefering dvd over cd with -device_links + +28 Jul 2011 [4221] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page +------------------------------------ cycle - xorriso-1.1.3 - 2011.07.28.111814 +* New option -device_links + + +2011.07.28.192110 [4224] +configure.ac +libisoburn/libisoburn.h +Requiring libburn 1.1.1 + +2011.07.28.195103 [4225] +xorriso/drive_mgt.c +Using libburn call burn_lookup_device_link() + +30 Jul 2011 [4226] +xorriso/xorrisofs.texi +xorriso/xorrisofs.info +xorriso/xorrisofs.1 +Small correction in xorrisofs man page + +2011.07.31.091836 [4229] +libisoburn/burn_wrap.c +Bug fix: xorriso native mode on some drives wrote unreadble ISO images to CD + +2011.07.31.094422 [4230] +xorriso/xorrisoburn.h +xorriso/opts_a_c.c +xorriso/opts_p_z.c +Allowed lower case severity names with -abort_on, -return_with, -report_about + +2011.07.31.145832 [4231] +xorriso/misc_funct.c +Bug fix: -assert_volid did not work. Regression since version 1.1.0, rev 3767. + +2011.08.01.130400 [4233] +xorriso/drive_mgt.c +xorriso/misc_funct.c +New report line "Media blocks :" with option -toc + +1 Aug 2011 [4234] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.1.3 - 2011.08.01.130400 +* Bug fix: xorriso native mode on some drives wrote unreadble ISO images to CD +* Bug fix: -assert_volid did not work. Regression since version 1.1.0. + + +2011.08.01.152915 [4236] +xorriso/misc_funct.h +Forgot to upload the header which defines Xorriso__to_upper + +1 Aug 2011 [4238] +releng/auto_isocontent +Checking -assert_volid in auto_isocontent + +3 Aug 2011 [4240] +releng/README +releng/template_new +Added more text pieces to releng/README, updated template for new tests + +3 Aug 2011 [4241] +releng/inc/releng_getopts.inc +Added option -h to general helptext of releng + +4 Aug 2011 [4242] +releng/template_new +Further improvements to releng test template + +4 Aug 2011 [4243] ++ releng/manual_burn +New test releng/manual_burn + +4 Aug 2011 [4244] +releng/README +releng/manual_burn +Improvements about releng/manual_burn + +5 Aug 2011 [4245] +releng/auto_cxx +releng/auto_isocontent +releng/manual_burn +releng/manual_isojigdo +Made existing tests comply to upcomming prescriptions for failure messages + +5 Aug 2011 [4246] +releng/inc/releng_getopts.inc +Made existing tests comply to upcomming prescriptions for failure messages + +7 Aug 2011 [4248] +releng/README +More work on releng/README + +07 Aug 2011 [4252] +svn copy -m Branching for libisoburn release 1.1.4 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.1.4 + +2011.08.07.120001 [4253] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.4 + +07 Aug 2011 [4254] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +2011.08.08.071649 [4256] +xorriso/read_run.c +Improved error reporting with problems when extracting xattr or ACL + +2011.08.08.070301 [4257] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/configure_ac.txt +xorriso/xorriso_eng.html +xorriso/xorriso_timestamp.h +Requiring libisofs-1.1.4 (because of ACL extraction problem in 1.1.2) + +08 Aug 2011 [4258] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.1.4 - 2011.08.08.070301 +* New option -device_links +* Bug fix: xorriso native mode on some drives wrote unreadble ISO images to CD +* Bug fix: -assert_volid did not work. Regression since version 1.1.0. +* Bug fix: -acl or -xattr worked with -extract only on Linux and FreeBSD + + +2011.08.08.124228 [4263] +xorriso/read_run.c +Improved error reporting with problems when extracting xattr or ACL + +2011.08.08.124914 [4264] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.5 + +08 Aug 2011 [4265] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +08 Aug 2011 [4266] +svn move -m 'Promoted branch to tag' +http://svn.libburnia-project.org/libisoburn/branches/1.1.4 +http://svn.libburnia-project.org/libisoburn/tags/1.1.4 + +------------------------------------ cycle - xorriso-1.1.5 - 2011.08.08.124914 + + +09 Aug 2011 [4267] +releng/auto_isocontent +Made releng/auto_isocontent ready for Solaris (with bash) + +09 Aug 2011 [4268] +releng/inc/releng_getopts.inc +Made releng/manual_burn and releng/manual_devices work on FreeBSD + +09 Aug 2011 [4269] +releng/auto_cxx +Made releng/auto_cxx ready for FreeBSD (with bash or "bash" linked to /bin/sh) + +09 Aug 2011 [4270] +releng/auto_printsize +Made releng/auto_printsize ready for FreeBSD ("bash" linked to /bin/sh) + +10 Aug 2010 [4271] +releng/manual_isojigdo +Made releng/manual_isojigdo ready for FreeBSD ("bash" linked to /bin/sh) + +10 Aug 2010 [4272] +releng/run_all_auto +Made releng/run_all_auto ready for FreeBSD ("bash" linked to /bin/sh) + +10 Aug 2010 [4273] +releng/run_all_auto +Added some newlines to output of releng/run_all_auto + +11 Aug 2011 [4274] +releng/manual_burn +releng/manual_devices +releng/README +Option --priv_cmd for releng/manual_burn and releng/manual_devices + +14 Aug 2011 [4275] +releng/run_all_auto +Avoided use of "let" in releng/run_all_auto in favor of "expr" + +14 Aug 2011 [4276] +releng/README +releng/change_shell_to_use +Opportunity to choose the shell that runs the releng test scripts + +14 Aug 2011 [4277] +releng/change_shell_to_use +Changed a comment + +2011.08.15.132616 [4278] +xorriso/disk_ops.c +Bug fix: -extract_single extracted directory content + +2011.08.15.171835 [4279] +xorriso/opts_i_o.c +xorriso/read_run.c +xorriso/disk_ops.c +Bug fix: -extract was not immediately aborted if -abort_on was triggered + +17 Aug 2011 [4282] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.1.5 - 2011.08.17.163150 +* Bug fix: -extract_single extracted directory content +* Bug fix: -extract was not immediately aborted if -abort_on was triggered +* Bug fix: xorriso did not write to files in filesystems with >= 4 TB free space + +18 Aug 2011 [4283] +releng/inc/releng_getopts.inc +Made cleanup message of releng less loud + +2011.08.18.132218 [4284] +configure.ac +libisoburn/libisoburn.h +Requiring libsofs-1.1.5 now + +2011.08.18.151913 [4285] +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/lib_mgt.c +xorriso/parse_exec.c +xorriso/opts_d_h.c +xorriso/opts_i_o.c +libisoburn/libisoburn.ver +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New option -list_extras + +18 Aug 2011 [4286] +releng/auto_isocontent +Testing recording and extraction of ACLs and xattr if available + +19 Aug 2011 [4288] +releng/README +releng/TODO +Moved todo items from releng/README to releng/TODO + +19 Aug 2011 [4290] +releng/TODO +Some "pro" arguments for the disputed items in releng/TODO + +2011.08.19.110340 [4291] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page + +------------------------------------ cycle - xorriso-1.1.5 - 2011.08.19.110340 +* Bug fix: libisofs: ACL entries of groups and of user id 0 were not properly + recorded and cannot be restored +* Bug fix: libisofs: No ACLs were recorded on FreeBSD +* New option -list_extras + + +2011.08.23.104121 [4292] +xorriso/xorriso_private.h +xorriso/base_obj.c +xorriso/opts_d_h.c +xorriso/opts_i_o.c +xorriso/text_io.c +xorriso/read_run.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +New -osirrox option strict_acl + +23 Aug 2011 [4293] +releng/auto_isocontent +Made releng/auto_isocontent ready to test FreeBSD extattr + +23 Aug 2011 [4294] +releng/auto_isocontent +Made releng/auto_isocontent work on filesystems with no xattr and ACL + +23 Aug 2011 [4295] +releng/auto_isocontent +Made releng/auto_isocontent work with disabled xorriso ACL adapter + +2011.08.24.072854 [4296] +xorriso/iso_manip.c +Reporting specific libisofs error if setting of ACL fails + +2011.08.25.185950 [4297] +xorriso/xorrisoburn.h +xorriso/findjob.h +xorriso/opts_d_h.c +xorriso/iso_tree.c +xorriso/iso_manip.c +xorriso/disk_ops.c +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +New -find and -findx action list_extattr + +29 Aug 2011 [4298] +releng/auto_isocontent +Small change about Linux getfattr usage in releng/auto_isocontent + +29 Aug 2011 [4299] +releng/manual_isojigdo +Made releng/manual_isojigdo remove .iso file after failed download + +29 Aug 2011 [4300] ++ releng/jigdo-gen-md5-list ++ releng/jigdo-gen-md5-list.1 +xorriso/make_xorriso_standalone.sh +Moved jigdo-gen-md5-list of GNU xorriso into libisoburn/releng + +29 Aug 2011 [4301] +releng/manual_isojigdo +Using own jigdo-gen-md5-list to avoid restriction to Linux and FreeBSD + +30 Aug 2011 [4303] +releng/inc/releng_getopts.inc +releng/auto_isocontent +releng/README +Reacting on xorriso failure in pipe test of releng/auto_isocontent + +02 Sep 2011 [4304] +configure.ac +PKG_CHECK_MODULES test of ./configure now only with --enable-pkg-check-modules + +2011.09.03.194744 [4305] +configure.ac +xorriso/configure_ac.txt +Made PKG_CHECK_MODULES with --enable-libcdio conditional + +2011.09.20.133438 [4309] +xorriso/xorriso_eng.html +ChangeLog +xorriso/changelog.txt +Updated change log and web page + +------------------------------------ cycle - xorriso-1.1.5 - 2011.09.20.133438 +* New -osirrox option strict_acl +* libisofs: Enabled recording and restoring of extattr on FreeBSD. +* New -find and -findx action list_extattr +* Worked around a collision with Linux udev which lets device links vanish + + +21 Sep 2011 [4312] +xorriso/README_gnu_xorriso +Mentioned configure-time options for udev anti-collision waiting time + +2011.09.22.142118 [4313] +xorriso/xorriso_private.h +xorriso/xorrisoburn.h +xorriso/base_obj.c +xorriso/opts_a_c.c +xorriso/opts_d_h.c +xorriso/drive_mgt.c +Re-aquiring drives by their burn_drive_convert_fs_adr() names + +23 Sep 2011 [4314] +README +xorriso/README_gnu_xorriso +Mentioned my sysadmin workarounds to cope with udisks on Debian 6.0.2 amd64 + +23 Sep 2011 [4315] +Makefile.am +releng/README +releng/template_new +Added releng test suite to release tarball + +2011.09.23.131734 [4316] +xorriso/drive_mgt.c +Improved error message if xorriso shall open a vanished udev link + +2011.09.23.135519 [4317] +releng/manual_burn +Let releng burn test tolerate vanished udev link and wait for its re-appearance + +24 Sep 2011 [4318] +releng/README +Fixed typos in releng/README + +25 Sep 2011 [4320] +releng/README +Small corrections in releng/README + +27 Sep 2011 [4325] +svn copy -m Branching for libisoburn release 1.1.6 +http://svn.libburnia-project.org/libisoburn/trunk +http://svn.libburnia-project.org/libisoburn/branches/1.1.6 + +2011.09.27.080001 [4326] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.6 + +27 Sep 2011 [4327] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +----------------------------------- release - xorriso-1.1.4 - 2011.08.08.070301 +* Bug fix: -extract_single extracted directory content +* Bug fix: -extract was not immediately aborted if -abort_on was triggered +* Bug fix: xorriso did not write to files in filesystems with >= 4 TB free space +* Bug fix: libisofs: ACL entries of groups and of user id 0 were not properly + recorded and cannot be restored +* Bug fix: libisofs: No ACLs were recorded on FreeBSD +* New option -list_extras +* New -osirrox option strict_acl +* libisofs: Enabled recording and restoring of extattr on FreeBSD. +* New -find and -findx action list_extattr +* Workaround for collision with Linux udev which lets device links vanish + + +2011.09.27.133025 [4333] +configure.ac +README +libisoburn/libisoburn.h +xorriso/README_gnu_xorriso +xorriso/xorriso.h +xorriso/xorrisoburn.h +xorriso/xorriso_main.c +xorriso/xorriso_eng.html +xorriso/make_xorriso_standalone.sh +xorriso/configure_ac.txt +xorriso/xorriso_timestamp.h +xorriso/xorriso.texi +xorriso/xorriso.1 +xorriso/xorriso.info +xorriso/xorrisofs.texi +xorriso/xorrisofs.1 +xorriso/xorrisofs.info +Version leap to libisoburn-1.1.7 + +27 Sep 2011 [] +ChangeLog +xorriso/changelog.txt +Documented changes and release timestamp + +------------------------------------ cycle - xorriso-1.1.7 - 2011.09.27.133025 + + [] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page +------------------------------------ cycle - xorriso-1.1.7 - + + + [] +xorriso/xorriso_eng.html +ChangeLog +Updated change log and web page +------------------------------------ cycle - xorriso-1.1.7 - + + +********************************************************************** +Important: When adding a public API function then add its name to file + libisoburn/libisoburn.ver +********************************************************************** + +=============================================================================== + TODO +=============================================================================== + +- libisofs: Dynamic hand-out of filesystem id number for user streams + and registration of a type string. + Deprecate global variable serial_id. + demo/custom_stream.c + +- update_home got stuck when interrupted during -update_r + ??? not reproducible any more + + +------------------------------------------------------------------------- + +- Problem words in man xorriso + +"command" - Mats wants to reserve it for the program. + I still think it should stay for its options. + +"writeable" - Should be "writable" but is allowed as alternative spelling. + Problem with -as cdrecord option --grow_overwriteable_iso + +"allow" - "allow to do something" is wrong english. + Current favorite: "allow for something [to happen]" + Seems legal, and seems to match the intended meaning. + +"modifying" - was not mentioned yet. + I made several attempts to find a better name for the + method of copying an ISO image from one media to another + while manipulating it. + This is in contrast to "growing" where a new session gets + appended to the same media where the input image resides. + (The term stems from Vreixo Formoso, original author of + libisofs.) + +I propose we decide now: +That "writeable" shall stay as it is. +That "allow" gets changed from "to do something" to "for [doing] something". +(It turned out that only a minority of "allow" in the text are of the bad + form.) + +The issue of "command" versus "option" needs an overview of the whole +terminology in xorriso. I shall make a tree model. + +- Get rid of ((size_t) -1) in libisofs/util.c + +- Make Debian test machine ready for cppcheck and add it to release procedure + +- ? Allow to adjust maximum path length + +- Is libisofs rockridge.c safe for >250 chars in all cases ? + Can NM be entirely in Continuation Area ? + - It should be safe. The free SUA before NM is larger than 10. + With untranslated_names=96: no long RR names are possible + With long_names : >= 254 - 34-37-1 - 5-5-44-26-20 = 82 + +- Is it possible to allow longer Rock Ridge names ? + - need a loop to calc and to call rrip_add_NM() + +- xorrecord.texi , man_1_xorrecord.html + + +------------------------------------------------- For Debian: + +- Need specs for the exotic boot options + -mips-boot is implemented + - recognize at load time and build boot file list + -mipsel-boot is implemented + - recognize at load time and build boot file list + -sparc-boot is implemented + - recognize at load time + -chrp-boot + - needs HFS + - where to get specs ? + +------------------------------------------------- For Solaris + +(The mount command needs to be adapted to Solaris. + But currently there is no sector address option with mount.) + + +------------------------------------------------- For GRUB + +- multi-boot management + libisofs: + - replace memory buffered boot images by filtered streams + - in eltorito_writer_compute_data_blocks(): + from iso_memory_stream_new() to some filter contraption + with memorized first block and reading the rest from stream. + - let patch_boot_image() read directly from stream + (filtered or unfiltered should make no difference for the + checksum) + - warn that multiple boot images work only if they stem from + distinct disk files + +------------------------------------------------- FreeBSD + +- Examine and replay: + http://wiki.freebsd.org/AvgLiveCD + + - looks ok now: + mkisofs -R -l -ldots -allow-lowercase -allow-multidot \ + -V 'My FreeBSD' -volset 'My FreeBSDs' \ + -hide boot.catalog -o ../R.iso -no-emul-boot \ + -b boot/cdboot . + + + - try + qemu -m 256 -cdrom /tmp/R.iso -boot d + >>> does not do anything recognizable. Not even fails. + +------------------------------------------------- bugs + +- xorriso_eng.html on www.gnu.org it should rather be xorriso.html + +- DVD-ROM drives report CD tracks with size up to the next track start. + Why ? -> libburn + Eventually restrict -check_media to ISO image size ? + +- make iso_init() and iso_finish() safe against multiple calls + from multiple threads. + +- what about split files and hard links ? + +- xorriso -as cdrecord in rare cases reports intermediate "X of X MB" +xorriso : UPDATE : 3671 MB written (fifo 94%) [buf 100%] 2.3x. +xorriso : UPDATE : 3680 of 3680 MB written (fifo 87%) [buf 100%] 2.3x. +xorriso : UPDATE : 3691 MB written (fifo 78%) [buf 100%] 2.3x. + Direct reason: + burn_drive_get_status(drive, &progress); + if(progress.sector<=progress.sectors) + sprintf(xorriso->info_text, "%4d of %4d MB written", + So this has to be examined in libburn. + +------------------------------------------------- important + + +- introduce a read offset for displaced ISO images + - coordinate -displacement with image growing + +- improve find action estimate_size. + - take into account indispensible RR and eventual Joliet stuff + - take into account the eventual file checksums. + +- Mark data blocks of -check_md5 matching files as valid in sector map ? + +- tree of name nodes to represent the cached paths of hardlink candidates. + +- register hard link disk path for files with link count 1 + and allow in Xorriso_restore_target_hl() to use the own hln_target of + a node when that node is copied to disk a second time. + +- libisofs call to create a hard link ? + +- during -update* + - what about differently filtered streams ? + It is not wrong but a waste to update them as siblings. + +- one-time delimiter which overrides -list_delimiter for only the + next command. + E.g. for --back_to_xorriso in emulations + + + +- sudo and setuid chapter in man page + ? option -sudo_aware + +??? move suffix processing into libisofs ? + (currently the suffice are already stored in the filter chain) + Can only be done if renaming is made safe with any open IsoDirIter. + + +------------------------------------------------- development + +- Special pseudo ACL: "--remove-default" + +- libisofs , libburn , own system adapter ? : + Needed is a system dependend facility: dev_t <-> major, minor + +- ??? -getfaclx , -getfattrx + +- -load option to ignore existing images + +- random access read and write option + +- option to patch the mount image size and location on overwriteables + +- change -check_media what=disc to libburn disc rather than libisoburn + (seems to need new API capabilities of libburn) + +??? Clarify handling of links in ISO and on disk during restore + +> Relative addressing and pattern matching : + iso_rr_pattern on + cd /u/FERTIG + lsd nonexist/.. + +- perform any long lasting operation in separate threads while + the main thread cares for user and message queues. + +- Introduce an interrupt key for dialog + >>> but how without disturbing readline ? + +- regularly do valgrind check for memory leaks + +- ??? http://scan.coverity.com/faq.html + +- ??? curb depth of tree traversal recursion + +- eject a not yet aquired device (e.g. after modifying commit) + +- -cd[ix] and pattern + +- memory curb for image model + + +> Make transactional the tree deletions meant for replacing + + +------------------------------------------------- libisofs wishes + +------ problem fixes : + +- the error handling system should be comprehensively documented + and eventually rectified where needed. + +- the iterators are still not safe with node renamings: + iso_dir_get_children(...); + while(...) { + iso_dir_iter_next(...); + ... iso_node_get_name() returns "xyz" ... + iso_node_set_name("xyz.gz"); + ... iso_file_add_external_filter() returns 2 ... + iso_node_set_name("xyz"); + } + +------ feature enhancements : + +- With 100,000 files in a single directory, adding new nodes becomes + very slow with high workload. + Some hash accelerator would be nice. + + +- Re-use unchanged sub trees in the previous image in order to + reduce the session overhead. + + + +=============================================================================== + This is the dirty end of the todo list. + The recent changelog entries are above the headline "TODO". +=============================================================================== diff --git a/libisoburn/branches/1.1.8/xorriso/check_media.c b/libisoburn/branches/1.1.8/xorriso/check_media.c new file mode 100644 index 00000000..05fb0b3e --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/check_media.c @@ -0,0 +1,1115 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the implementation of classes SpotlistiteM, SectorbitmaP, + CheckmediajoB which perform verifying runs on media resp. images. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* ------------------------------ SpotlisT -------------------------------- */ + + +struct SpotlistiteM { + int start_lba; + int blocks; + int quality; + struct SpotlistiteM *next; +}; + + +int Spotlistitem_new(struct SpotlistiteM **o, int start_lba, int blocks, + int quality, int flag) +{ + struct SpotlistiteM *m; + + m= TSOB_FELD(struct SpotlistiteM,1); + if(m==NULL) + return(-1); + *o= m; + m->start_lba= start_lba; + m->blocks= blocks; + m->quality= quality; + m->next= NULL; + return(1); +} + + +int Spotlistitem_destroy(struct SpotlistiteM **o, int flag) +{ + if((*o) == NULL) + return(0); + free((char *) *o); + *o= NULL; + return(1); +} + + +struct SpotlisT { + struct SpotlistiteM *list_start; + struct SpotlistiteM *list_end; + int list_count; + struct SpotlistiteM *current_item; + int current_idx; +}; + + +int Spotlist_new(struct SpotlisT **o, int flag) +{ + struct SpotlisT *m; + + m= TSOB_FELD(struct SpotlisT,1); + if(m==NULL) + return(-1); + *o= m; + m->list_start= NULL; + m->list_end= NULL; + m->list_count= 0; + m->current_item= NULL; + m->current_idx= -1; + return(1); +} + + +int Spotlist_destroy(struct SpotlisT **o, int flag) +{ + struct SpotlisT *m; + struct SpotlistiteM *li, *next_li; + + if((*o) == NULL) + return(0); + m= *o; + for(li= m->list_start; li != NULL; li= next_li) { + next_li= li->next; + Spotlistitem_destroy(&li, 0); + } + free((char *) *o); + *o= NULL; + return(1); +} + + +int Spotlist_add_item(struct SpotlisT *o, int start_lba, int blocks, + int quality, int flag) +{ + int ret; + struct SpotlistiteM *li; + static int debug_verbous= 0; + + ret= Spotlistitem_new(&li, start_lba, blocks, quality, 0); + if(ret <= 0) + return(ret); + if(o->list_end != NULL) + o->list_end->next= li; + o->list_end= li; + if(o->list_start == NULL) + o->list_start= li; + (o->list_count)++; + + if(debug_verbous) {char quality_name[80]; + fprintf(stderr, "debug: lba %10d , size %10d , quality '%s'\n", + start_lba, blocks, Spotlist__quality_name(quality, quality_name, + Xorriso_read_quality_invaliD, 0) + 2); + } + + return(1); +} + + +int Spotlist_count(struct SpotlisT *o, int flag) +{ + return o->list_count; +} + + +int Spotlist_block_count(struct SpotlisT *o, int flag) +{ + int list_blocks= 0; + struct SpotlistiteM *li; + + for(li= o->list_start; li != NULL; li= li->next) { + if(li->start_lba + li->blocks > list_blocks) + list_blocks= li->start_lba + li->blocks; + } + return(list_blocks); +} + + +int Spotlist_sector_size(struct SpotlisT *o, int read_chunk, int flag) +{ + int sector_size; + struct SpotlistiteM *li; + + sector_size= read_chunk * 2048; + for(li= o->list_start; li != NULL; li= li->next) { + if((li->start_lba % read_chunk) || (li->blocks % read_chunk)) { + sector_size= 2048; + break; + } + } + return(sector_size); +} + + +int Spotlist_get_item(struct SpotlisT *o, int idx, + int *start_lba, int *blocks, int *quality, int flag) +{ + int i; + struct SpotlistiteM *li; + + if(idx < 0 || idx > o->list_count) + return(0); + if(idx == o->current_idx && o->current_item != NULL) + li= o->current_item; + else if(idx == o->current_idx + 1 && o->current_item != NULL) { + li= o->current_item->next; + } else { + li= o->list_start; + for(i= 0; i < idx; i++) + li= li->next; + } + o->current_item= li; + o->current_idx= idx; + *start_lba= li->start_lba; + *blocks= li->blocks; + *quality= li->quality; + return(1); +} + + +char *Spotlist__quality_name(int quality, char name[80], int bad_limit, + int flag) +{ + if(quality == Xorriso_read_quality_untesteD || + quality == Xorriso_read_quality_tao_enD || + quality == Xorriso_read_quality_off_tracK) + strcpy(name, "0 "); + else if(quality <= bad_limit) + strcpy(name, "- "); + else + strcpy(name, "+ "); + if(quality == Xorriso_read_quality_gooD) + strcat(name, "good"); + else if(quality == Xorriso_read_quality_md5_matcH) + strcat(name, "md5_match"); + else if(quality == Xorriso_read_quality_sloW) + strcat(name, "slow"); + else if(quality == Xorriso_read_quality_partiaL) + strcat(name, "partial"); + else if(quality == Xorriso_read_quality_valiD) + strcat(name, "valid"); + else if(quality == Xorriso_read_quality_untesteD) + strcat(name, "untested"); + else if(quality == Xorriso_read_quality_invaliD) + strcat(name, "invalid"); + else if(quality == Xorriso_read_quality_tao_enD) + strcat(name, "tao_end"); + else if(quality == Xorriso_read_quality_off_tracK) + strcat(name, "off_track"); + else if(quality == Xorriso_read_quality_md5_mismatcH) + strcat(name, "md5_mismatch"); + else if(quality == Xorriso_read_quality_unreadablE) + strcat(name, "unreadable"); + else + sprintf(name, "0 0x%8.8X", (unsigned int) quality); + return(name); +} + + +/* ---------------------------- End SpotlisT ------------------------------ */ + +/* ---------------------------- SectorbitmaP ------------------------------ */ + +int Sectorbitmap_new(struct SectorbitmaP **o, int sectors, int sector_size, + int flag) +{ + struct SectorbitmaP *m; + + m= TSOB_FELD(struct SectorbitmaP,1); + if(m==NULL) + return(-1); + *o= m; + m->sectors= sectors; + m->sector_size= sector_size; + m->map= NULL; + m->map_size= sectors / 8 + 1; + + m->map= calloc(m->map_size, 1); + if(m->map == NULL) + goto failure; + return(1); +failure:; + Sectorbitmap_destroy(o, 0); + return(-1); +} + + +int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag) +{ + if((*o) == NULL) + return(0); + if((*o)->map != NULL) + free((char *) (*o)->map); + free((char *) *o); + *o= NULL; + return(1); +} + + +int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg, + int *os_errno, int flag) +{ + int ret, fd= -1, sectors, sector_size, i, todo, map_size, skip; + unsigned char *map; + unsigned char *buf; + + buf= TSOB_FELD(unsigned char, 1024); + if(buf == NULL) + return(-1); + + *os_errno= 0; + if(msg != NULL) + msg[0]= 0; + fd= open(path, O_RDONLY); + if(fd == -1) { + *os_errno= errno; + if(msg != NULL) { + strcpy(msg, "Cannot open path "); + Text_shellsafe(path, msg+strlen(msg), 0); + } + {ret= 0; goto ex;} + } + ret= read(fd, buf, 32); + if(ret < 32) { +wrong_filetype:; + if(ret == -1) + *os_errno= errno; + if(msg != NULL) { + strcpy(msg, "Not a sector bitmap file: "); + Text_shellsafe(path, msg+strlen(msg), 0); + } + ret= 0; goto ex; + } + if(strncmp((char *) buf, "xorriso sector bitmap v1 ", 32) == 0) + /* ok */; + else if(strncmp((char *) buf, "xorriso sector bitmap v2 ", 25) == 0) { + skip= -1; + sscanf(((char *) buf) + 25, "%d", &skip); + if(skip < 0) + {ret= 0; goto wrong_filetype;} + for(i= 0; i < skip; i+= sizeof(buf)) { + todo= sizeof(buf); + if(i + todo > skip) + todo= skip - i; + ret= read(fd, buf, todo); + if(ret < todo) + goto wrong_filetype; + } + } else + {ret= 0; goto wrong_filetype;} + ret= read(fd, buf, 8); + if(ret < 4) + goto wrong_filetype; + sectors= (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; + sector_size= (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]; + if(sectors <= 0 || sector_size <= 0) + goto wrong_filetype; + ret= Sectorbitmap_new(o, sectors, sector_size, 0); + if(ret <= 0) { + if(msg != NULL) + sprintf(msg, "Cannot allocate bitmap memory for %d sectors", sectors); + ret= -1; goto ex; + } + map= (*o)->map; + map_size= (*o)->map_size; + for(i= 0; i < map_size; i+= sizeof(buf)) { + todo= sizeof(buf); + if(i + todo > map_size) + todo= map_size - i; + ret= read(fd, buf, todo); + if(ret != todo) + goto wrong_filetype; + memcpy(map + i, buf, todo); + } + ret= 1; +ex:; + if(fd != -1) + close(fd); + if(buf != NULL) + free(buf); + if(ret <= 0) + Sectorbitmap_destroy(o, 0); + return(ret); +} + + +int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *info, + char *msg, int *os_errno, int flag) +{ + int ret, fd= -1, j, l; + unsigned char buf[40]; + + *os_errno= 0; + fd= open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + if(fd == -1) { + *os_errno= errno; + if(msg != NULL) { + strcpy(msg, "Cannot open path "); + Text_shellsafe(path, msg+strlen(msg), 0); + } + return(0); + } + + l= 0; + if(info != NULL) + l= strlen(info); + if(l > 999999) { + strcpy(msg, "Info string is longer than 999999 bytes"); + return(0); + } + sprintf((char *) buf, "xorriso sector bitmap v2 %-6d\n", l); + + ret= write(fd, buf, 32); + if(ret != 32) { +cannot_write:; + *os_errno= errno; + if(msg != NULL) { + strcpy(msg, "Cannot write to "); + Text_shellsafe(path, msg+strlen(msg), 0); + } + ret= 0; goto ex; + } + if(l > 0) { + ret= write(fd, info, l); + if(ret != l) + goto cannot_write; + } + + for(j= 0; j < 4; j++) { + buf[j]= o->sectors >> (24 - j * 8); + buf[j+4]= o->sector_size >> (24 - j * 8); + } + ret= write(fd, buf, 8); + if(ret != 8) + goto cannot_write; + ret= write(fd, o->map, o->map_size); + if(ret != o->map_size) + goto cannot_write; + + ret= 1; +ex:; + if(fd != -1) + close(fd); + return(ret); +} + + +/* @param flag bit0= sector bit value +*/ +int Sectorbitmap_set(struct SectorbitmaP *o, int sector, int flag) +{ + if(sector < 0 || sector >= o->sectors) + return(0); + if(flag & 1) + o->map[sector / 8]|= 1 << (sector % 8); + else + o->map[sector / 8]&= ~(1 << (sector % 8)); + return(1); +} + + +/* @param flag bit0= sector bit value +*/ +int Sectorbitmap_set_range(struct SectorbitmaP *o, + int start_sector, int sectors, int flag) +{ + int start_i, end_i, i; + unsigned char value; + + if(start_sector < 0 || start_sector + sectors > o->sectors || sectors < 1) + return(0); + if(flag & 1) + value= ~0; + else + value= 0; + start_i= start_sector / 8; + end_i= (start_sector + sectors - 1) / 8; + for(i= start_sector; i / 8 == start_i && i < start_sector + sectors; i++) + Sectorbitmap_set(o, i, flag & 1); + for(i= start_i + 1; i < end_i; i++) + o->map[i]= value; + if(end_i > start_i) + for(i= end_i * 8; i < start_sector + sectors; i++) + Sectorbitmap_set(o, i, flag & 1); + return(1); +} + + +int Sectorbitmap_is_set(struct SectorbitmaP *o, int sector, int flag) +{ + if(sector < 0 || sector >= o->sectors) + return(0); + return(!! (o->map[sector / 8] & (1 << (sector % 8)))); +} + + +int Sectorbitmap_bytes_are_set(struct SectorbitmaP *o, + off_t start_byte, off_t end_byte, int flag) +{ + int end_sector, i; + + end_sector= end_byte / o->sector_size; + for(i= start_byte / o->sector_size; i <= end_sector; i++) + if(!Sectorbitmap_is_set(o, i, 0)) + return(0); + return(1); +} + + +int Sectorbitmap_get_layout(struct SectorbitmaP *o, + int *sectors, int *sector_size, int flag) +{ + *sectors= o->sectors; + *sector_size= o->sector_size; + return(1); +} + + +int Sectorbitmap_copy(struct SectorbitmaP *from, struct SectorbitmaP *to, + int flag) +{ + int i, run_start, run_value, start_sec, limit_sec, start_aligned; + int end_complete; + + if(((off_t) from->sectors) * ((off_t) from->sector_size) > + ((off_t) to->sectors) * ((off_t) to->sector_size)) + return(-1); + if(from->sector_size == to->sector_size) { + for(i= 0; i < from->map_size; i++) + to->map[i]= from->map[i]; + return(1); + } + run_start= 0; + run_value= Sectorbitmap_is_set(from, 0, 0); + for(i= 1; i <= from->sectors; i++) { + if(i < from->sectors) + if(Sectorbitmap_is_set(from, i, 0) == run_value) + continue; + start_sec= run_start * from->sector_size / to->sector_size; + start_aligned= + (start_sec * to->sector_size == run_start * from->sector_size); + limit_sec= i * from->sector_size / to->sector_size; + end_complete= (limit_sec * to->sector_size == i * from->sector_size); + if(run_value) { + if(!start_aligned) + start_sec++; + } else { + if(!end_complete) + limit_sec++; + } + if(start_sec < limit_sec) + Sectorbitmap_set_range(to, start_sec, limit_sec - 1 - start_sec, + !!run_value); + run_value= !run_value; + run_start= i; + } + return(1); +} + + +int Sectorbitmap_clone(struct SectorbitmaP *from, struct SectorbitmaP **clone, + int flag) +{ + int ret; + + ret= Sectorbitmap_new(clone, from->sectors, from->sector_size, 0); + if(ret <= 0) + return(ret); + ret= Sectorbitmap_copy(from, *clone, 0); + if(ret <= 0) + Sectorbitmap_destroy(clone, 0); + return(ret); +} + + +/* -------------------------- End SectorbitmaP ---------------------------- */ + +/* ---------------------------- CheckmediajoB ----------------------------- */ + +int Checkmediajob_new(struct CheckmediajoB **o, int flag) +{ + struct CheckmediajoB *m; + + m= TSOB_FELD(struct CheckmediajoB,1); + if(m==NULL) + return(-1); + *o= m; + m->use_dev= 0; + m->min_lba= -1; + m->max_lba= -1; + m->min_block_size= 0; + m->mode= 0; + m->start_time= time(NULL); + m->time_limit= 28800; + m->item_limit= 100000; + strcpy(m->abort_file_path, "/var/opt/xorriso/do_abort_check_media"); + m->data_to_path[0]= 0; + m->data_to_fd= -1; + m->data_to_offset= 0; + m->data_to_limit= -1; + m->patch_lba0= 0; + m->patch_lba0_msc1= -1; + m->sector_map_path[0]= 0; + m->sector_map= NULL; + m->map_with_volid= 0; + m->retry= 0; + m->report_mode= 0; + strcpy(m->event_severity, "ALL"); + m->slow_threshold_seq= 1.0; + m->untested_valid= 0; + return(1); +} + + +int Checkmediajob_destroy(struct CheckmediajoB **o, int flag) +{ + if((*o) == NULL) + return(0); + if((*o)->data_to_fd != -1) + close((*o)->data_to_fd); + Sectorbitmap_destroy(&((*o)->sector_map), 0); + free((char *) *o); + *o= NULL; + return(1); +} + + +int Checkmediajob_copy(struct CheckmediajoB *from, struct CheckmediajoB *to, + int flag) +{ + to->use_dev= from->use_dev; + to->min_lba= from->min_lba; + to->max_lba= from->max_lba; + to->min_block_size= from->min_block_size; + to->mode= from->mode; + to->time_limit= from->time_limit; + to->item_limit= from->item_limit; + strcpy(to->abort_file_path, from->abort_file_path); + strcpy(to->data_to_path, from->data_to_path); + /* not copied: data_to_fd */ + to->data_to_offset= from->data_to_offset; + to->data_to_limit= from->data_to_limit; + to->patch_lba0= from->patch_lba0; + to->patch_lba0_msc1= from->patch_lba0_msc1; + strcpy(to->sector_map_path, from->sector_map_path); + /* not copied: sector_map */ + to->map_with_volid= from->map_with_volid; + to->retry= from->retry; + to->report_mode= from->report_mode; + strcpy(to->event_severity, from->event_severity); + to->slow_threshold_seq= from->slow_threshold_seq; + to->untested_valid= from->untested_valid; + return(1); +} + + +/* -------------------------- End CheckmediajoB --------------------------- */ + + +int Xorriso_check_media_setup_job(struct XorrisO *xorriso, + struct CheckmediajoB *job, + char **argv, int old_idx, int end_idx, int flag) +{ + int ret, i, sev; + double num; + struct CheckmediajoB *default_job; + char sev_text[20]; + + if(xorriso->check_media_default != NULL) + Checkmediajob_copy(xorriso->check_media_default, job, 0); + for(i= old_idx; i < end_idx; i++) { + if(strncmp(argv[i], "abort_file=", 11) == 0) { + ret= Sfile_str(job->abort_file_path, argv[i] + 11, 0); + if(ret <= 0) + goto ex; + } else if(strncmp(argv[i], "bad_limit=", 10) == 0) { + if(strcmp(argv[i] + 10, "good") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_gooD; + else if(strcmp(argv[i] + 10, "md5_match") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_md5_matcH; + else if(strcmp(argv[i] + 10, "slow") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_sloW; + else if(strcmp(argv[i] + 10, "partial") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_partiaL; + else if(strcmp(argv[i] + 10, "valid") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_valiD; + else if(strcmp(argv[i] + 10, "untested") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_untesteD; + else if(strcmp(argv[i] + 10, "invalid") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_invaliD; + else if(strcmp(argv[i] + 10, "tao_end") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_tao_enD; + else if(strcmp(argv[i] + 10, "off_track") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_off_tracK; + else if(strcmp(argv[i] + 10, "md5_mismatch") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_md5_mismatcH; + else if(strcmp(argv[i] + 10, "unreadable") == 0) + xorriso->check_media_bad_limit= Xorriso_read_quality_unreadablE; + else + goto unknown_value; + } else if(strncmp(argv[i], "data_to=", 8) == 0) { + ret= Sfile_str(job->data_to_path, argv[i] + 8, 0); + if(ret <= 0) + goto ex; + } else if(strncmp(argv[i], "chunk_size=", 11) == 0) { + num= Scanf_io_size(argv[i] + 11, 1); + if(num >= 2048 || num == 0) + job->min_block_size= num / 2048; + else + goto unknown_value; + } else if(strncmp(argv[i], "event=", 6) == 0) { + strncpy(sev_text, argv[i] + 6, 19); + sev_text[19]= 0; + ret= Xorriso__text_to_sev(sev_text, &sev, 0); + if(ret <= 0) { + strcpy(xorriso->info_text, "-check_media event="); + Text_shellsafe(sev_text, xorriso->info_text, 1); + strcat(xorriso->info_text, " : Not a known severity name"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + strcpy(job->event_severity, sev_text); + } else if(strncmp(argv[i], "map_with_volid=", 15) == 0) { + if(strcmp(argv[i] + 15, "on") == 0) + job->map_with_volid= 1; + else if(strcmp(argv[i] + 15, "off") == 0) + job->map_with_volid= 0; + else + goto unknown_value; + } else if(strncmp(argv[i], "max_lba=", 8) == 0 || + strncmp(argv[i], "min_lba=", 8) == 0) { + num= -1; + sscanf(argv[i] + 8, "%lf", &num); + if(num > 0x7fffffff || num < 0) + num= -1; + if(strncmp(argv[i], "max_lba=", 8) == 0) + job->max_lba= num; + else + job->min_lba= num; + } else if(strncmp(argv[i], "patch_lba0=", 11) == 0) { + job->patch_lba0_msc1= -1; + if(strcmp(argv[i] + 11, "on") == 0) + job->patch_lba0= 1; + else if(strcmp(argv[i] + 11, "off") == 0) + job->patch_lba0= 0; + else if(strcmp(argv[i] + 11, "force") == 0) + job->patch_lba0= 2; + else if(argv[i][11] >= '1' && argv[i][11] <= '9') { + num= -1; + sscanf(argv[i] + 11, "%lf", &num); + if(num > 0x7fffffff || num < 0) + goto unknown_value; + job->patch_lba0_msc1= num; + job->patch_lba0= (num >= 32) + (strstr(argv[i] + 11, ":force") != NULL); + } else + goto unknown_value; + } else if(strncmp(argv[i], "report=", 7) == 0) { + if(strcmp(argv[i] + 7, "blocks") == 0) + job->report_mode= 0; + else if(strcmp(argv[i] + 7, "files") == 0) + job->report_mode= 1; + else if(strcmp(argv[i] + 7, "blocks_files") == 0) + job->report_mode= 2; + else + goto unknown_value; + } else if(strcmp(argv[i], "reset=now") == 0) { + ret= Checkmediajob_new(&default_job, 0); + if(ret <= 0) { + sprintf(xorriso->info_text, + "-check_media: Cannot reset options due to lack of resources"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= -1; goto ex; + } + Checkmediajob_copy(default_job, job, 0); + Checkmediajob_destroy(&default_job, 0); + xorriso->check_media_bad_limit= Xorriso_read_quality_invaliD; + } else if(strncmp(argv[i], "retry=", 6) == 0) { + if(strcmp(argv[i] + 6, "on") == 0) + job->retry= 1; + else if(strcmp(argv[i] + 6, "off") == 0) + job->retry= -1; + else if(strcmp(argv[i] + 6, "default") == 0) + job->retry= 0; + else + goto unknown_value; + } else if(strncmp(argv[i], "sector_map=", 11) == 0) { + ret= Sfile_str(job->sector_map_path, argv[i] + 11, 0); + if(ret <= 0) + goto ex; + } else if(strncmp(argv[i], "slow_limit=", 11) == 0) { + sscanf(argv[i] + 11, "%lf", &(job->slow_threshold_seq)); + } else if(strncmp(argv[i], "time_limit=", 11) == 0 || + strncmp(argv[i], "item_limit=", 11) == 0 ) { + num= -1; + sscanf(argv[i] + 11, "%lf", &num); + if(num > 0x7fffffff || num < 0) + num= -1; + if(strncmp(argv[i], "time_limit=", 11) == 0) + job->time_limit= num; + else + job->item_limit= num; + +#ifdef NIX + } else if(strncmp(argv[i], "untested=", 9) == 0) { + if(strcmp(argv[i] + 9, "damaged") == 0) + job->untested_valid= 0; + if(strcmp(argv[i] + 9, "undamaged") == 0 || + strcmp(argv[i] + 9, "ok") == 0) + job->untested_valid= 1; + else + goto unknown_value; +#endif + + } else if(strncmp(argv[i], "use=", 4) == 0) { + if(strcmp(argv[i] + 4, "outdev") == 0) + job->use_dev= 1; + else if(strcmp(argv[i] + 4, "indev") == 0) + job->use_dev= 0; + else if(strcmp(argv[i] + 4, "sector_map") == 0) + job->use_dev= 2; + else + goto unknown_value; + } else if(strncmp(argv[i], "what=", 5) == 0) { + if(strcmp(argv[i]+5, "tracks") == 0) + job->mode= 0; + else if(strcmp(argv[i]+5, "image")== 0) + job->mode= 1; + else if(strcmp(argv[i]+5, "disc")== 0) + job->mode= 2; + else { +unknown_value:; + sprintf(xorriso->info_text, + "-check_media: Unknown value with option %s", argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else { + sprintf(xorriso->info_text, "-check_media: Unknown option '%s'", argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + ret= 1; +ex:; + return(ret); +} + + +/* @param report Buffer of at least 10*SfileadrL + @param flag bit0= only report non-default settings + @return <=0 error , 1 ok , 2 with bit0: every option is on default setting +*/ +int Xorriso_check_media_list_job(struct XorrisO *xorriso, + struct CheckmediajoB *job, + char *report, int flag) +{ + int all, ret; + char *default_report= NULL, quality_name[80]; + struct CheckmediajoB *dflt= NULL; + + Xorriso_alloc_meM(default_report, char, 161); + + all= !(flag&1); + report[0]= 0; + ret= Checkmediajob_new(&dflt, 0); + if(ret <= 0) + {ret= -1; goto ex;} + sprintf(report, "-check_media_defaults"); + if(!all) + strcat(report, " reset=now"); + if(all || job->use_dev != dflt->use_dev) + sprintf(report + strlen(report), " use=%s", + job->use_dev == 1 ? "outdev" : + job->use_dev == 2 ? "sector_map" : "indev"); + if(all || job->mode != dflt->mode) + sprintf(report + strlen(report), " what=%s", + job->mode == 1 ? "disc" : "tracks"); + if(all || job->min_lba != dflt->min_lba) + sprintf(report + strlen(report), " min_lba=%d", job->min_lba); + if(all || job->max_lba != dflt->max_lba) + sprintf(report + strlen(report), " max_lba=%d", job->max_lba); + if(all || job->retry != dflt->retry) + sprintf(report + strlen(report), " retry=%s", + job->retry == 1 ? "on" : job->retry == -1 ? "off" : "default"); + if(all || job->time_limit != dflt->time_limit) + sprintf(report + strlen(report), " time_limit=%d", job->time_limit); + if(all || job->item_limit != dflt->item_limit) + sprintf(report + strlen(report), " item_limit=%d", job->item_limit); + if(all || strcmp(job->abort_file_path, dflt->abort_file_path)) { + strcat(report, " abort_file="); + Text_shellsafe(job->abort_file_path, report + strlen(report), 0); + } + if(strlen(report) > 4 * SfileadrL) + {ret= 0; goto ex;} + if(all || strcmp(job->data_to_path, dflt->data_to_path)) { + strcat(report, " data_to="); + Text_shellsafe(job->data_to_path, report + strlen(report), 0); + } + if(strlen(report) > 4 * SfileadrL) + {ret= 0; goto ex;} + if(all || strcmp(job->sector_map_path, dflt->sector_map_path)) { + strcat(report, " sector_map="); + Text_shellsafe(job->sector_map_path, report + strlen(report), 0); + } + if(all || job->map_with_volid != dflt->map_with_volid) + sprintf(report + strlen(report), " map_with_volid=%s", + job->map_with_volid == 1 ? "on" : "off"); + if(all || job->patch_lba0 != dflt->patch_lba0) { + sprintf(report + strlen(report), " patch_lba0="); + if(job->patch_lba0 == 0) + sprintf(report + strlen(report), "off"); + else if(job->patch_lba0_msc1 >= 0) + sprintf(report + strlen(report), "%d%s", + job->patch_lba0_msc1, job->patch_lba0 == 2 ? ":force" : ""); + else + sprintf(report + strlen(report), "%s", + job->patch_lba0 == 2 ? "force" : "on"); + } + if(all || job->report_mode != dflt->report_mode) + sprintf(report + strlen(report), " report=%s", + job->report_mode == 0 ? "blocks" : + job->report_mode == 1 ? "files" : "blocks_files"); + if(all || job->slow_threshold_seq != dflt->slow_threshold_seq) + sprintf(report + strlen(report), " slow_limit=%f", job->slow_threshold_seq); + if(all || xorriso->check_media_bad_limit != Xorriso_read_quality_invaliD) + sprintf(report + strlen(report), " bad_limit=%s", + Spotlist__quality_name(xorriso->check_media_bad_limit, quality_name, + Xorriso_read_quality_invaliD, 0) + 2); + if(all || job->min_block_size != dflt->min_block_size) + sprintf(report + strlen(report), " chunk_size=%ds", job->min_block_size); + if(all || strcmp(job->event_severity, "ALL") != 0) + sprintf(report + strlen(report), " event=%s", job->event_severity); + if(strlen(report) > 4 * SfileadrL) + {ret= 0; goto ex;} + ret= 1; +ex:; + strcat(report, " "); + strcat(report, xorriso->list_delimiter); + Checkmediajob_destroy(&dflt, 0); + sprintf(default_report, "-check_media_defaults reset=now %s", + xorriso->list_delimiter); + Xorriso_free_meM(default_report); + if(ret > 0 && strcmp(report, default_report) == 0) + return(2); + return(ret); +} + + +int Xorriso_sectormap_to_spotlist(struct XorrisO *xorriso, + struct CheckmediajoB *job, + struct SpotlisT **spotlist, + int flag) +{ + struct SectorbitmaP *map; + int ret, i, sectors, sector_size, value, old_value= -1, old_start= -1; + + map= job->sector_map; + if(map == NULL) + return(-1); + ret= Spotlist_new(spotlist, 0); + if(ret <= 0) + {ret= -1; goto ex;} + Sectorbitmap_get_layout(map, §ors, §or_size, 0); + sector_size/= 2048; + if(job->max_lba >= 0) + sectors= (job->max_lba + 1) / sector_size; + i= 0; + if(job->min_lba >= 0) + i= job->min_lba / sector_size; + for(; i < sectors; i++) { + value= Sectorbitmap_is_set(map, i, 0); + if(value == old_value) + continue; + if(old_value >= 0) { + ret= Spotlist_add_item(*spotlist, old_start, i * sector_size - old_start, + (old_value ? Xorriso_read_quality_valiD : + Xorriso_read_quality_invaliD), 0); + if(ret <= 0) + goto ex; + if(job->item_limit > 0 && + Spotlist_count(*spotlist, 0) + 1 >= job->item_limit) { + sprintf(xorriso->info_text, "-check_media: Reached item_limit=%d", + job->item_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + if(sectors - i > 1) { + ret= Spotlist_add_item(*spotlist, i * sector_size, + (sectors - i - 1) * sector_size, + Xorriso_read_quality_untesteD, 0); + if(ret <= 0) + goto ex; + } + ret= 2; goto ex; + } + } + old_value= value; + old_start= i * sector_size; + } + if(old_value >= 0) { + ret= Spotlist_add_item(*spotlist, old_start, i * sector_size - old_start, + (old_value ? Xorriso_read_quality_valiD : + Xorriso_read_quality_invaliD), 0); + if(ret <= 0) + goto ex; + } + ret= 1; +ex:; + if(ret <= 0) + Spotlist_destroy(spotlist, 0); + return(ret); +} + + +/* @param flag bit0= mark untested areas as valid +*/ +int Xorriso_spotlist_to_sectormap(struct XorrisO *xorriso, + struct SpotlisT *spotlist, + int read_chunk, + struct SectorbitmaP **map, + int flag) +{ + struct SectorbitmaP *m; + int map_sectors= -1, map_sector_size= -1, valid; + int list_sectors, list_blocks, sector_size, sector_blocks; + int replace_map= 0, count, i, lba, blocks, quality, ret, pass; + + sector_size= Spotlist_sector_size(spotlist, read_chunk, 0); + sector_blocks= sector_size / 2048; + if(*map != NULL) + Sectorbitmap_get_layout(*map, &map_sectors, &map_sector_size, 0); + + count= Spotlist_count(spotlist, 0); + list_blocks= Spotlist_block_count(spotlist, 0); + + /* >>> ??? insist in list_blocks % sector_blocks == 0 */ + + list_sectors= list_blocks / sector_blocks; + if(list_sectors * sector_blocks < list_blocks) + list_sectors++; + if(*map != NULL && map_sectors * (map_sector_size / 2048) >= list_blocks && + map_sector_size == sector_size) + m= *map; + else { + if(*map != NULL) { + if(((off_t) (*map)->sectors) * ((off_t) (*map)->sector_size) > + ((off_t) list_sectors) * ((off_t) sector_size)) + list_sectors= (((off_t) (*map)->sectors) * + ((off_t) (*map)->sector_size)) / ((off_t) sector_size) + + 1; + } + ret= Sectorbitmap_new(&m, list_sectors, sector_size, 0); + if(ret <= 0) + return(-1); + replace_map= 1; + if(*map != NULL) { + ret= Sectorbitmap_copy(*map, m, 0); + if(ret <= 0) { + Sectorbitmap_destroy(&m, 0); + return(0); + } + } + } + + count= Spotlist_count(spotlist, 0); + /* first set good bits, then eventually override by bad bits */ + for(pass= 0; pass < 2; pass++) { + for(i= 0; i < count; i++) { + ret= Spotlist_get_item(spotlist, i, &lba, &blocks, &quality, 0); + if(ret <= 0) + continue; + valid= quality > xorriso->check_media_bad_limit; + if(quality == Xorriso_read_quality_untesteD && (flag & 1)) + valid= 1; + else if(pass == 0 && !valid) + continue; + else if(pass == 1 && valid) + continue; + Sectorbitmap_set_range(m, lba / sector_blocks, blocks / sector_blocks, + valid); + } + } + if(replace_map) { + Sectorbitmap_destroy(map, 0); + *map= m; + } + return(1); +} + + +int Xorriso_open_job_data_to(struct XorrisO *xorriso, + struct CheckmediajoB *job, int flag) +{ + if(job->data_to_path[0] == 0) + return(2); + job->data_to_fd= open(job->data_to_path, O_RDWR | O_CREAT, + S_IRUSR | S_IWUSR); + if(job->data_to_fd == -1) { + sprintf(xorriso->info_text, "Cannot open path "); + Text_shellsafe(job->data_to_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + return(0); + } + return(1); +} + + +int Xorriso_update_in_sector_map(struct XorrisO *xorriso, + struct SpotlisT *spotlist, int read_chunk, + struct CheckmediajoB *job, int flag) +{ + int sectors, sector_size, sector_blocks, ret; + struct SectorbitmaP *map; + + Sectorbitmap_destroy(&(xorriso->in_sector_map), 0); + if(job->use_dev == 1) + return(1); + map= job->sector_map; + sectors= Spotlist_block_count(spotlist, 0); + if(sectors <= 0) + return(0); + sector_size= Spotlist_sector_size(spotlist, read_chunk, 0); + sector_blocks= sector_size / 2048; + if(sector_blocks > 1) + sectors= sectors / sector_blocks + !!(sectors % sector_blocks); + ret= Sectorbitmap_new(&(xorriso->in_sector_map), sectors, sector_size, 0); + if(ret <= 0) + return(ret); + if(map != NULL) + Sectorbitmap_copy(map, xorriso->in_sector_map, 0); + ret= Xorriso_spotlist_to_sectormap(xorriso, spotlist, read_chunk, + &(xorriso->in_sector_map), 1); + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/check_media.h b/libisoburn/branches/1.1.8/xorriso/check_media.h new file mode 100644 index 00000000..030ebbad --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/check_media.h @@ -0,0 +1,181 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of classes SpotlistiteM, SpotlisT, + SectorbitmaP, CheckmediajoB which represent media checks and their outcome. +*/ + + +#ifndef Xorriso_pvt_check_includeD +#define Xorriso_pvt_check_includeD yes + +struct SpotlisT; /* List of intervals with different read qualities */ +struct CheckmediajoB; /* Parameters for Xorriso_check_media() */ + +int Xorriso_check_media_setup_job(struct XorrisO *xorriso, + struct CheckmediajoB *job, + char **argv, int old_idx, int end_idx, int flag); + +int Xorriso_sectormap_to_spotlist(struct XorrisO *xorriso, + struct CheckmediajoB *job, + struct SpotlisT **spotlist, + int flag); + +/* @param flag bit0= mark untested areas as valid +*/ +int Xorriso_spotlist_to_sectormap(struct XorrisO *xorriso, + struct SpotlisT *spotlist, + int read_chunk, + struct SectorbitmaP **map, + int flag); + +/* Opens the -check_media data copy in for reading and writing +*/ +int Xorriso_open_job_data_to(struct XorrisO *xorriso, + struct CheckmediajoB *job, int flag); + +/* @param report Buffer of at least 10*SfileadrL + @param flag bit0= only report non-default settings + @return <=0 error , 1 ok , 2 with bit0: every option is on default setting +*/ +int Xorriso_check_media_list_job(struct XorrisO *xorriso, + struct CheckmediajoB *job, + char *report, int flag); + +int Xorriso_update_in_sector_map(struct XorrisO *xorriso, + struct SpotlisT *spotlist, int read_chunk, + struct CheckmediajoB *job, int flag); + + +/* Distiniction between valid and invalid sectors */ +struct SectorbitmaP { + int sectors; + int sector_size; + unsigned char *map; + int map_size; +}; + +int Spotlist_new(struct SpotlisT **o, int flag); + +int Spotlist_destroy(struct SpotlisT **o, int flag); + +int Spotlist_add_item(struct SpotlisT *o, int start_lba, int blocks, + int quality, int flag); + +int Spotlist_count(struct SpotlisT *o, int flag); + +int Spotlist_block_count(struct SpotlisT *o, int flag); + +int Spotlist_sector_size(struct SpotlisT *o, int read_chunk, int flag); + +int Spotlist_get_item(struct SpotlisT *o, int idx, + int *start_lba, int *blocks, int *quality, int flag); + +char *Spotlist__quality_name(int quality, char name[80], int bad_limit, + int flag); + + +#define Xorriso_read_quality_gooD 0x7fffffff +#define Xorriso_read_quality_md5_matcH 0x70000000 +#define Xorriso_read_quality_sloW 0x60000000 +#define Xorriso_read_quality_partiaL 0x50000000 +#define Xorriso_read_quality_valiD 0x40000000 +#define Xorriso_read_quality_untesteD 0x3fffffff +#define Xorriso_read_quality_invaliD 0x3ffffffe +#define Xorriso_read_quality_tao_enD 0x28000000 +#define Xorriso_read_quality_off_tracK 0x20000000 +#define Xorriso_read_quality_md5_mismatcH 0x10000000 +#define Xorriso_read_quality_unreadablE 0x00000000 + + +struct CheckmediajoB { + int use_dev; /* 0= use indev , 1= use outdev , 2= use sector map*/ + + int min_lba; /* if >=0 : begin checking at this address */ + int max_lba; /* if >=0 : read up to this address, else use mode */ + + int min_block_size; /* granularity desired by user + */ + int mode; /* 0= track by track + 1= single sweep over libisoburn medium capacity + 2= single sweep over libburn medium capacity + */ + time_t start_time; + int time_limit; /* Number of seconds after which to abort */ + + int item_limit; /* Maximum number of medium check list items as result */ + + char abort_file_path[SfileadrL]; + + char data_to_path[SfileadrL]; + int data_to_fd; + off_t data_to_offset; /* usually 0 with image copy, negative with file copy */ + off_t data_to_limit; /* used with file copy */ + int patch_lba0; + int patch_lba0_msc1; + + char sector_map_path[SfileadrL]; + struct SectorbitmaP *sector_map; + int map_with_volid; /* 0=add quick toc to map file, + 1=read ISO heads for toc + */ + + int retry; /* -1= only try full read_chunk, 1=retry with 2k blocks + 0= retry with CD, full chunk else + */ + + int report_mode; /* 0= print MCL items + 1= print damaged files + */ + + char event_severity[20]; /* If not "ALL": trigger event of given severity + at the end of a check job if bad blocks were + discovered. + */ + + double slow_threshold_seq; /* Time limit in seconds for the decision whether + a read operation is considered slow. This does + not apply to thr first read of an interval. + */ + + int untested_valid; /* 1= mark untested data blocks as valid when calling + Xorriso_spotlist_to_sectormap() + */ +}; + +int Checkmediajob_new(struct CheckmediajoB **o, int flag); + +int Checkmediajob_destroy(struct CheckmediajoB **o, int flag); + +int Checkmediajob_copy(struct CheckmediajoB *from, struct CheckmediajoB *to, + int flag); + +int Sectorbitmap_new(struct SectorbitmaP **o, int sectors, int sector_size, + int flag); +int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag); +int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg, + int *os_errno, int flag); +int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *info, + char *msg, int *os_errno, int flag); +int Sectorbitmap_set(struct SectorbitmaP *o, int sector, int flag); +int Sectorbitmap_set_range(struct SectorbitmaP *o, + int start_sector, int sectors, int flag); +int Sectorbitmap_is_set(struct SectorbitmaP *o, int sector, int flag); +int Sectorbitmap_bytes_are_set(struct SectorbitmaP *o, + off_t start_byte, off_t end_byte, int flag); + +int Sectorbitmap_get_layout(struct SectorbitmaP *o, + int *sectors, int *sector_size, int flag); + +int Sectorbitmap_copy(struct SectorbitmaP *from, struct SectorbitmaP *to, + int flag); + +int Sectorbitmap_clone(struct SectorbitmaP *from, struct SectorbitmaP **clone, + int flag); + +#endif /* ! Xorriso_pvt_check_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/cmp_update.c b/libisoburn/branches/1.1.8/xorriso/cmp_update.c new file mode 100644 index 00000000..430238f3 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/cmp_update.c @@ -0,0 +1,1013 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the implementation of actions which compare or update + files between disk filesystem and ISO filesystem. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* + @param result Bitfield indicationg type of mismatch + bit11= cannot open regular disk file + bit12= cannot open iso file + bit13= early eof of disk file + bit14= early eof of iso file + bit15= content bytes differ + @param flag bit0= mtimes of both file objects are equal + bit29= do not issue pacifier messages + bit31= do not issue result messages + @return >0 ok , <=0 error +*/ +int Xorriso_compare_2_contents(struct XorrisO *xorriso, char *common_adr, + char *disk_adr, off_t disk_size, + off_t offset, off_t bytes, + char *iso_adr, off_t iso_size, + int *result, int flag) +{ + int fd1= -1, ret, r1, r2, done, wanted, i, was_error= 0, use_md5= 0; + void *stream2= NULL; + off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1; + char *respt, *buf1= NULL, *buf2= NULL, offset_text[80]; + char disk_md5[16], iso_md5[16]; + void *ctx= NULL; + int buf_size= 32 * 1024; + + Xorriso_alloc_meM(buf1, char, buf_size); + Xorriso_alloc_meM(buf2, char, buf_size); + + respt= xorriso->result_line; + + fd1= open(disk_adr, O_RDONLY); + if(fd1==-1) { + sprintf(respt, "- %s (DISK) : cannot open() : %s\n", + disk_adr, strerror(errno)); +cannot_address:; + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 2048; + {ret= 0; goto ex;} + } + if(offset>0) + if(lseek(fd1, offset, SEEK_SET)==-1) { + sprintf(respt, "- %s (DISK) : cannot lseek(%.f) : %s\n", + disk_adr, (double) offset, strerror(errno)); + close(fd1); + goto cannot_address; + } + + if(xorriso->do_md5 & 16) { + use_md5= 1; + ret= Xorriso_is_plain_image_file(xorriso, NULL, iso_adr, 0); + if(ret <= 0) + ret= 0; /* (reverse) filtered files are likely not to match their MD5 */ + else + ret= Xorriso_get_md5(xorriso, NULL, iso_adr, iso_md5, 1); + if(ret <= 0) + use_md5= 0; + else { + ret= Xorriso_md5_start(xorriso, &ctx, 0); + if(ret <= 0) + use_md5= 0; + } + } + if (! use_md5) { + ret= Xorriso_iso_file_open(xorriso, iso_adr, NULL, &stream2, 0); + if(ret<=0) { + sprintf(respt, "- %s (ISO) : cannot open() file in ISO image\n",iso_adr); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + close(fd1); + (*result)|= 4096; + {ret= 0; goto ex;} + } + } + + done= 0; + while(!done) { + + wanted= buf_size; + if(r1count+offset+wanted>disk_size) + wanted= disk_size-r1count-offset; + if(r1count+wanted>bytes) + wanted= bytes-r1count; + r1= 0; + while(wanted>0) { + ret= read(fd1, buf1, wanted); + if(ret<=0) + break; + wanted-= ret; + r1+= ret; + } + + wanted= buf_size; + if(r2count+wanted>iso_size) + wanted= iso_size-r2count; +/* + if(r2count+wanted>bytes) + wanted= bytes-r2count; +*/ + if(use_md5) + r2= r1; + else if(wanted>0) + r2= Xorriso_iso_file_read(xorriso, stream2, buf2, wanted, 0); + else + r2= 0; + + if(r1<0 || r2<0) + was_error= 1; + + if(r1<=0 && r2<=0) + break; + if(r1<=0) { + if(r1<0) + r1= 0; + if(disk_size > r1count + r1 + offset) { + sprintf(respt, "- %s (DISK) : early EOF after %.f bytes\n", + disk_adr, (double) r1count); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 8196; + } + (*result)|= (1<<15); + } + r1count+= r1; + if(r2<=0 || r2 r2count + r2) { + sprintf(respt, "- %s (ISO) : early EOF after %.f bytes\n", + iso_adr, (double) r2count); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= (1<<14); + } + (*result)|= (1<<15); + done= 1; + } + if(r2>r1) { + if(disk_size > r1count + r1 + offset) { + sprintf(respt, "- %s (DISK) : early EOF after %.f bytes\n", + disk_adr, (double) r1count); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 8196; + } + (*result)|= (1<<15); + done= 1; + } + r2count+= r2; + if(r1>r2) + r1= r2; + + if(use_md5) { + Xorriso_md5_compute(xorriso, ctx, buf1, r1, 0); + } else { + for(i= 0; ipacifier_count+= r1; + xorriso->pacifier_byte_count+= r1; + if(flag&(1<<31)) + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 0); + else + Xorriso_pacifier_callback(xorriso, "bytes", xorriso->pacifier_count, 0, + "", 1<<6); + } + } + + if(use_md5) { + ret= Xorriso_md5_end(xorriso, &ctx, disk_md5, 0); + if(ret <= 0) { + *result |= (1 << 15); + ret= -1; goto ex; + } + for(i= 0; i < 16; i++) + if(iso_md5[i] != disk_md5[i]) + break; + if(i < 16 ) { + offset_text[0]= 0; + if(offset>0) + sprintf(offset_text, "%.f+", (double) offset); + sprintf(respt, "%s %s : differs by MD5 sums.\n", + common_adr, (flag&1 ? "CONTENT": "content")); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= (1<<15); + } + } else if(diffcount>0 || r1count!=r2count) { + if(first_diff<0) + first_diff= (r1count>r2count ? r2count : r1count); + offset_text[0]= 0; + if(offset>0) + sprintf(offset_text, "%.f+", (double) offset); + sprintf(respt, "%s %s : differs by at least %.f bytes. First at %s%.f\n", + common_adr, (flag&1 ? "CONTENT": "content"), + (double) (diffcount + abs(r1count-r2count)), + offset_text, (double) first_diff); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= (1<<15); + } + if(fd1!=-1) + close(fd1); + if(! use_md5) + Xorriso_iso_file_close(xorriso, &stream2, 0); + if(was_error) + {ret= -1; goto ex;} + ret= 1; +ex:; + if(ctx != NULL) + Xorriso_md5_end(xorriso, &ctx, disk_md5, 0); + Xorriso_free_meM(buf1); + Xorriso_free_meM(buf2); + return(ret); +} + + +/* + @param result Bitfield indicationg type of mismatch + bit0= disk_adr not existing + bit1= iso_adr not existing + bit2= access permissions + bit3= file type + bit4= user id + bit5= group id + bit6= minor, major with device file + bit7= size + bit8= mtime + bit9= atime + bit10= ctime + bit11= cannot open regular disk file + bit12= cannot open iso file + bit13= early eof of disk file + bit14= early eof of iso file + bit15= content bytes differ + bit16= symbolic link on disk pointing to dir, dir in iso + bit17= file chunks detected and compared + bit18= incomplete chunk collection encountered + bit19= ACL differs (this condition sets also bit2) + bit20= xattr differ + bit21= mismatch of recorded dev,inode + bit22= no recorded dev,inode found in node + bit23= timestamps younger than xorriso->isofs_st_in + bit24= hardlink split + bit25= hardlink fusion + @param flag bit0= compare atime + bit1= compare ctime + bit2= check only existence of both file objects + count one or both missing as "difference" + bit26= do not issue message about missing disk file + bit27= for Xorriso_path_is_excluded(): bit0 + bit28= examine eventual disk_path link target rather than link + bit29= do not issue pacifier messages + bit30= omit adr_common_tail in report messages + bit31= do not issue result messages + @return 1=files match properly , 0=difference detected , -1=error +*/ +int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr, + char *iso_adr, char *adr_common_tail, + int *result, int flag) +{ + struct stat s1, s2, stbuf; + int ret, missing= 0, is_split= 0, i, was_error= 0, diff_count= 0; + int content_shortcut= 0, mask; + char *respt; + char *a= NULL; + char ttx1[40], ttx2[40]; + char *a1_acl= NULL, *a2_acl= NULL, *d1_acl= NULL, *d2_acl= NULL; + char *attrlist1= NULL, *attrlist2= NULL; + struct SplitparT *split_parts= NULL; + int split_count= 0; + time_t stamp; + + char *part_path= NULL, *part_name; + int partno, total_parts= 0; + off_t offset, bytes, total_bytes; + + Xorriso_alloc_meM(a, char, 5*SfileadrL); + Xorriso_alloc_meM(part_path, char, SfileadrL); + + *result= 0; + respt= xorriso->result_line; + + if(!(xorriso->disk_excl_mode&8)) { + ret= Xorriso_path_is_excluded(xorriso, disk_adr, 2 | !!(flag&(1<<27))); + if(ret>0) { + strcpy(respt, "? "); + Text_shellsafe(disk_adr, respt, 1); + sprintf(respt + strlen(respt), " (DISK) : exluded by %s\n", + (ret==1 ? "-not_paths" : "-not_leaf")); + if(! (flag & ((1 << 31) | (1 << 26)))) + Xorriso_result(xorriso,0); + missing= 1; + (*result)|= 1; + } + } + if(!missing) { + if(flag&(1<<28)) + ret= stat(disk_adr, &s1); + else + ret= lstat(disk_adr, &s1); + if(ret==-1) { + strcpy(respt, "? "); + Text_shellsafe(disk_adr, respt, 1); + sprintf(respt + strlen(respt), + " (DISK) : cannot lstat() : %s\n", strerror(errno)); + if(! (flag & ((1 << 31) | (1 << 26)))) + Xorriso_result(xorriso,0); + missing= 1; + (*result)|= 1; + } + } + if(missing) + strcpy(a, "?"); + else + strcpy(a, Ftypetxt(s1.st_mode, 1)); + strcat(a, " "); + if(adr_common_tail[0]) + Text_shellsafe(adr_common_tail, a, 1); + else { + Text_shellsafe(disk_adr, a+strlen(a), 0); + strcat(a, " (DISK)"); +/* + strcat(a, "'.'"); +*/ + } + strcat(a, " :"); + if(flag&(1<<30)) + a[0]= 0; + + ret= Xorriso_iso_lstat(xorriso, iso_adr, &s2, 0); + if(ret<0) { + strcpy(respt, "? "); + Text_shellsafe(iso_adr, respt, 1); + strcat(respt, " (ISO) : cannot find this file in ISO image\n"); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + missing= 1; + (*result)|= 2; + } + + if((flag&4)||missing) + {ret= !missing; goto ex;} + + + /* Splitfile parts */ + if((S_ISREG(s1.st_mode) || S_ISBLK(s1.st_mode)) && S_ISDIR(s2.st_mode)) { + is_split= Xorriso_identify_split(xorriso, iso_adr, NULL, &split_parts, + &split_count, &s2, 0); + if(is_split>0) + (*result)|= (1<<17); + else + is_split= 0; + } + + /* Attributes */ + if(s1.st_mode != s2.st_mode) { + if((s1.st_mode&~S_IFMT)!=(s2.st_mode&~S_IFMT)) { + sprintf(respt, "%s st_mode : %7.7o <> %7.7o\n", + a, (unsigned int) (s1.st_mode & ~S_IFMT), + (unsigned int) (s2.st_mode & ~S_IFMT)); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 4; + } + + if((s1.st_mode&S_IFMT)!=(s2.st_mode&S_IFMT)) { + sprintf(respt, "%s type : %s <> %s\n", + a, Ftypetxt(s1.st_mode, 0), Ftypetxt(s2.st_mode, 0)); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 8; + if((s1.st_mode&S_IFMT) == S_IFLNK) { + /* check whether link target type matches */ + ret= stat(disk_adr, &stbuf); + if(ret!=-1) + if(S_ISDIR(stbuf.st_mode) && S_ISDIR(s2.st_mode)) + (*result)|= (1<<16); + } + } + } + + /* ACL */ + if(xorriso->do_aaip & 3) { + Xorriso_local_getfacl(xorriso, disk_adr, &a1_acl, + 16 | ((flag & (1 << 28)) >> 23)); + if(S_ISDIR(s1.st_mode)) + Xorriso_local_getfacl(xorriso, disk_adr, &d1_acl, 1); + ret= Xorriso_getfacl(xorriso, NULL, iso_adr, &a2_acl, 1 | 4 | 16); + if(ret < 0) + goto ex; + if(S_ISDIR(s1.st_mode)) { + ret= Xorriso_getfacl(xorriso, NULL, iso_adr, &d2_acl, 1 | 8); + if(ret < 0) + goto ex; + } + ret= Compare_text_lines(a1_acl, a2_acl, &diff_count, 0); + if(ret < 0) + goto ex; + if(ret == 0) + (*result)|= 4 | (1 << 19); + ret= Compare_text_lines(d1_acl, d2_acl, &diff_count, 1); + if(ret < 0) + goto ex; + if(ret == 0) + (*result)|= 4 | (1 << 19); + if((*result) & (1 << 19)) { + sprintf(respt, "%s ACL : %d difference%s\n", + a, diff_count, diff_count == 1 ? "" : "s"); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + } + + /* xattr */ + if(xorriso->do_aaip & 12) { + ret= Xorriso_getfattr(xorriso, NULL, disk_adr, &attrlist1, + 1 | 2 | ((flag & (1 << 28)) >> 23)); + if(ret < 0) + goto ex; + ret= Xorriso_getfattr(xorriso, NULL, iso_adr, &attrlist2, 1); + if(ret < 0) + goto ex; + ret= Compare_text_lines(attrlist1, attrlist2, &diff_count, 0); + if(ret < 0) + goto ex; + if(ret == 0) { + (*result)|= (1 << 20); + sprintf(respt, "%s xattr : %d difference%s\n", + a, diff_count, diff_count == 1 ? "" : "s"); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + } + + if(s1.st_uid != s2.st_uid) { + sprintf(respt, "%s st_uid : %lu <> %lu\n", a, + (unsigned long) s1.st_uid, (unsigned long) s2.st_uid); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 16; + } + if(s1.st_gid != s2.st_gid) { + sprintf(respt, "%s st_gid : %lu <> %lu\n", a, + (unsigned long) s1.st_gid, (unsigned long) s2.st_gid); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 32; + } + if((S_ISCHR(s1.st_mode) && S_ISCHR(s2.st_mode)) || + (S_ISBLK(s1.st_mode) && S_ISBLK(s2.st_mode))) { + if(s1.st_rdev != s2.st_rdev) { + sprintf(respt, "%s %s st_rdev : %lu <> %lu\n", a, + (S_ISCHR(s1.st_mode) ? "S_IFCHR" : "S_IFBLK"), + (unsigned long) s1.st_rdev, (unsigned long) s1.st_rdev); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 64; + } + } + if((!(xorriso->do_aaip & 32)) && + S_ISREG(s2.st_mode) && s1.st_size != s2.st_size) { + sprintf(respt, "%s st_size : %.f <> %.f diff= %.f\n", + a, (double) s1.st_size, (double) s2.st_size, + ((double) s1.st_size) - (double) s2.st_size); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 128; + } + if(s1.st_mtime != s2.st_mtime) { + sprintf(respt, "%s st_mtime : %s <> %s diff= %.f s\n", + a, Ftimetxt(s1.st_mtime, ttx1, 0), + Ftimetxt(s2.st_mtime, ttx2, 0), + ((double) s1.st_mtime) - (double) s2.st_mtime); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 256; + } + if(flag&1) { + if(s1.st_atime != s2.st_atime) { + sprintf(respt, "%s st_atime : %s <> %s diff= %.f s\n", + a, Ftimetxt(s1.st_atime, ttx1, 0), + Ftimetxt(s2.st_atime, ttx2, 0), + ((double) s1.st_atime) - (double) s2.st_atime); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 512; + } + } + if(flag&2) { + if(s1.st_ctime != s2.st_ctime) { + sprintf(respt, "%s st_ctime : %s <> %s diff= %.f s\n", + a, Ftimetxt(s1.st_ctime, ttx1, 0), + Ftimetxt(s2.st_ctime, ttx2, 0), + ((double) s1.st_ctime) - (double) s2.st_ctime); + if(!(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= 1024; + } + } + if(xorriso->isofs_st_in > 0 && + (xorriso->isofs_st_in <= s2.st_mtime || + ((flag & 1) && xorriso->isofs_st_in <= s2.st_atime) || + ((flag & 2) && xorriso->isofs_st_in <= s2.st_ctime))) + (*result)|= 1 << 23; + + if((xorriso->do_aaip & 32) || !(xorriso->ino_behavior & 2)) { + /* dev,inode comparison. + For skipping content comparison or for hardlink detection. + */ + ret= Xorriso_record_dev_inode(xorriso, "", s1.st_dev, s1.st_ino, NULL, + iso_adr, 1 | 2 | ((flag & (1 << 28)) >> 23) | (xorriso->do_aaip & 128)); + if(ret < 0) { + ret= -1; goto ex; + } else if(ret == 0) { /* match */ + if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){ + if(xorriso->do_aaip & 32) + content_shortcut= 1; + if((*result) & (8 | 128 | 256 | 512 | 1024 | (1 << 23))) { + (*result)|= (1 << 15); /* content bytes differ */ + if(((*result) & (1 << 23)) && + !((*result) & (8 | 128 | 256 | 512 | 1024))) { + sprintf(respt, + "%s content : node timestamp younger than image timestamp\n", a); + if((xorriso->do_aaip & 32) && !(flag&(1<<31))) + Xorriso_result(xorriso,0); + stamp= s2.st_mtime; + if((flag & 1) && s2.st_atime >= stamp) + stamp= s2.st_atime; + if((flag & 2) && s2.st_ctime >= stamp) + stamp= s2.st_ctime; + sprintf(respt, "%s content : %s > %s diff= %.f s\n", + a, Ftimetxt(stamp, ttx1, 3 << 1), + Ftimetxt(xorriso->isofs_st_in, ttx2, 3 << 1), + ((double) stamp) - (double) xorriso->isofs_st_in); + if((xorriso->do_aaip & 32) && !(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + sprintf(respt, + "%s content : assuming inequality due to size or timestamps\n", a); + if((xorriso->do_aaip & 32) && !(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + } + } else if(ret == 1) { /* mismatch */ + (*result)|= (1 << 21); + sprintf(respt, "%s dev_ino : differing\n", a); + if((xorriso->do_aaip & 32) && !(flag&(1<<31))) + Xorriso_result(xorriso,0); + + if((xorriso->do_aaip & 64) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)){ + if(xorriso->do_aaip & 32) + content_shortcut= 1; + (*result)|= (1 << 15); /* content bytes differ */ + sprintf(respt, + "%s content : assuming inequality after dev_ino mismatch\n", a); + if((xorriso->do_aaip & 32) && !(flag&(1<<31))) + Xorriso_result(xorriso,0); + } + } else { + sprintf(respt, "%s dev_ino : no dev_ino stored with image node\n", a); + if((xorriso->do_aaip & 32) && !(flag&(1<<31))) + Xorriso_result(xorriso,0); + (*result)|= (1 << 22); + } + } + + if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode) && !content_shortcut) { + /* Content */ + if(is_split) { + for(i= 0; i0 && split_count!=total_parts) { + sprintf(xorriso->info_text, + "- %s/* (ISO) : Not all split parts present (%d of %d)\n", + iso_adr, split_count, total_parts); + if(!(flag&(1<<31))) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 1); + (*result)|= 1<<18; + } + } else { + ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size, + (off_t) 0, s1.st_size, + iso_adr, s2.st_size, result, + (s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1<<31)))); + if(ret<0) + was_error= 1; + } + + } + if(was_error) + ret= -1; + else { + mask= ~((1 << 17) | (1 << 18) | (1 << 22) | (1 << 23)); + if(xorriso->do_aaip & 32) + mask|= 1 << 22; + ret= (((*result) & mask)==0); + } +ex:; + if(split_parts!=NULL) + Splitparts_destroy(&split_parts, split_count, 0); + Xorriso_local_getfacl(xorriso, disk_adr, &a1_acl, 1 << 15); + Xorriso_local_getfacl(xorriso, disk_adr, &d1_acl, 1 << 15); + if(a2_acl != NULL) + free(a2_acl); + if(d2_acl != NULL) + free(d2_acl); + Xorriso_free_meM(part_path); + Xorriso_free_meM(a); + return(ret); +} + + +int Xorriso_pfx_disk_path(struct XorrisO *xorriso, char *iso_path, + char *iso_prefix, char *disk_prefix, + char disk_path[SfileadrL], int flag) +{ + int ret; + char *adrc= NULL; + + Xorriso_alloc_meM(adrc, char, SfileadrL); + + if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0) + {ret= -1; goto ex;} + if(strlen(disk_prefix) + strlen(iso_path) - strlen(iso_prefix)+1 >= SfileadrL) + {ret= -1; goto ex;} + if(iso_path[strlen(iso_prefix)] == '/') + strcpy(adrc, iso_path + strlen(iso_prefix) + 1); + else + strcpy(adrc, iso_path + strlen(iso_prefix)); + ret= Xorriso_make_abs_adr(xorriso, disk_prefix, adrc, disk_path, 4 | 8); + if(ret <= 0) + goto ex; + ret= 1; +ex:; + Xorriso_free_meM(adrc); + return(ret); +} + + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= update rather than compare + bit1= find[ix] is in recursion + bit2= update_merge : do not delete but mark visited and found + @return <=0 error, 1= ok , 2= iso_path was deleted + 3=ok, do not dive into directory (e.g. because it is a split file) +*/ +int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter, void *node, + char *iso_path, char *iso_prefix, char *disk_prefix, + int flag) +{ + int ret, result, uret, follow_links, deleted= 0; + char *disk_path= NULL; + + Xorriso_alloc_meM(disk_path, char, SfileadrL); + + ret= Xorriso_pfx_disk_path(xorriso, iso_path, iso_prefix, disk_prefix, + disk_path, 0); + if(ret <= 0) + goto ex; + + /* compare exclusions against disk_path resp. leaf name */ + if(xorriso->disk_excl_mode&8) + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&2)); + else + ret= 0; + if(ret<0) + goto ex; + if(ret>0) + {ret= 3; goto ex;} + + follow_links= (xorriso->do_follow_links || + (xorriso->do_follow_param && !(flag&2))) <<28; + ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, "", &result, + 2 | follow_links | ((!!(flag & 4)) << 26) + | ((!(flag&2))<<27) | ((flag&1)<<31)); + /* was once: | ((!(flag&1))<<29) */ + if(retfind_compare_result) + xorriso->find_compare_result= ret; + if(flag&1) { + if(ret<0) + if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) + goto ex; + if(ret > 0) + result= 0; + uret= Xorriso_update_interpreter(xorriso, boss_iter, node, result, + disk_path, iso_path, + ((flag & 2) << 1) | ((flag & 4) >> 1)); + if(uret<=0) + ret= 0; + if(uret==2) + deleted= 1; + } + if(ret<0) + goto ex; + if(deleted) + {ret= 2; goto ex;} + if(result&(1<<17)) + {ret= 3; goto ex;} +ex:; + Xorriso_free_meM(disk_path); + return(ret); +} + + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= widen hardlink sibling: + Do not call Xorriso_hardlink_update() + Overwrite exactly if normal mode would not, + else do nothing + bit1= do not delete files which are not found under + disk_path, but rather mark visited files and mark + files which were found. + bit2= -follow: this is not a command parameter + @return <=0 error, 1= ok , 2= iso_rr_path node object has been deleted , + 3= no action taken +*/ +int Xorriso_update_interpreter(struct XorrisO *xorriso, + void *boss_iter, void *node, + int compare_result, char *disk_path, + char *iso_rr_path, int flag) +{ + int ret= 1, deleted= 0, is_split= 0, i, loop_count, late_hardlink_update= 0; + struct stat stbuf; + struct SplitparT *split_parts= NULL; + int split_count= 0; + char *part_path= NULL, *part_name; + int partno, total_parts, new_total_parts; + off_t offset, bytes, total_bytes, disk_size, first_bytes; + + if((compare_result&3)==3) { + sprintf(xorriso->info_text, "Missing on disk and in ISO: disk_path "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + xorriso->find_compare_result= -1; + ret= 3; goto ex; + } + + Xorriso_alloc_meM(part_path, char, SfileadrL); + + if((flag & 2) && !(compare_result & 2)) { + ret= Xorriso_mark_update_merge(xorriso, iso_rr_path, node, + !(compare_result & 1)); + if(ret <= 0) + goto ex; + } + if(compare_result == 0) + {ret= 1; goto ex;} + + if(compare_result&((1<<11)|(1<<13))) { + if(flag & 1) + {ret= 3; goto ex;} + /* cannot open regular disk file, early eof of disk file */ + sprintf(xorriso->info_text, "Problems with reading disk file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); + xorriso->find_compare_result= -1; + ret= 1; goto ex; + } + xorriso->info_text[0]= 0; + is_split= !!(compare_result & (1<<17)); + + if((!(xorriso->ino_behavior & 2)) && (compare_result & (2 | (3 << 21))) && + !(flag & 1)) { + if(compare_result & 2) { + /* File is not yet in image */ + late_hardlink_update= 1; + } else { + /* Hard link relation has changed resp. was not recorded. */ + ret= Xorriso_hardlink_update(xorriso, &compare_result, + disk_path, iso_rr_path, + (flag & 4) | ((compare_result >> 21) & 2)); + if(ret < 0) + goto ex; + if(ret == 2) + {ret= 1; goto ex;} + } + } + + if(compare_result&(8|64)) { + /* file type, minor+major with device file */ + if(flag & 1) + {ret= 3; goto ex;} + ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, iso_rr_path, 1); /* rm_r */ + if(ret>0) { + deleted= 1; + ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path, + (off_t) 0, (off_t) 0, 2|(flag&4)); + if(ret <= 0) + goto ex; + if(flag & 2) { + ret= Xorriso_mark_update_merge(xorriso, iso_rr_path, NULL, 1); + if(ret <= 0) + goto ex; + } + } + sprintf(xorriso->info_text, "Deleted and re-added "); + + } else if(compare_result&(1)) { +delete:; + /* disk_adr not existing */ + if(!(flag & 2)) { + ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, iso_rr_path, 1); + deleted= 1; + sprintf(xorriso->info_text, "Deleted "); + } + + } else if(compare_result&(2|128|(1<<12)|(1<<14)|(1<<15))) { + /* iso_adr not existing, size, cannot open iso file, early eof of iso file + content bytes differ */ + + if(flag & 1) + {ret= 3; goto ex;} +overwrite:; + if(is_split) { + ret= Xorriso_identify_split(xorriso, iso_rr_path, NULL, + &split_parts, &split_count, &stbuf, 0); + if(ret<=0) + {ret= -1; goto ex;} /* (should not happen) */ + ret= lstat(disk_path, &stbuf); + if(ret==-1) + goto delete; + disk_size= stbuf.st_size; + Splitparts_get(split_parts, 0, &part_name, &partno, &total_parts, + &offset, &first_bytes, &total_bytes, 0); + new_total_parts= disk_size/first_bytes; + if(disk_size % first_bytes) + new_total_parts++; + + loop_count= split_count; + /* If disk file grew over part limit and all parts are present: + add new parts */ + if(new_total_parts > total_parts && split_count == total_parts) + loop_count= new_total_parts; + + for(i= 0; iSfileadrL) { + Xorriso_much_too_long(xorriso, strlen(part_path)+160, 2); + ret= 0; goto ex; + } + Splitpart__compose(part_path+strlen(iso_rr_path)+1, partno, + new_total_parts, offset, first_bytes, disk_size, 0); + ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, part_path, + offset, bytes, 2|(flag&4)|8|128); + if(ret<=0) + goto ex; + } + /* Copy file attributes to iso_rr_path, augment r-perms by x-perms */ + ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 2 | 4); + if(ret<=0) + goto ex; + } else { + ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path, + (off_t) 0, (off_t) 0, 2|(flag&4)); + if(ret>0 && !(compare_result&2)) + deleted= 1; + } + if(late_hardlink_update) { + /* Handle eventual hardlink siblings of newly created file */ + ret= Xorriso_hardlink_update(xorriso, &compare_result, + disk_path, iso_rr_path, 1 | (flag & 4)); + if(ret < 0) + goto ex; + } + if(flag & 2) { + ret= Xorriso_mark_update_merge(xorriso, iso_rr_path, NULL, 1); + if(ret <= 0) + goto ex; + } + if(flag & 1) + sprintf(xorriso->info_text, "Widened hard link "); + else + sprintf(xorriso->info_text, "Added/overwrote "); + + } else if(compare_result&(4|16|32|256|512|1024|(1<<19)|(1<<20)|(1<<22))) { + /* access permissions, user id, group id, mtime, atime, ctime, ACL, xattr, + dev_ino missing */ + + if(flag & 1) + goto overwrite; + + if(is_split) { + ret= Xorriso_identify_split(xorriso, iso_rr_path, NULL, + &split_parts, &split_count, &stbuf, 0); + if(ret<=0) + {ret= -1; goto ex;} /* (should not happen) */ + for(i= 0; iinfo_text, "Adjusted attributes of "); + + } else if(flag & 1) { + goto overwrite; + } else + ret= 1; + if(ret>0 && xorriso->info_text[0]) { + Text_shellsafe(iso_rr_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + } + ret= 1; +ex:; + if(split_parts!=NULL) + Splitparts_destroy(&split_parts, split_count, 0); + Xorriso_free_meM(part_path); + if(ret<=0) + return(ret); + if(deleted) + return(2); + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/cmp_update.h b/libisoburn/branches/1.1.8/xorriso/cmp_update.h new file mode 100644 index 00000000..33631b71 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/cmp_update.h @@ -0,0 +1,45 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of class DirseQ which + crawls along a directory's content list. +*/ + + +#ifndef Xorriso_pvt_cmp_includeD +#define Xorriso_pvt_cmp_includeD yes + +int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr, + char *iso_adr, char *adr_common_tail, + int *result, int flag); + +int Xorriso_pfx_disk_path(struct XorrisO *xorriso, char *iso_path, + char *iso_prefix, char *disk_prefix, + char disk_path[SfileadrL], int flag); + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param node Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= update rather than compare +*/ +int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter, void *node, + char *iso_path, char *iso_prefix, char *disk_prefix, + int flag); + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param @node Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_update_interpreter(struct XorrisO *xorriso, + void *boss_iter, void *node, + int compare_result, char *disk_path, + char *iso_rr_path, int flag); + +#endif /* ! Xorriso_pvt_cmp_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/compile_xorriso.sh b/libisoburn/branches/1.1.8/xorriso/compile_xorriso.sh new file mode 100755 index 00000000..d7a1e220 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/compile_xorriso.sh @@ -0,0 +1,207 @@ +#!/bin/sh + +# compile_xorriso.sh +# Copyright 2005 - 2010 Thomas Schmitt, scdbackup@gmx.net, GPL version 2 +# +# Not intended for general use in production installations ! +# Rather use: ./bootstrap ; ./configure ; make +# +# This is a development tool which expects a special setup of directories +# on a Linux system (e.g. SuSE 10.2). +# It is to be executed in a common parent of the directories given with +# $isofs $isoburn $burn $xorr + +isofs=./nglibisofs-develop/libisofs/libisofs_libisofs_la- +isofs_filter=./nglibisofs-develop/libisofs/filters/libisofs_libisofs_la- +burn=./libburn-develop/libburn +isoburn=./libisoburn-develop/libisoburn +xorr=./libisoburn-develop/xorriso + +debug_opts="-O2" +def_opts="-DXorriso_allow_external_filterS" +largefile_opts="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1" +do_strip=0 +static_opts= +warn_opts="-Wall" +nglibisofs=1 +def_libreadline="-DXorriso_with_readlinE" +link_libreadline="-lreadline" +link_libcdio= + +for i in "$@" +do + if test "$i" = "-do_diet" + then + def_opts="$def_opts -DXorriso_no_helP" + warn_opts= + elif test "$i" = "-do_strip" + then + do_strip=1 + elif test "$i" = "-g" + then + debug_opts="-g -O0" + elif test "$i" = "-no_libreadline" + then + def_libreadline="" + link_libreadline="" + elif test "$i" = "-dvd_obs_64k" + then + def_opts="$def_opts -DXorriso_dvd_obs_default_64K" + elif test "$i" = "-use_libcdio" + then + link_libcdio="-lcdio" + elif test "$i" = "-help" -o "$i" = "--help" -o "$i" = "-h" + then + echo \ + "$xorr/compile_xorriso.sh : to be executed above top level directories" + echo "Options:" + echo " -dvd_obs_64k 64 KB default size for DVD/BD writing." + echo " -no_libreadline do not compile for and link with libreadline." + echo " -use_libcdio link with -lcdio because libburn uses it." + echo " -do_diet produce capability reduced lean version." + echo " -do_strip apply program strip to compiled programs." + echo " -g produce debuggable programm." + echo " -static compile with cc option -static." + exit 0 + elif test "$i" = "-static" + then + static_opts="-static" + fi +done + +libisofs= +libisofs="$libisofs $isofs"buffer.o +libisofs="$libisofs $isofs"builder.o +libisofs="$libisofs $isofs"data_source.o +libisofs="$libisofs $isofs"ecma119.o +libisofs="$libisofs $isofs"ecma119_tree.o +libisofs="$libisofs $isofs"eltorito.o +libisofs="$libisofs $isofs"filesrc.o +libisofs="$libisofs $isofs"fs_image.o +libisofs="$libisofs $isofs"fs_local.o +libisofs="$libisofs $isofs"fsource.o +libisofs="$libisofs $isofs"image.o +libisofs="$libisofs $isofs"iso1999.o +libisofs="$libisofs $isofs"joliet.o +libisofs="$libisofs $isofs"libiso_msgs.o +libisofs="$libisofs $isofs"messages.o +libisofs="$libisofs $isofs"node.o +libisofs="$libisofs $isofs"rockridge.o +libisofs="$libisofs $isofs"rockridge_read.o +libisofs="$libisofs $isofs"stream.o +libisofs="$libisofs $isofs"tree.o +libisofs="$libisofs $isofs"util.o +libisofs="$libisofs $isofs"util_htable.o +libisofs="$libisofs $isofs"util_rbtree.o +libisofs="$libisofs $isofs"system_area.o +libisofs="$libisofs $isofs"make_isohybrid_mbr.o +libisofs="$libisofs $isofs"aaip_0_2.o +libisofs="$libisofs $isofs"filter.o +libisofs="$libisofs $isofs_filter"external.o +libisofs="$libisofs $isofs_filter"zisofs.o +libisofs="$libisofs $isofs_filter"gzip.o +libisofs="$libisofs $isofs"md5.o + +echo "Version timestamp : $(sed -e 's/#define Xorriso_timestamP "//' -e 's/"$//' "$xorr"/xorriso_timestamp.h)" + +date -u '+#define Xorriso_build_timestamP "%Y.%m.%d.%H%M%S"' >"$xorr"/xorriso_buildstamp.h +echo "Build timestamp : $(sed -e 's/#define Xorriso_build_timestamP "//' -e 's/"$//' "$xorr"/xorriso_buildstamp.h)" + +echo "compiling program $xorr/xorriso.c $static_opts $debug_opts $def_opts $link_libcdio" +cc -I. -DXorriso_with_maiN $def_libreadline \ + $warn_opts \ + $static_opts \ + $debug_opts \ + $def_opts \ + $largefile_opts \ + \ + -o "$xorr"/xorriso \ + \ + "$xorr"/xorriso_main.c \ + "$xorr"/sfile.c \ + "$xorr"/aux_objects.c \ + "$xorr"/findjob.c \ + "$xorr"/check_media.c \ + "$xorr"/misc_funct.c \ + "$xorr"/text_io.c \ + "$xorr"/match.c \ + "$xorr"/emulators.c \ + "$xorr"/disk_ops.c \ + "$xorr"/cmp_update.c \ + "$xorr"/parse_exec.c \ + "$xorr"/opts_a_c.c \ + "$xorr"/opts_d_h.c \ + "$xorr"/opts_i_o.c \ + "$xorr"/opts_p_z.c \ + \ + "$xorr"/base_obj.c \ + "$xorr"/lib_mgt.c \ + "$xorr"/sort_cmp.c \ + "$xorr"/drive_mgt.c \ + "$xorr"/iso_img.c \ + "$xorr"/iso_tree.c \ + "$xorr"/iso_manip.c \ + "$xorr"/write_run.c \ + "$xorr"/read_run.c \ + "$xorr"/filters.c \ + \ + "$isoburn"/isoburn.c \ + "$isoburn"/burn_wrap.c \ + "$isoburn"/data_source.c \ + "$isoburn"/isofs_wrap.c \ + \ + "$burn"/async.o \ + "$burn"/debug.o \ + "$burn"/drive.o \ + "$burn"/file.o \ + "$burn"/init.o \ + "$burn"/options.o \ + "$burn"/source.o \ + "$burn"/structure.o \ + \ + "$burn"/sg.o \ + "$burn"/write.o \ + "$burn"/read.o \ + "$burn"/libdax_audioxtr.o \ + "$burn"/libdax_msgs.o \ + "$burn"/cleanup.o \ + \ + "$burn"/mmc.o \ + "$burn"/sbc.o \ + "$burn"/spc.o \ + "$burn"/util.o \ + \ + "$burn"/sector.o \ + "$burn"/toc.o \ + \ + "$burn"/crc.o \ + "$burn"/ecma130ab.o \ + \ + $libisofs \ + \ + $link_libreadline \ + $link_libcdio \ + \ + -lpthread \ + -lacl \ + -lz + + ret=$? + if test "$ret" = 0 + then + dummy=dummy + else + echo >&2 + echo "+++ FATAL : Compilation of xorriso failed" >&2 + echo >&2 + exit 1 + fi + + +if test "$do_strip" = 1 +then + echo "stripping result $xorr/xorriso" + strip "$xorr"/xorriso +fi + +echo 'done.' diff --git a/libisoburn/branches/1.1.8/xorriso/configure_ac.txt b/libisoburn/branches/1.1.8/xorriso/configure_ac.txt new file mode 100644 index 00000000..b770057e --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/configure_ac.txt @@ -0,0 +1,441 @@ + +# configure.ac stems from xorriso/configure_ac.txt and leads to ./configure +# Copyright (c) 2007 - 2011 Thomas Schmitt +# Provided under GPL version 2 or later. + +AC_INIT([xorriso], [1.1.7], [http://libburnia-project.org]) +AC_PREREQ([2.50]) + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +LIBBURNIA_SET_FLAGS + +AM_INIT_AUTOMAKE([subdir-objects]) +AC_CONFIG_MACRO_DIR([./]) + +dnl Let autoheader produce config.h.in and let configure produce config.h +dnl This saves about 500 characters of compile message per source file. +AC_CONFIG_HEADER(config.h) + +AH_TEMPLATE([Xorriso_standalonE], [Define to prepare sources for statically linked xorriso]) +AC_DEFINE([Xorriso_standalonE], []) + +BURN_MAJOR_VERSION=1 +BURN_MINOR_VERSION=1 +BURN_MICRO_VERSION=7 +AC_SUBST(BURN_MAJOR_VERSION) +AC_SUBST(BURN_MINOR_VERSION) +AC_SUBST(BURN_MICRO_VERSION) + +LIBISOFS_MAJOR_VERSION=1 +LIBISOFS_MINOR_VERSION=1 +LIBISOFS_MICRO_VERSION=7 +AC_SUBST(LIBISOFS_MAJOR_VERSION) +AC_SUBST(LIBISOFS_MINOR_VERSION) +AC_SUBST(LIBISOFS_MICRO_VERSION) + +dnl The API version codes are defined in libisoburn/libisoburn.h +dnl #define isoburn_header_version_* + + +AC_PREFIX_DEFAULT([/usr/local]) +test "$prefix" = "NONE" && prefix=$ac_default_prefix + +AM_MAINTAINER_MODE + +AM_PROG_CC_C_O +AC_C_CONST +AC_C_INLINE +AC_C_BIGENDIAN + +dnl Large file support +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO +AC_CHECK_FUNC([fseeko]) +if test ! $ac_cv_func_fseeko; then + AC_ERROR([Libburn requires largefile support.]) +fi + +AH_TEMPLATE([ICONV_CONST], [Whether to apply const qualifier to iconv inbuf]) +if test x$XORRISO_OLD_ICONV_CONFIGURE = x +then + +dnl ts B00410 : To detect the need for -liconv and const argument of iconv() +LIBBURNIA_CHECK_ICONV +dnl ts B00411 : To abort configuration if iconv() still cannot be compiled +LIBBURNIA_ASSERT_ICONV + +else + +dnl Outdated: produces double -liconv and warnings about parameter mismatch +dnl If iconv(3) is in an extra libiconv, then it gets added to variable LIBS. +dnl If not, then no -liconv will be added. +AC_CHECK_LIB(iconv, iconv, , ) +dnl GNU iconv has no function iconv() but libiconv() and a macro iconv() +AC_CHECK_LIB(iconv, libiconv, , ) + +fi + +AC_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) +LIBTOOL="$LIBTOOL --silent" + +AC_PROG_INSTALL + +AC_CHECK_HEADERS() + +AC_CHECK_MEMBER([struct tm.tm_gmtoff], + [AC_DEFINE(HAVE_TM_GMTOFF, 1, + [Define this if tm structure includes a tm_gmtoff entry.])], + , + [#include ]) + +dnl Check if non standard timegm() function is available +AC_CHECK_DECL([timegm], + [AC_DEFINE(HAVE_TIMEGM, 1, [Define this if timegm function is available])], + , + [#include ]) + +dnl Check if non standard eaccess() function is available +AC_CHECK_DECL([eaccess], + [AC_DEFINE(HAVE_EACCESS, 1, [Define this if eaccess function is available])], + , + [#include ]) + +THREAD_LIBS=-lpthread +AC_SUBST(THREAD_LIBS) + +TARGET_SHIZZLE +AC_SUBST(ARCH) +AC_SUBST(LIBBURNIA_PKGCONFDIR) +AC_SUBST(LIBBURN_ARCH_LIBS) + +dnl Check the preconditions for using statvfs() in sg-dummy +dnl (sg-linux and sg-freebsd use statvfs() unconditionally) +AH_TEMPLATE([Libburn_os_has_statvfS], [Define to use statvfs() with libburn stdio]) +STATVFS_DEF=-DLibburn_os_has_statvfS +AC_CHECK_HEADER(sys/statvfs.h, X=, STATVFS_DEF=) +AC_CHECK_FUNC([statvfs], X=, STATVFS_DEF=) +if test x$STATVFS_DEF = x-DLibburn_os_has_statvfS +then + AC_DEFINE([Libburn_os_has_statvfS], []) +fi + + +dnl Add compiler-specific flags + +dnl See if the user wants aggressive optimizations of the code +AC_ARG_ENABLE(debug, +[ --enable-debug Disable aggressive optimizations [default=yes]], + , enable_debug=yes) +if test x$enable_debug != xyes; then + if test x$GCC = xyes; then + CFLAGS="-O3 $CFLAGS" + CFLAGS="-fexpensive-optimizations $CFLAGS" + fi + CFLAGS="-DNDEBUG $CFLAGS" +else + if test x$GCC = xyes; then + CFLAGS="-g -pedantic -Wall -Wextra -Wno-unused-parameter $CFLAGS" + fi + CFLAGS="-DDEBUG $CFLAGS" +fi + + +dnl Determine target directory for libisoburn-*.pc +dnl Important: Must be performed _after_ TARGET_SHIZZLE +dnl +LIBBURNIA_SET_PKGCONFIG + + +AH_TEMPLATE([Xorriso_with_readlinE], [Define to use libreadline]) +AC_ARG_ENABLE(libreadline, +[ --enable-libreadline Enable use of libreadline by xorriso, default=yes], + , enable_libreadline=yes) +if test x$enable_libreadline = xyes; then +dnl Check whether there is readline-devel and readline-runtime. +dnl If not, erase this macro which would enable use of readline(),add_history() + READLINE_DEF="-DXorriso_with_readlinE" + + if test x$XORRISO_OLD_READLINE_CONFIGURE = x + then + +dnl ts B00411 : To disable readline if not all needed functions are present + LIBBURNIA_ASSERT_READLINE + + else +dnl The empty yes case obviously causes -lreadline to be linked + AC_CHECK_HEADER(readline/readline.h, AC_CHECK_LIB(readline, readline, , READLINE_DEF= ), READLINE_DEF= ) +dnl The X= in the yes case prevents that -lreadline gets linked twice + AC_CHECK_HEADER(readline/history.h, AC_CHECK_LIB(readline, add_history, X= , READLINE_DEF= ), READLINE_DEF= ) + + fi +else + READLINE_DEF= +fi +if test x$READLINE_DEF = x-DXorriso_with_readlinE +then + AC_DEFINE([Xorriso_with_readlinE], []) +fi + +AH_TEMPLATE([Libisofs_with_aaip_acL], [Define to use ACL capabilities]) +AC_ARG_ENABLE(libacl, +[ --enable-libacl Enable use of ACL functions by libisofs, default=yes], + , enable_libacl=yes) +if test x$enable_libacl = xyes; then +dnl Check whether there is libacl-devel and libacl-runtime. +dnl If not, erase this macro which would enable use of acl_to_text and others + LIBACL_DEF="-DLibisofs_with_aaip_acL" +dnl The empty yes case obviously causes -lacl to be linked + has_acl_h_but_no_func=0 + AC_CHECK_HEADER(sys/acl.h, AC_CHECK_LIB(acl, acl_to_text, , has_acl_h_but_no_libacl=1 ), LIBACL_DEF= ) + if test "$has_acl_h_but_no_libacl" = 1 + then + AC_CHECK_LIB(c, acl_to_text, X= , LIBACL_DEF= ) + fi +else + LIBACL_DEF= +fi +if test x$LIBACL_DEF = x-DLibisofs_with_aaip_acL +then + AC_DEFINE([Libisofs_with_aaip_acL], []) +fi + + +AH_TEMPLATE([Libisofs_with_aaip_xattR], [Define to use xattr capabilities]) +AH_TEMPLATE([Libisofs_with_freebsd_extattR], [Define to use extattr capabilities]) +AC_ARG_ENABLE(xattr, +[ --enable-xattr Enable use of xattr by libisofs, default=yes], + , enable_xattr=yes) +if test x$enable_xattr = xyes; then +dnl Check whether there is the header for GNU/Linux xattr. +dnl If not, erase this macro which would enable use of listxattr and others + XATTR_DEF="-DLibisofs_with_aaip_xattR" + AC_CHECK_HEADER(attr/xattr.h, AC_CHECK_LIB(c, listxattr, X= , XATTR_DEF= ), XATTR_DEF= ) + if test "x$XATTR_DEF" = x + then + XATTR_DEF="-DLibisofs_with_freebsd_extattR" + AC_CHECK_HEADER(sys/extattr.h, AC_CHECK_LIB(c, extattr_list_file, X=, XATTR_DEF= ), XATTR_DEF= ) + fi +else + XATTR_DEF= +fi +if test x$XATTR_DEF = x-DLibisofs_with_aaip_xattR +then + AC_DEFINE([Libisofs_with_aaip_xattR], []) +fi +if test x$XATTR_DEF = x-DLibisofs_with_freebsd_extattR +then + AC_DEFINE([Libisofs_with_freebsd_extattR], []) +fi + + +AH_TEMPLATE([Libisofs_with_zliB], [Define to use compression via zlib]) +AH_TEMPLATE([LIBJTE_WITH_ZLIB], [Allow libjte to use zlib]) +AC_ARG_ENABLE(zlib, +[ --enable-zlib Enable use of zlib by libisofs, default=yes], + , enable_zlib=yes) +if test x$enable_zlib = xyes; then +dnl Check whether there is the header for zlib. +dnl If not, erase this macro which would enable use of compress2() and others. +dnl Linking fails on SuSE 9.0 because zlib has compress2() but lacks +dnl compressBound(). So compressBound is the more modern thing to test. +dnl The empty parameter after "compressBound" causes -lz. + ZLIB_DEF=yes + AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, compressBound, , ZLIB_DEF= ), ZLIB_DEF= ) +else + ZLIB_DEF= +fi +if test x$ZLIB_DEF = xyes +then + AC_DEFINE([Libisofs_with_zliB], []) + AC_DEFINE([LIBJTE_WITH_ZLIB], []) +fi + + +# libjte source is included in GNU xorriso. Enable it if zlib is enabled. +AH_TEMPLATE([Xorriso_with_libjtE], + [Define to use Jigdo Template Extraction via libjte]) +AH_TEMPLATE([Libisofs_with_libjtE], + [Define to use Jigdo Template Extraction via libjte]) +if test x$ZLIB_DEF = xyes +then + AC_DEFINE([Xorriso_with_libjtE], []) + AC_DEFINE([Libisofs_with_libjtE], []) + LIBJTE_DEF=yes + echo "enabled built-in libjte" +else + LIBJTE_DEF= + echo "disabled libjte because zlib not enabled or not available" +fi + + +AH_TEMPLATE([THREADED_CHECKSUMS], + [Define to use multi-threading in built-in libjte]) +AC_ARG_ENABLE(jtethreads, +[ --enable-jtethreads Enable multi-threading in libjte, default=yes], + , enable_jtethreads=yes) +if test x$LIBJTE_DEF = xyes +then + if test "x$enable_jtethreads" = xyes; then + AC_DEFINE([THREADED_CHECKSUMS], []) + echo "enabled multi-threading in libjte" + else + echo "disabled multi-threading in libjte" + fi + +fi + + +AH_TEMPLATE([LIBJTE_WITH_LIBBZ2], + [Define to use libbz2 by built-in libjte]) +AC_ARG_ENABLE(libbz2, +[ --enable-libbz2 Enable use of libbz2 by libjte, default=yes], + , enable_libbz2=yes) +if test "x$enable_libbz2" = xyes -a x$LIBJTE_DEF = xyes ; then +dnl Check whether there is the header for libbz2. + BZIP2_DEF=yes + AC_CHECK_HEADER(bzlib.h, AC_CHECK_LIB(bz2, BZ2_bzCompressInit, , BZIP2_DEF= ), BZIP2_DEF= ) +else + BZIP2_DEF= +fi +if test x$BZIP2_DEF = xyes +then + AC_DEFINE([LIBJTE_WITH_LIBBZ2], []) + BZIP2_DEF="-DLIBJTE_WITH_LIBBZ2" +fi + + +AH_TEMPLATE([Libburn_use_libcdiO], [Define to use libcdio as system adapter]) +AC_ARG_ENABLE(libcdio, +[ --enable-libcdio Enable EXPERIMENTAL use of libcdio as system adapter, default=no], + , enable_libcdio=no) +if test x$enable_libcdio = xyes; then +dnl Check whether there is libcdio-devel and libcdio-runtime. +dnl If not, erase this macro + LIBCDIO_DEF="-DLibburn_use_libcdiO" +dnl The empty yes case obviously causes -lcdio to be linked + AC_CHECK_HEADER(cdio/cdio.h, AC_CHECK_LIB(cdio, mmc_last_cmd_sense, , LIBCDIO_DEF= ), LIBCDIO_DEF= ) +else + LIBCDIO_DEF= +fi +if test x$LIBCDIO_DEF = x +then + if test x$enable_libcdio = xyes + then + echo "WARNING: could not enable use of libcdio as system adapter" + fi +else + echo "enabled EXPERIMENTAL use of libcdio as system adapter" +fi +if test x$LIBCDIO_DEF = x-DLibburn_use_libcdiO +then + AC_DEFINE([Libburn_use_libcdiO], []) +fi + + +AH_TEMPLATE([Xorriso_allow_external_filterS], [Define to allow xorriso to start external filter processes]) +AC_ARG_ENABLE(external-filters, +[ --enable-external-filters Enable use of external filter programs by xorriso, default=yes], + , enable_external_filters=yes) +if test x"$enable_external_filters" = xyes; then + EXTF_DEF="-DXorriso_allow_external_filterS" + echo "enabled xorriso external filter programs" +else + EXTF_DEF= + echo "disabled xorriso external filter programs" +fi +if test x$EXTF_DEF = x-DXorriso_allow_external_filterS +then + AC_DEFINE([Xorriso_allow_external_filterS], []) +fi + + +AH_TEMPLATE([Xorriso_allow_extf_suiD], [Define to allow external filters to xorriso when running under setuid]) +AC_ARG_ENABLE(external-filters-setuid, +[ --enable-external-filters-setuid Enable xorriso external filter programs under setuid, default=no], + , enable_external_filters_setuid=no) +if test x$enable_external_filters_setuid = xyes; then + EXTF_SUID_DEF="-DXorriso_allow_extf_suiD" + echo "enabled xorriso external filter programs under setuid" +else + EXTF_SUID_DEF= + echo "disabled xorriso external filter programs under setuid" +fi +if test x$EXTF_SUID_DEF = x-DXorriso_allow_extf_suiD +then + AC_DEFINE([Xorriso_allow_extf_suiD], []) +fi + + +AH_TEMPLATE([Xorriso_dvd_obs_default_64K], [Define to make 64 KB default size for DVD/BD writing]) +AC_ARG_ENABLE(dvd-obs-64k, +[ --enable-dvd-obs-64k 64 KB default size for DVD/BD writing, default=no], + , enable_dvd_obs=no) +if test x$enable_dvd_obs_64k = xyes; then + XORRISO_DVD_OBS_64K="-DXorriso_dvd_obs_default_64K" + echo "enabled xorriso write size default 64 KB on DVD and BD" +else + XORRISO_DVD_OBS_64K= + echo "disabled xorriso write size default 64 KB on DVD and BD" +fi +if test x$XORRISO_DVD_OBS_64K = x-DXorriso_dvd_obs_default_64K +then + AC_DEFINE([Xorriso_dvd_obs_default_64K], []) +fi + + +AH_TEMPLATE([Libburn_read_o_direcT], [Define to use O_DIRECT with -as cdrskin]) +AC_ARG_ENABLE(track-src-odirect, +[ --enable-track-src-odirect Enable use of O_DIRECT with -as cdrskin, default=no], + , enable_track_src_odirect=no) +if test x$enable_track_src_odirect = xyes; then + LIBBURN_O_DIRECT_DEF="-DLibburn_read_o_direcT" + echo "enabled use of O_DIRECT with input of -as cdrskin" +else + LIBBURN_O_DIRECT_DEF= + echo "disabled use of O_DIRECT with input of -as cdrskin" +fi +if test x$LIBBURN_O_DIRECT_DEF = x-DLibburn_read_o_direcT +then + AC_DEFINE([Libburn_read_o_direcT], []) +fi + + +# ------- Visible mark in configure : Start of library check + +# Check for proper library versions if this is desired. +# (It fails too often on too many systems.) +AC_ARG_ENABLE(pkg-check-modules, +[ --enable-pkg-check-modules Enable pkg-config check for libburn and libisofs , default=no], + , enable_pkg_check_modules=no) +if test x$enable_pkg_check_modules = xyes; then + +dnl If PKG_CHECK_MODULES is to be used after this if-block, +dnl then it might be necessary to perform PKG_PROG_PKG_CONFIG before the block. + + if test x$LIBCDIO_DEF = x; then + dummy=dummy + else + LIBCDIO_REQUIRED=0.83 + PKG_CHECK_MODULES(LIBCDIO, libcdio >= $LIBCDIO_REQUIRED) + fi +else + if test x$LIBCDIO_DEF = x; then + dummy=dummy + else + echo "checking for LIBCDIO... skipped, no --enable-pkg-check-modules" + fi +fi + +# ------- Visible mark in configure : End of library check + + +AC_CONFIG_FILES([ + Makefile + version.h + ]) +AC_OUTPUT +# xorriso.pc + diff --git a/libisoburn/branches/1.1.8/xorriso/convert_man_to_html.sh b/libisoburn/branches/1.1.8/xorriso/convert_man_to_html.sh new file mode 100755 index 00000000..9d3c9dcf --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/convert_man_to_html.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# +# convert_man_to_html.sh - ts B11024 +# +# Generates a HTML version of man pages xorriso.1 , xorrisofs.1 , xorrecord.1 +# +# To be executed in the libisoburn toplevel directory (eg. ./libisoburn-1.1.8) +# + +xorriso/man_xorriso_to_html.sh +xorriso/man_xorrisofs_to_html.sh +xorriso/man_xorrecord_to_html.sh + diff --git a/libisoburn/branches/1.1.8/xorriso/disk_ops.c b/libisoburn/branches/1.1.8/xorriso/disk_ops.c new file mode 100644 index 00000000..e76fc640 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/disk_ops.c @@ -0,0 +1,1920 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the implementation of actions on onjects of disk + filesystems. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + + +/* @param flag bit0= simple readlink(): no normalization, no multi-hop +*/ +int Xorriso_resolve_link(struct XorrisO *xorriso, + char *link_path, char result_path[SfileadrL], int flag) +{ + ssize_t l; + struct stat stbuf; + int link_count= 0, ret, show_errno= 0; + char *buf= NULL, *dirbuf= NULL, *lpt, *spt; + static int link_limit= 100; + + Xorriso_alloc_meM(buf, char, SfileadrL); + Xorriso_alloc_meM(dirbuf, char, SfileadrL); + + if(!(flag&1)) + if(stat(link_path, &stbuf)==-1) + if(errno==ELOOP) { + show_errno= errno; + goto too_many_hops; + } + lpt= link_path; + while(1) { + l= readlink(lpt, buf, SfileadrL-1); + if(l==-1) { +handle_error:; + Xorriso_msgs_submit(xorriso, 0, link_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "Cannot obtain link target of : "); + Text_shellsafe(link_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); +handle_abort:; + if(strcmp(lpt, link_path)!=0) { + sprintf(xorriso->info_text, + "Problem occured with intermediate path : "); + Text_shellsafe(lpt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + {ret= 0; goto ex;} + } + buf[l]= 0; + if(l==0) { + Xorriso_msgs_submit(xorriso, 0, link_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "Empty link target with : "); + Text_shellsafe(link_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + goto handle_abort; + } + + if(flag&1) { + strcpy(result_path, buf); + {ret= 1; goto ex;} + } + + /* normalize relative to disk_path */ + if(Sfile_str(dirbuf, lpt, 0)<=0) + {ret= -1; goto ex;} + while(1) { + spt= strrchr(dirbuf,'/'); + if(spt!=NULL) { + *spt= 0; + if(*(spt+1)!=0) + break; + } else + break; + } + ret= Xorriso_normalize_img_path(xorriso, dirbuf, buf, result_path, 2|4); + if(ret<=0) + goto ex; + + if(lstat(result_path, &stbuf)==-1) { + lpt= result_path; + goto handle_error; + } + if(!S_ISLNK(stbuf.st_mode)) + break; + + lpt= result_path; + link_count++; + if(link_count>link_limit) { +too_many_hops:; + Xorriso_msgs_submit(xorriso, 0, link_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "Too many link hops with : "); + Text_shellsafe(link_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, show_errno, + "FAILURE", 0); + {ret= 0; goto ex;} + } + } + ret= 1; +ex:; + Xorriso_free_meM(buf); + Xorriso_free_meM(dirbuf); + return(ret); +} + + +int Xorriso_convert_uidstring(struct XorrisO *xorriso, char *uid_string, + uid_t *uid, int flag) +{ + double num= 0.0; + char text[80]; + struct passwd *pwd; + + sscanf(uid_string, "%lf", &num); + sprintf(text,"%.f",num); + if(strcmp(text,uid_string)==0) { + *uid= num; + return(1); + } + pwd= getpwnam(uid_string); + if(pwd==NULL) { + sprintf(xorriso->info_text, "-uid: Not a known user: '%s'", uid_string); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + *uid= pwd->pw_uid; + return(1); +} + + +int Xorriso_convert_gidstring(struct XorrisO *xorriso, char *gid_string, + gid_t *gid, int flag) +{ + double num= 0.0; + char text[80]; + struct group *grp; + + sscanf(gid_string, "%lf", &num); + sprintf(text,"%.f",num); + if(strcmp(text,gid_string)==0) { + *gid= num; + return(1); + } + grp= getgrnam(gid_string); + if(grp==NULL) { + sprintf(xorriso->info_text, "-gid: Not a known group: '%s'", gid_string); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + *gid= grp->gr_gid; + return(1); +} + + +int Xorriso_convert_modstring(struct XorrisO *xorriso, char *cmd, char *mode, + mode_t *mode_and, mode_t *mode_or, int flag) +{ + int who_val= 0; + char *mpt, *vpt, *opt; + unsigned int num= 0; + mode_t mode_val,mask; + + *mode_and= ~0; + *mode_or= 0; + if(mode[0]=='0') { + *mode_and= 0; + sscanf(mode,"%o",&num); + *mode_or= num; + } else if(strchr(mode,'+')!=NULL || strchr(mode,'-')!=NULL + || strchr(mode,'=')!=NULL) { + /* [ugoa][+-][rwxst] */; + for(mpt= mode; mpt!=NULL; mpt= strchr(mpt, ',')) { + if(*mpt==',') + mpt++; + if(strlen(mpt)<2) + goto unrecognizable; + who_val= 0; + for(vpt= mpt; *vpt!='+' && *vpt!='-' && *vpt!='='; vpt++) { + if(*vpt=='u') + who_val|= 4; + else if(*vpt=='g') + who_val|= 2; + else if(*vpt=='o') + who_val|= 1; + else if(*vpt=='a') + who_val|= 7; + else + goto unrecognizable; + } + opt= vpt; + mode_val= 0; + for(vpt= opt+1; *vpt!=0 && *vpt!=','; vpt++) { + if(*vpt=='r') { + if(who_val&4) + mode_val|= S_IRUSR; + if(who_val&2) + mode_val|= S_IRGRP; + if(who_val&1) + mode_val|= S_IROTH; + } else if(*vpt=='w') { + if(who_val&4) + mode_val|= S_IWUSR; + if(who_val&2) + mode_val|= S_IWGRP; + if(who_val&1) + mode_val|= S_IWOTH; + } else if(*vpt=='x') { + if(who_val&4) + mode_val|= S_IXUSR; + if(who_val&2) + mode_val|= S_IXGRP; + if(who_val&1) + mode_val|= S_IXOTH; + } else if(*vpt=='s') { + if(who_val&4) + mode_val|= S_ISUID; + if(who_val&2) + mode_val|= S_ISGID; + } else if(*vpt=='t') { + if(who_val&1) + mode_val|= S_ISVTX; + } else + goto unrecognizable; + } + if(*opt=='+') { + (*mode_or)|= mode_val; + } else if(*opt=='=') { + mask= 0; + if(who_val&1) + mask|= S_IRWXO|S_ISVTX; + if(who_val&2) + mask|= S_IRWXG|S_ISGID; + if(who_val&4) + mask|= S_IRWXU|S_ISUID; + (*mode_and)&= ~(mask); + (*mode_or)= ((*mode_or) & ~mask) | mode_val; + } else if(*opt=='-') { + (*mode_or)&= ~mode_val; + (*mode_and)&= ~mode_val; + } + } + } else { +unrecognizable:; + sprintf(xorriso->info_text, + "%s: Unrecognizable or faulty permission mode ", cmd); + Text_shellsafe(mode, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + +/* @param flag bit0= for Xorriso_msgs_submit: use pager + bit1= do not issue warnings +*/ +int Xorriso_hop_link(struct XorrisO *xorriso, char *link_path, + struct LinkiteM **link_stack, struct stat *stbuf, int flag) +{ + int ret; + struct LinkiteM *litm; + + if(*link_stack != NULL) { + if(Linkitem_get_link_count(*link_stack, 0) >= xorriso->follow_link_limit) { + sprintf(xorriso->info_text, + "Too many symbolic links in single tree branch at : "); + Text_shellsafe(link_path, xorriso->info_text, 1); + if(!(flag&2)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,"WARNING",flag&1); + return(0); + } + } + ret= stat(link_path, stbuf); + if(ret==-1) + return(0); + ret= Linkitem_find(*link_stack, stbuf->st_dev, stbuf->st_ino, &litm, 0); + if(ret>0) { + sprintf(xorriso->info_text, "Detected symbolic link loop around : "); + Text_shellsafe(link_path, xorriso->info_text, 1); + if(!(flag&2)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", flag&1); + return(0); + } + ret= Linkitem_new(&litm, link_path, stbuf->st_dev, stbuf->st_ino, + *link_stack, 0); + if(ret<=0) { + sprintf(xorriso->info_text, + "Cannot add new item to link loop prevention stack"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", flag&1); + return(-1); + } + *link_stack= litm; + return(1); +} + + +/* @param flag bit0= do not only sum up sizes but also print subdirs + bit1= this is a recursion + @return <=0 error , 1 ok , 2 could not open directory +*/ +int Xorriso_show_dux_subs(struct XorrisO *xorriso, + char *abs_path, char *rel_path, off_t *size, + off_t boss_mem, + struct LinkiteM *link_stack, + int flag) +{ + int i, ret, no_sort= 0, filec= 0, l, j, fc, no_dive, is_link; + char **filev= NULL, *namept; + off_t sub_size, report_size, mem= 0; + struct DirseQ *dirseq= NULL; + struct stat stbuf; + dev_t dir_dev; + struct LinkiteM *own_link_stack; + char *path= NULL, *show_path= NULL, *name= NULL, *sfe= NULL; + + sfe= malloc(5*SfileadrL); + path= malloc(SfileadrL); + show_path= malloc(SfileadrL); + name= malloc(SfileadrL); + if(path==NULL || show_path==NULL || name==NULL || sfe==NULL) { + Xorriso_no_malloc_memory(xorriso, &sfe, 0); + {ret= -1; goto ex;} + } + own_link_stack= link_stack; + namept= name; + *size= 0; + + if(lstat(abs_path, &stbuf)==-1) + {ret= 2; goto ex;} + dir_dev= stbuf.st_dev; + if(S_ISLNK(stbuf.st_mode)) { + if(!(xorriso->do_follow_links || (xorriso->do_follow_param && !(flag&2)))) + {ret= 2; goto ex;} + if(stat(abs_path, &stbuf)==-1) + {ret= 2; goto ex;} + if(dir_dev != stbuf.st_dev && + !(xorriso->do_follow_mount || (xorriso->do_follow_param && !(flag&2)))) + {ret= 2; goto ex;} + } + ret= Dirseq_new(&dirseq, abs_path, 1); + if(ret<0) { + sprintf(xorriso->info_text, "Cannot obtain disk directory iterator"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + if(ret==0) + {ret= 2; goto ex;} + + while(1) { + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + ret= Dirseq_next_adr(dirseq,name,0); + if(ret<0) + goto ex; + if(ret==0) + break; + + sub_size= 0; + strcpy(show_path, rel_path); + if(Sfile_add_to_path(show_path, name, 0)<=0) + goto much_too_long; + + strcpy(path, abs_path); + if(Sfile_add_to_path(path, name, 0)<=0) { +much_too_long:; + Xorriso_much_too_long(xorriso, strlen(path)+strlen(name)+1, 2); + {ret= -1; goto ex;} + } + no_dive= 0; + + ret= lstat(path, &stbuf); + if(ret==-1) + continue; + is_link= S_ISLNK(stbuf.st_mode); + if(is_link && xorriso->do_follow_links) { + ret= Xorriso_hop_link(xorriso, path, &own_link_stack, &stbuf, 1); + if(ret<0) + {ret= -1; goto ex;} + if(ret!=1) + no_dive= 1; + } + if(!S_ISDIR(stbuf.st_mode)) + no_dive= 1; + if(dir_dev != stbuf.st_dev && !xorriso->do_follow_mount) + no_dive= 1; + if(!no_dive) { + filec++; + l= strlen(rel_path)+1; + mem+= l; + if(l % sizeof(char *)) + mem+= sizeof(char *)-(l % sizeof(char *)); + if(flag&1) /* diving and counting is done further below */ + continue; + ret= Xorriso_show_dux_subs(xorriso, path, show_path, &sub_size, boss_mem, + own_link_stack,2); + if(ret<0) + goto ex; + if(ret==0) + continue; + } + +/* + sub_size+= stbuf.st_size+strlen(name)+1; +*/ + sub_size+= stbuf.st_size+2048; + if(sub_size>0) + (*size)+= sub_size; + } + + if(filec<=0 || !(flag&1)) + {ret= 1; goto ex;} + + /* Try to get a sorted list of directory names */ + mem+= (filec+1)*sizeof(char *); + ret= Xorriso_check_temp_mem_limit(xorriso, mem+boss_mem, 2); + if(ret<0) + goto ex; + Dirseq_rewind(dirseq, 0); + if(ret==0) { +no_sort_possible:; + no_sort= 1; + } else { + filev= (char **) calloc(filec+1, sizeof(char *)); + if(filev==NULL) + goto no_sort_possible; + else { + for(i= 0; ido_follow_links) { + ret= stat(path,&stbuf); + if(ret==-1) + continue; + } + if(!S_ISDIR(stbuf.st_mode)) + continue; + if(dir_dev != stbuf.st_dev && !xorriso->do_follow_mount) + continue; + + if(fc>=filec) { /* Number of files changed (or programming error) */ +revoke_sorting:; + for(j=0; j1) + Sort_argv(filec, filev, 0); + } + } + + for(i= 0; (no_sort || irequest_to_abort); i++) { + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + if(no_sort) { + ret= Dirseq_next_adr(dirseq,name,0); + if(ret<0) + goto ex; + if(ret==0) + break; + } else + namept= filev[i]; + + sub_size= 0; + strcpy(show_path, rel_path); + if(Sfile_add_to_path(show_path, namept, 0)<=0) + goto much_too_long; + strcpy(path, abs_path); + if(Sfile_add_to_path(path, namept, 0)<=0) + goto much_too_long; + no_dive= 0; + + ret= lstat(path,&stbuf); + if(ret==-1) + continue; + is_link= S_ISLNK(stbuf.st_mode); + if(is_link && xorriso->do_follow_links) { + ret= Xorriso_hop_link(xorriso, path, &own_link_stack, &stbuf, 1); + if(ret<0) + {ret= -1; goto ex;} + if(ret!=1) + continue; + } + if(!S_ISDIR(stbuf.st_mode)) + continue; + if(dir_dev == stbuf.st_dev || xorriso->do_follow_mount) { + ret= Xorriso_show_dux_subs(xorriso, path, show_path, &sub_size, + boss_mem+mem, own_link_stack, 2|(flag&1)); + if(ret<0) + goto ex; + } + +/* + sub_size+= stbuf.st_size+strlen(namept)+1; +*/ + sub_size+= stbuf.st_size+2048; + if(sub_size>0) + (*size)+= sub_size; + report_size= sub_size/1024; + if(report_size*1024result_line, "%7.f ",(double) (report_size)); + sprintf(xorriso->result_line+strlen(xorriso->result_line), "%s\n", + Text_shellsafe(show_path, sfe, 0)); + Xorriso_result(xorriso, 0); + } + + ret= 1; +ex:; + if(sfe!=NULL) + free(sfe); + if(path!=NULL) + free(path); + if(show_path!=NULL) + free(show_path); + if(name!=NULL) + free(name); + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + Dirseq_destroy(&dirseq, 0); + if(filev!=NULL) { + for(i=0; i> 2) & 3; + if(hidden_state == 1) + perms[9]= 'I'; + else if(hidden_state == 2) + perms[9]= 'J'; + else if(hidden_state == 3) + perms[9]= 'H'; + if(flag & 2) { + if(hidden_state) + perms[9]= tolower(perms[9]); + else + perms[9]= '+'; + } + return(1); +} + + +/* @param flag bit0= recognize Xorriso_IFBOOT as file type + bit1= add '+' to perms + bit2-3: hidden_state : 0=off, 1=iso_rr, 2=joliet= 3=on +*/ +int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag) +{ + int show_major_minor= 0, high_shift= 0, high_mask= 0; + char *rpt, perms[11], mm_text[80]; + mode_t st_mode; + dev_t dev, major, minor; + + rpt= xorriso->result_line; + rpt[0]= 0; + st_mode= stbuf->st_mode; + + if(S_ISDIR(st_mode)) + strcat(rpt, "d"); + else if(S_ISREG(st_mode)) { + strcat(rpt, "-"); + } else if(S_ISLNK(st_mode)) + strcat(rpt, "l"); + else if(S_ISBLK(st_mode)) { + strcat(rpt, "b"); + show_major_minor= 1; + } else if(S_ISCHR(st_mode)) { + strcat(rpt, "c"); + show_major_minor= 1; + } else if(S_ISFIFO(st_mode)) + strcat(rpt, "p"); + else if(S_ISSOCK(st_mode)) + strcat(rpt, "s"); + else if((flag & 1) && (st_mode & S_IFMT) == Xorriso_IFBOOT) + strcat(rpt, "e"); + else + strcat(rpt, "?"); + + Xorriso__mode_to_perms(st_mode, perms, flag & (2 | 12)); + strcat(rpt, perms); + + sprintf(rpt+strlen(rpt)," %3u ",(unsigned int) stbuf->st_nlink); + + sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_uid); + sprintf(rpt+strlen(rpt), "%-8lu ", (unsigned long) stbuf->st_gid); + if(show_major_minor) { + dev= stbuf->st_rdev; + + /* according to /usr/include/sys/sysmacros.h : gnu_dev_major(),_minor() + >>> but this looks as if it should go to some system dependency + >>> in FreeBSD dev_t is 32 bit + */ + if(sizeof(dev_t) > 4) { + high_shift= 32; + high_mask= ~0xfff; + } + major= (((dev >> 8) & 0xfff) | + ((unsigned int) (dev >> high_shift) & high_mask)) + & 0xffffffff; + minor= (((dev & 0xff) | ((unsigned int) (dev >> 12) & ~0xff))) & 0xffffffff; + + sprintf(mm_text, "%u,%u", (unsigned int) major, (unsigned int) minor); + sprintf(rpt+strlen(rpt), "%8s ", mm_text); + } else + sprintf(rpt+strlen(rpt), "%8.f ", (double) stbuf->st_size); + + Ftimetxt(stbuf->st_mtime, rpt+strlen(rpt), 0); + strcat(rpt, " "); + + return(1); +} + + +struct DirentrY { + char *adr; + struct DirentrY *next; +}; + + +int Xorriso_sorted_dir_x(struct XorrisO *xorriso, char *dir_path, + int *filec, char ***filev, off_t boss_mem, int flag) +{ + int count= 0, ret; + char *name= NULL; + struct DirseQ *dirseq= NULL; + off_t mem; + struct DirentrY *last= NULL, *current= NULL; + + Xorriso_alloc_meM(name, char, SfileadrL); + + *filec= 0; + *filev= NULL; + mem= boss_mem; + ret= Dirseq_new(&dirseq, dir_path, 1); + if(ret<=0) + goto ex; + while(1) { /* loop over directory content */ + ret= Dirseq_next_adr(dirseq,name,0); + if(ret==0) + break; + if(ret<0) + goto ex; + mem+= strlen(name)+8+sizeof(struct DirentrY)+sizeof(char *); + if(mem>xorriso->temp_mem_limit) + {ret= 0; goto ex;} + + current= (struct DirentrY *) calloc(1, sizeof(struct DirentrY)); + if(current==NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + {ret= -1; goto ex;} + } + current->adr= NULL; + current->next= last; + last= current; + last->adr= strdup(name); + if(last->adr==NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + {ret= -1; goto ex;} + } + count++; + } + *filec= count; + if(count==0) + {ret= 1; goto ex;} + (*filev)= (char **) calloc(count, sizeof(char *)); + if(*filev==NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + {ret= -1; goto ex; } + } + count= 0; + for(current= last; current!=NULL; current= last) { + last= current->next; + (*filev)[count++]= current->adr; + free((char *) current); + } + Sort_argv(*filec, *filev, 0); + ret= 1; +ex:; + for(current= last; current!=NULL; current= last) { + last= current->next; + free(current->adr); + free((char *) current); + } + Xorriso_free_meM(name); + return(ret); +} + + +/* @param flag bit0= long format + bit1= do not print count of nodes + bit2= du format + bit3= print directories as themselves (ls -d) +*/ +int Xorriso_lsx_filev(struct XorrisO *xorriso, char *wd, + int filec, char **filev, off_t boss_mem, int flag) +{ + int i, ret, was_error= 0, dfilec= 0, pass, passes; + char *path= NULL, *acl_text= NULL; + char *rpt, *link_target= NULL, **dfilev= NULL; + off_t size; + struct stat stbuf; + + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(link_target, char, SfileadrL); + + rpt= xorriso->result_line; + + Sort_argv(filec, filev, 0); + + /* Count valid nodes, warn of invalid ones */ + for(i= 0; iinfo_text, "Not found in local filesystem: "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 1); + was_error++; + continue; + } + } + + if((flag&8) && !(flag&(2|4))) { + sprintf(xorriso->info_text,"Valid local files found: %d\n",filec-was_error); + Xorriso_info(xorriso,1); + if(filec-was_error<=0) + {ret= !was_error; goto ex;} + } + + passes= 1+!(flag&(4|8)); + for(pass= 0; passrequest_to_abort); i++) { + ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4); + if(ret<=0) + continue; + ret= lstat(path, &stbuf); + if(ret==-1) + continue; + if(S_ISLNK(stbuf.st_mode) && + (xorriso->do_follow_links || xorriso->do_follow_param)) { + ret= stat(path, &stbuf); + if(ret==-1) + ret= lstat(path, &stbuf); + if(ret==-1) + continue; + } + if(S_ISDIR(stbuf.st_mode) && !(flag&(4|8))) { + if(pass==0) + continue; + if(filec>1) { + strcpy(xorriso->result_line, "\n"); + Xorriso_result(xorriso,0); + Text_shellsafe(filev[i], xorriso->result_line, 0); + strcat(xorriso->result_line, ":\n"); + Xorriso_result(xorriso,0); + } + ret= Xorriso_sorted_dir_x(xorriso, path, &dfilec, &dfilev, boss_mem, 0); + if(ret<=0) { + + /* >>> DirseQ loop and single item Xorriso_lsx_filev() */; + + } else { + if(flag&1) { + sprintf(xorriso->result_line, "total %d\n", dfilec); + Xorriso_result(xorriso,0); + } + Xorriso_lsx_filev(xorriso, path, + dfilec, dfilev, boss_mem, (flag&1)|2|8); + } + if(dfilec>0) + Sfile_destroy_argv(&dfilec, &dfilev, 0); + continue; + } else + if(pass>0) + continue; + link_target[0]= 0; + rpt[0]= 0; + if((flag&5)==1) { + Xorriso_local_getfacl(xorriso, path, &acl_text, 16); + ret= Xorriso_format_ls_l(xorriso, &stbuf, (acl_text != NULL) << 1); + Xorriso_local_getfacl(xorriso, path, &acl_text, 1 << 15); + if(ret<=0) + continue; + if(S_ISLNK(stbuf.st_mode)) { + ret= Xorriso_resolve_link(xorriso, path, link_target, 1); + if(ret<=0) + link_target[0]= 0; + } + } else if(flag&4) { /* -du or -dus */ + size= stbuf.st_size; + if(S_ISDIR(stbuf.st_mode)) { + ret= Xorriso_show_dux_subs(xorriso, path, filev[i], &size, boss_mem, + NULL, flag&1); + if(ret<0) + {ret= -1; goto ex;} + if(ret==0) + continue; + } + sprintf(rpt, "%7.f ",(double) (size/1024)); + } + if(link_target[0]) { + Text_shellsafe(filev[i], xorriso->result_line, 1); + strcat(xorriso->result_line, " -> "); + Text_shellsafe(link_target, xorriso->result_line, 1 | 2); + } else { + Text_shellsafe(filev[i], xorriso->result_line, 1); + } + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + ret= !was_error; +ex:; + Xorriso_free_meM(path); + Xorriso_free_meM(link_target); + return(ret); +} + + +/* + @param flag >>> bit0= remove whole sub tree: rm -r + bit1= remove empty directory: rmdir + bit2= recursion: do not reassure in mode 2 "tree" + bit3= this is for overwriting and not for plain removal + bit4= count deleted files in xorriso->pacifier_count + bit5= with bit0 only remove directory content, not the directory + bit6= permission to call Xorriso_make_accessible() + @return <=0 = error + 1 = removed leaf file object + 2 = removed directory or tree + 3 = did not remove on user revocation +*/ +int Xorriso_rmx(struct XorrisO *xorriso, off_t boss_mem, char *path, int flag) +{ + int ret, is_dir= 0, made_accessible= 0; + struct stat victim_stbuf; + struct DirseQ *dirseq= NULL; + char *sfe= NULL, *sub_path= NULL; + struct PermiteM *perm_stack_mem; + + perm_stack_mem= xorriso->perm_stack; + + /* Avoiding large local memory objects in order to save stack space */ + sfe= malloc(5*SfileadrL); + sub_path= malloc(2*SfileadrL); + if(sfe==NULL || sub_path==NULL) { + Xorriso_no_malloc_memory(xorriso, &sfe, 0); + {ret= -1; goto ex;} + } + + if(Xorriso_much_too_long(xorriso, strlen(path), 0)<=0) + {ret= 0; goto ex;} + + ret= lstat(path, &victim_stbuf); + if(ret==-1) { + if((flag & 64) && errno == EACCES) { + ret= Xorriso_make_accessible(xorriso, path, 0); + if(ret < 0) + goto ex; + made_accessible= 1; + ret= lstat(path, &victim_stbuf); + } + if(ret==-1) { + sprintf(xorriso->info_text, "Cannot lstat(%s)", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + if(strcmp(path, "/")==0) { + sprintf(xorriso->info_text, "May not delete root directory"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(S_ISDIR(victim_stbuf.st_mode)) + is_dir= 1; + if(!is_dir) { + if(flag&2) { /* rmdir */ + sprintf(xorriso->info_text, "%s in disk filesystem is not a directory", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else { + if(flag&1) { /* rm -r */ + +#ifdef Osirrox_not_yeT + /* >>> */ + + struct stat *victim_node= NULL; + + victim_node= &victim_stbuf; + + if((xorriso->do_reassure==1 && !xorriso->request_not_to_ask) || + (flag&32)) { + /* Iterate over subordinates and delete them */ + mem= boss_mem; + + ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, + &iter, &node_array, &node_count, &node_idx, + &node, 1|2); + if(ret<=0) { +cannot_create_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + ret= -1; goto ex; + } + pl= strlen(path); + strcpy(sub_path, path); + if(pl==0 || sub_path[pl-1]!='/') { + sub_path[pl++]= '/'; + sub_path[pl]= 0; + } + sub_name= sub_path+pl; + while(1) { + ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter, + &node_array, &node_count, &node_idx, &node, 0); + if(ret<0) + goto ex; + if(ret==0 || xorriso->request_to_abort) + break; + name= (char *) iso_node_get_name(node); + if(Xorriso_much_too_long(xorriso, pl+1+strlen(name), 0)<=0) + {ret= 0; goto rm_r_problem_handler;} + strcpy(sub_name, name); + ret= Xorriso_rmi(xorriso, iter, mem, sub_path, (flag&(1|2|8|16))|4); + if(ret==3 || ret<=0 || xorriso->request_to_abort) { +rm_r_problem_handler:; + not_removed= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret<0) + goto dir_not_removed; + } + } + if(flag&32) + {ret= 2; goto ex;} + + if(not_removed) { +dir_not_removed:; + sprintf(xorriso->info_text, "Directory not removed: %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + if(ret>0) + ret= 3; + goto ex; + } + } + +#else /* Osirrox_not_yeT */ + + sprintf(xorriso->info_text, "-rm_rx is not implemented yet"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + +#endif /* !Osirrox_not_yeT */ + + } else { + if(!(flag&2)) { /* not rmdir */ + sprintf(xorriso->info_text, "%s in disk filesystem is a directory", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + ret= Dirseq_new(&dirseq, path, 1); + if(ret>0) { + ret= Dirseq_next_adr(dirseq, sfe, 0); + if(ret>0) { + sprintf(xorriso->info_text, + "Directory not empty on attempt to delete: %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + } + } + if(xorriso->request_to_abort) + {ret= 3; goto ex;} + ret= Xorriso_reassure_restore(xorriso, path, (flag&(4|8)) | !!is_dir); + if(ret<=0 || ret==3) + goto ex; + if(is_dir) + ret= rmdir(path); + else + ret= unlink(path); + if(ret == -1) { + if((flag & 64) && errno == EACCES && !made_accessible) { + ret= Xorriso_make_accessible(xorriso, path, 0); + if(ret < 0) + goto ex; + made_accessible= 1; + if(is_dir) + ret= rmdir(path); + else + ret= unlink(path); + } + if(ret == -1) { + sprintf(xorriso->info_text, "Cannot delete from disk filesystem %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= -1; goto ex; + } + } + if(flag&16) + xorriso->pacifier_count++; + ret= 1+!!is_dir; +ex:; + if(made_accessible) + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + if(sfe!=NULL) + free(sfe); + if(sub_path!=NULL) + free(sub_path); + Dirseq_destroy(&dirseq, 0); + return(ret); +} + + +/* @param flag bit0= recursion +*/ +int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, + char *abs_path, char *show_path, int depth, int flag) +{ + int ret= 0, type, action= 0, dpl= 0, compare_result, uret; + uid_t user= 0; + gid_t group= 0; + time_t date= 0; + mode_t mode_or= 0, mode_and= ~1; + char *target, *text_2, *wdi_mem= NULL, *disk_prefix, *iso_path= NULL; + char *basename; + struct FindjoB *subjob; + struct stat stbuf; + + Xorriso_alloc_meM(iso_path, char, SfileadrL); + + action= Findjob_get_action_parms(job, &target, &text_2, &user, &group, + &mode_and, &mode_or, &type, &date, &subjob, 0); + if(action<0) + action= 0; + if(action<0) + action= 0; + if(action==15 || action==16 || action==18 || action==19 || action==20) { + /* in_iso , not_in_iso, add_missing , empty_iso_dir , is_full_in_iso */ + Findjob_get_start_path(job, &disk_prefix, 0); + if(strncmp(abs_path, disk_prefix, strlen(disk_prefix))!=0) + {ret= -1; goto ex;} + dpl= strlen(disk_prefix); + if(strlen(target)+strlen(abs_path)-dpl >= SfileadrL) + {ret= -1; goto ex;} + if(abs_path[dpl]=='/') + dpl++; + ret= Xorriso_make_abs_adr(xorriso, target, abs_path+dpl, iso_path, 4); + if(ret<=0) + {goto ex;} + + } + if(action==15) { /* in_iso */ + ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); + if(ret<0) + {ret= 1; goto ex;} + Text_shellsafe(show_path, xorriso->result_line, 0); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + ret= 1; + } else if(action==16) { /* not_in_iso */ + ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl, + &compare_result, 4); + if(retfind_compare_result) + xorriso->find_compare_result= ret; + if(ret>=0) + ret= 1; + } else if(action==18) { /* add_missing */ + ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl, + &compare_result, 4|(1<<31)); + if(retfind_compare_result) + xorriso->find_compare_result= ret; + if(ret==0) { + uret= Xorriso_update_interpreter(xorriso, NULL, NULL, compare_result, + abs_path, iso_path, ((flag&1)<<2) | 2); + if(uret<=0) + ret= 0; + } + if(ret>=0) + ret= 1; + } else if(action==19) { /* empty_iso_dir */ + ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); + if(ret<0) + {ret= 1; goto ex;} + if(!S_ISDIR(stbuf.st_mode)) + {ret= 1; goto ex;} + ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, iso_path, 1|32); + if(ret>0) { + sprintf(xorriso->info_text, "Emptied directory "); + Text_shellsafe(iso_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + } + } else if(action==20) { /* is_full_in_iso */ + ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); + if(ret<0) + {ret= 1; goto ex;} + if(!S_ISDIR(stbuf.st_mode)) + {ret= 1; goto ex;} + wdi_mem= strdup(xorriso->wdi); + if(wdi_mem == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + {ret= -1; goto ex;} + } + strcpy(xorriso->wdi, iso_path); + ret= Xorriso_ls(xorriso, 4|8); + strcpy(xorriso->wdi, wdi_mem); + if(ret>0) { + strcpy(xorriso->result_line, "d "); + Text_shellsafe(iso_path, xorriso->result_line, 1); + strcat(xorriso->result_line, + " (ISO) : non-empty directory (would not match mount point)\n"); + Xorriso_result(xorriso,0); + } + {ret= 1; goto ex;} + } else if(action == 40) { /* estimate_size */ + basename= strrchr(abs_path, '/'); + if(basename != NULL) + basename++; + else + basename= abs_path; + ret= lstat(abs_path, &stbuf); + if(ret != -1) + ret= Xorriso_estimate_file_size(xorriso, job, basename, stbuf.st_mode, + stbuf.st_size, 0); + } else if(action == 44) { /* list_extattr */ + ret= Xorriso_list_extattr(xorriso, NULL, abs_path, show_path, target, 2); + } else { + Text_shellsafe(show_path, xorriso->result_line, 0); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + ret= 1; + } +ex:; + if(action==15 || action==16 || action==18 || action==19 || action==20) + if(xorriso->no_volset_present) + xorriso->request_to_abort= 1; /* Need an image. No use to try again. */ + if(wdi_mem != NULL) + free(wdi_mem); + Xorriso_free_meM(iso_path); + return(ret); +} + + +/* @param flag bit0=recursion +*/ +int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job, + char *abs_dir_parm, char *dir_path, + struct stat *dir_stbuf, int depth, + struct LinkiteM *link_stack, int flag) +{ + int ret,is_link, no_dive; + struct DirseQ *dirseq= NULL; + struct stat stbuf; + struct LinkiteM *own_link_stack; + char *abs_dir_path, *namept; + char *name= NULL, *path= NULL, *sfe= NULL; + char *abs_dir_path_data= NULL, *abs_path= NULL; + + if(xorriso->request_to_abort) + {ret= 0; goto ex;} + + Xorriso_alloc_meM(sfe, char, 5*SfileadrL); + Xorriso_alloc_meM(name, char, SfileadrL); + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(abs_dir_path_data, char, SfileadrL); + Xorriso_alloc_meM(abs_path, char, SfileadrL); + + own_link_stack= link_stack; + abs_dir_path= abs_dir_parm; + if(abs_dir_path[0]==0) { + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, dir_path, + abs_dir_path_data, 1|2|8); + if(ret<=0) + goto ex; + abs_dir_path= abs_dir_path_data; + ret= Xorriso_path_is_excluded(xorriso, abs_dir_path, !(flag&1)); + if(ret<0) + goto ex; + if(ret>0) + {ret= 0; goto ex;} + ret= lstat(abs_dir_path, dir_stbuf); + if(ret==-1) + {ret= 0; goto ex;} + if(S_ISLNK(dir_stbuf->st_mode) && + (xorriso->do_follow_links || (xorriso->do_follow_param && !(flag&1)))) + if(stat(abs_dir_path, &stbuf)!=-1) + if(dir_stbuf->st_dev == stbuf.st_dev || + (xorriso->do_follow_mount || (xorriso->do_follow_param && !(flag&1)))) + memcpy(dir_stbuf, &stbuf, sizeof(struct stat)); + + namept= strrchr(dir_path, '/'); + if(namept==NULL) + namept= dir_path; + else + namept++; + + ret= Findjob_test_2(xorriso, job, NULL, namept, dir_path, NULL, dir_stbuf, + 0); + if(ret<0) + goto ex; + if(ret>0) { + ret= Xorriso_findx_action(xorriso, job, abs_dir_path, dir_path, depth, + flag&1); + if(xorriso->request_to_abort) + {ret= 0; goto ex;} + if(ret<=0) { + if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) + goto ex; + } + } + } + if(xorriso->request_to_abort) + {ret= 1; goto ex;} + if(!S_ISDIR(dir_stbuf->st_mode)) + {ret= 2; goto ex;} + + ret= Dirseq_new(&dirseq, abs_dir_path, 1); + if(ret<0) { + sprintf(xorriso->info_text, "Cannot obtain disk directory iterator"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + if(ret==0) + {ret= 2; goto ex;} + + while(!xorriso->request_to_abort) { + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + ret= Dirseq_next_adr(dirseq,name,0); + if(ret==0) + break; + if(ret<0) { + sprintf(xorriso->info_text,"Failed to obtain next directory entry"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + ret= Xorriso_make_abs_adr(xorriso, abs_dir_path, name, abs_path, 1); + if(ret<=0) + goto ex; + ret= Xorriso_make_abs_adr(xorriso, dir_path, name, path, 4); + if(ret<=0) + goto ex; + ret= Xorriso_path_is_excluded(xorriso, abs_path, 0); /* (is never param) */ + if(ret<0) + goto ex; + if(ret>0) + continue; + ret= lstat(abs_path, &stbuf); + if(ret==-1) + continue; + no_dive= 0; + + is_link= S_ISLNK(stbuf.st_mode); + if(is_link && xorriso->do_follow_links) { + ret= Xorriso_hop_link(xorriso, abs_path, &own_link_stack, &stbuf, 2); + if(ret<0) + {ret= -1; goto ex;} + if(ret!=1) + no_dive= 1; + } + + ret= Findjob_test_2(xorriso, job, NULL, name, path, dir_stbuf, &stbuf, 0); + if(ret<0) + goto ex; + if(ret>0) { + ret= Xorriso_findx_action(xorriso, job, abs_path, path, depth, flag&1); + if(xorriso->request_to_abort) + {ret= 0; goto ex;} + if(ret<=0) { + if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) + goto ex; + } + } + if(!S_ISDIR(stbuf.st_mode)) + no_dive= 1; + if(dir_stbuf->st_dev != stbuf.st_dev && !xorriso->do_follow_mount) + no_dive= 1; + if(!no_dive) { + ret= Xorriso_findx(xorriso, job, abs_path, path, &stbuf, depth+1, + own_link_stack, flag|1); + if(ret<0) + goto ex; + } + } + + ret= 1; +ex:; + Xorriso_free_meM(sfe); + Xorriso_free_meM(name); + Xorriso_free_meM(path); + Xorriso_free_meM(abs_dir_path_data); + Xorriso_free_meM(abs_path); + Dirseq_destroy(&dirseq, 0); + return(ret); +} + + +/* @param flag bit0= no hardlink reconstruction + bit1= do not set xorriso->node_*_prefixes + bit5= -extract_single: eventually do not insert directory tree +*/ +int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, + char **src_array, char **tgt_array, + int *problem_count, int flag) +{ + int i, ret, with_node_array= 0, hflag= 0, hret; + + *problem_count= 0; + if(!(((xorriso->ino_behavior & 16) && xorriso->do_restore_sort_lba) || + (xorriso->ino_behavior & 4) || (flag & 1))) { + ret= Xorriso_make_hln_array(xorriso, 0); + if(ret<=0) + goto ex; + } + if(xorriso->do_restore_sort_lba) { + /* Count affected nodes */ + Xorriso_destroy_node_array(xorriso, 0); + for(i= 0; i < count; i++) { + if(src_array[i] == NULL || tgt_array[i] == NULL) + continue; + /* sort_lba : Make directories plus node_array and then + run array extractor (with eventual hardlink detection) + */ + hflag= (1 << 7) | ((!!(flag & 2)) << 9) | (flag & 32); + ret= Xorriso_restore(xorriso, src_array[i], tgt_array[i], + (off_t) 0, (off_t) 0, hflag); + if(ret <= 0) { + (*problem_count)++; + hret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(hret < 0) + goto ex; + } + with_node_array= 1; + } + } + + if(with_node_array) { + /* Allocate and fill node array */ + if(xorriso->node_counter <= 0) + {ret= 2; goto ex;} + ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, 0, + !xorriso->do_restore_sort_lba); + if(ret<=0) + goto ex; + for(i= 0; i < count; i++) { + if(src_array[i] == NULL || tgt_array[i] == NULL) + continue; + ret= Xorriso_restore(xorriso, src_array[i], tgt_array[i], + (off_t) 0, (off_t) 0, (2 << 7) | (flag & 32)); + if(ret <= 0) { + (*problem_count)++; + hret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(hret < 0) + goto ex; + } + } + } + + /* Perform restore operations */ + if(xorriso->do_restore_sort_lba) { + ret= Xorriso_restore_node_array(xorriso, 0); + if(ret <= 0) + goto ex; + } else { + for(i= 0; i < count; i++) { + if(src_array[i] == NULL || tgt_array[i] == NULL) + continue; + ret= Xorriso_restore(xorriso, src_array[i], tgt_array[i], + (off_t) 0, (off_t) 0, flag & 32); + if(ret <= 0) { + (*problem_count)++; + hret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(hret < 0) + goto ex; + } + } + } + + ret= 1; +ex:; + return(ret); +} + + +/* @param flag bit0= path is a directory + bit2= recursion: do not reassure in mode 2 "tree" + bit3= this is for overwriting and not for plain removal +*/ +int Xorriso_reassure_restore(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + + while((xorriso->do_reassure==1 || (xorriso->do_reassure==2 && !(flag&4))) + && !xorriso->request_not_to_ask) { + /* ls -ld */ + Xorriso_lsx_filev(xorriso, xorriso->wdx, 1, &path, (off_t) 0, 1|2|8); + if(flag&1) /* du -s */ + Xorriso_lsx_filev(xorriso, xorriso->wdx, 1, &path, (off_t) 0, 2|4); + if(flag&8) + sprintf(xorriso->info_text, + "File exists. Remove ? n= keep old, y= remove, x= abort, @= stop asking\n"); + else + sprintf(xorriso->info_text, + "Remove above file ? n= keep it, y= remove it, x= abort, @= stop asking\n"); + Xorriso_info(xorriso, 4); + ret= Xorriso_request_confirmation(xorriso, 1|2|4|16); + if(ret<=0) + goto ex; + if(xorriso->request_to_abort) { + sprintf(xorriso->info_text, + "Removal operation aborted by user before file: "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 3; goto ex; + } + if(ret==3) + continue; + if(ret==6) /* yes */ + break; + if(ret==4) { /* yes, do not ask again */ + xorriso->request_not_to_ask= 1; + break; + } + if(ret==1) { /* no */ + sprintf(xorriso->info_text, "Kept in existing state: "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 3; goto ex; + } + } + ret= 1; +ex: + return(ret); +} + + +/* @param flag bit7= return 4 if restore fails from denied permission + do not issue error message + @return <=0 failure , 1 success , + 4 with bit7: permission to create file was denied +*/ +int Xorriso_make_tmp_path(struct XorrisO *xorriso, char *orig_path, + char *tmp_path, int *fd, int flag) +{ + char *cpt; + + cpt= strrchr(orig_path, '/'); + if(cpt==NULL) + tmp_path[0]= 0; + else { + strncpy(tmp_path, orig_path, cpt+1-orig_path); + tmp_path[cpt+1-orig_path]= 0; + } + strcat(tmp_path, "_tmp_xorriso_restore_XXXXXX"); + *fd= mkstemp(tmp_path); + if(*fd==-1) { + if(errno == EACCES && (flag & 128)) + return(4); + strcpy(xorriso->info_text, "Cannot create temporary file : "); + Text_shellsafe(tmp_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + return(0); + } + fchmod(*fd, S_IRUSR|S_IWUSR); + return(1); +} + + +/* @param flag bit0= change regardless of xorriso->do_auto_chmod + bit1= desired is only rx + @return -1=severe error , -2= cannot chmod, 0= nothing to do, 1 = chmoded +*/ +int Xorriso_auto_chmod(struct XorrisO *xorriso, char *disk_path, int flag) +{ + int ret, is_link= 0; + char *path_pt, *link_target= NULL; + mode_t mode, desired= S_IRUSR | S_IWUSR | S_IXUSR; + struct stat stbuf; + + Xorriso_alloc_meM(link_target, char, SfileadrL); + + if(!(xorriso->do_auto_chmod || (flag & 1))) + {ret= 0; goto ex;} + + if(flag & 2) + desired &= ~S_IWUSR; + path_pt= disk_path; + ret= lstat(path_pt, &stbuf); + if(ret==-1) + {ret= 0; goto ex;} + if(S_ISLNK(stbuf.st_mode)) { + is_link= 1; + ret= stat(path_pt, &stbuf); + if(ret==-1) + {ret= 0; goto ex;} + } + if(!S_ISDIR(stbuf.st_mode)) + {ret= 0; goto ex;} + if(is_link) { + ret= Xorriso_resolve_link(xorriso, path_pt, link_target, 0); + if(ret<=0) + goto ex; + path_pt= link_target; + } + if((stbuf.st_mode & desired) == desired) + {ret= 0; goto ex;} + if(stbuf.st_uid!=geteuid()) + {ret= -2; goto ex;} + + mode= (stbuf.st_mode | desired) & 07777; + ret= chmod(path_pt, mode); + if(ret==-1) { + sprintf(xorriso->info_text, + "Cannot change access permissions of disk directory: chmod %o ", + (unsigned int) (mode & 07777)); + Text_shellsafe(path_pt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0); + {ret= -2; goto ex;} + } + ret= Permstack_push(&(xorriso->perm_stack), path_pt, &stbuf, 0); + if(ret<=0) + goto ex; + ret= 1; +ex:; + Xorriso_free_meM(link_target); + return(ret); +} + + +int Xorriso_make_accessible(struct XorrisO *xorriso, char *disk_path, int flag) +{ + int done= 0, ret, just_rx= 2; + char *npt, *apt, *path, *wpt; + + Xorriso_alloc_meM(path, char, SfileadrL); + + apt= disk_path; + wpt= path; + for(npt= apt; !done; apt= npt + 1) { + npt= strchr(apt, '/'); + if(npt == NULL) + break; + if(strchr(npt + 1, '/') == NULL) + just_rx= 0; + strncpy(wpt, apt, npt + 1 - apt); + wpt+= npt + 1 - apt; + *wpt= 0; + ret= Xorriso_auto_chmod(xorriso, path, just_rx); + if(ret == -1) + {ret= -1; goto ex;} + if(ret == -2) + {ret= 0; goto ex;} + } + ret= 1; +ex: + Xorriso_free_meM(path); + return(ret); +} + + +/* @param flag bit0= prefer to find a match after *img_prefixes + (but deliver img_prefixes if no other can be found) +*/ +int Xorriso_make_restore_path(struct XorrisO *xorriso, + struct Xorriso_lsT **img_prefixes, struct Xorriso_lsT **disk_prefixes, + char img_path[SfileadrL], char disk_path[SfileadrL], int flag) +{ + int li; + struct Xorriso_lsT *s, *d, *found_s= NULL, *found_d= NULL; + char *ipfx, *dpfx; + + /* Obtain disk_path by replacing start piece of img_path */ + + d= *disk_prefixes; + for(s= *img_prefixes; s != NULL; + s= Xorriso_lst_get_next(s, 0), d= Xorriso_lst_get_next(d, 0)) { + + ipfx= Xorriso_lst_get_text(s, 0); + li= strlen(ipfx); + dpfx= Xorriso_lst_get_text(d, 0); + if(strncmp(img_path, ipfx, li) != 0) + continue; + if(img_path[li] != 0 && img_path[li] != '/') + continue; + if(strlen(dpfx) + strlen(img_path) - li + 1 >= SfileadrL) + return(-1); + if(img_path[li]=='/') + sprintf(disk_path, "%s/%s", dpfx, img_path + strlen(ipfx) + 1); + else + strcpy(disk_path, dpfx); + found_s= s; + found_d= d; + if(s != *img_prefixes || !(flag & 1)) + break; + } + *img_prefixes= found_s; + *disk_prefixes= found_d; + return(found_s != NULL); +} + + +/* @param flag bit0=permission to run Xorriso_make_accessible +*/ +int Xorriso_restore_make_hl(struct XorrisO *xorriso, + char *old_path, char *new_path, int flag) +{ + int ret; + struct PermiteM *perm_stack_mem; + + ret= link(old_path, new_path); + if(ret == 0) + return(1); + if(errno == EACCES && (flag & 1)) { + perm_stack_mem= xorriso->perm_stack; + ret= Xorriso_make_accessible(xorriso, new_path, 0); + if(ret > 0) { + ret= link(old_path, new_path); + if(ret == 0) { + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + return(1); + } + } + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + } + + sprintf(xorriso->info_text, "Hardlinking failed: "); + Text_shellsafe(new_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " -> "); + Text_shellsafe(old_path, xorriso->info_text, 1 | 2); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "WARNING", 0); + return(0); +} + + +int Xorriso_afile_fopen(struct XorrisO *xorriso, + char *filename, char *mode, FILE **ret_fp, int flag) +/* + bit0= do not print error message on failure + bit1= do not open stdin +*/ +{ + FILE *fp= NULL; + + *ret_fp= NULL; + if(strcmp(filename,"-")==0) { + if(mode[0]=='a' || mode[0]=='w' || + (mode[0]=='r' && mode[1]=='+') || + (mode[0]=='r' && mode[1]=='b' && mode[2]=='+')) + fp= stdout; + else if(flag & 2) { + Xorriso_msgs_submit(xorriso, 0, "Not allowed as input path: '-'", 0, + "FAILURE", 0); + return(0); + } else { + Xorriso_msgs_submit(xorriso, 0, "Ready for data at standard input", 0, + "NOTE", 0); + fp= stdin; + } + } else if(strncmp(filename,"tcp:",4)==0){ + Xorriso_msgs_submit(xorriso, 0, "TCP/IP service isn't implemented yet.", 0, + "FAILURE", 0); + } else if(strncmp(filename,"file:",5)==0){ + fp= fopen(filename+5,mode); + } else { + fp= fopen(filename,mode); + } + if(fp==NULL){ + if(!(flag&1)) { + sprintf(xorriso->info_text, + "Failed to open file '%s' in %s mode\n", filename, mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + } + return(0); + } + *ret_fp= fp; + return(1); +} + + +/* + @param flag bit0= make absolute command paths with known systems + bit1= do not allow prefixes with cmd + bit2= interpret unprefixed cmd as shell: +*/ +int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd, + int lba, int track, int session, char *volid, + char *devadr, char result[SfileadrL], int flag) +{ + int ret, reg_file= 0, is_safe= 0, sys_code= 0; + char *form= NULL, session_text[12], track_text[12], lba_text[12]; + char *vars[5][2], *sfe= NULL, *volid_sfe= NULL, *cpt, *sysname; + struct stat stbuf; + + Xorriso_alloc_meM(form, char, 6 * SfileadrL); + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL); + Xorriso_alloc_meM(volid_sfe, char, 5 * 80 + 1); + + if(strlen(cmd) > SfileadrL) { + Xorriso_msgs_submit(xorriso, 0, "Argument much too long", 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= stat(devadr, &stbuf); + if(ret != -1) + if(S_ISREG(stbuf.st_mode)) + reg_file= 1; + if(strncmp(cmd, "linux:", 6) == 0 && !(flag & 2)) { + cpt= cmd + 6; + sys_code= 1; + } else if(strncmp(cmd, "freebsd:", 8) == 0 && !(flag & 2)) { + cpt= cmd + 8; + sys_code= 2; + } else if(strncmp(cmd, "string:", 7) == 0 && !(flag & 2)) { + cpt= cmd + 7; + strcpy(form, cpt); + } else if(flag & 4) { + cpt= cmd; + strcpy(form, cpt); + } else { + cpt= cmd; + ret= System_uname(&sysname, NULL, NULL, NULL, 0); + if(ret <= 0) { + Xorriso_msgs_submit(xorriso, 0, + "-mount*: Cannot determine current system type", + 0, "FAILURE", 0); + {ret= 0; goto ex;} + } else if(strcmp(sysname, "FreeBSD") == 0 || + strcmp(sysname, "GNU/kFreeBSD") == 0) { + /* "GNU/kFreeBSD" = Debian kfreebsd */ + sys_code= 2; + } else if(strcmp(sysname, "Linux") == 0) { + sys_code= 1; + } else { + sprintf(xorriso->info_text, "-mount*: Unsupported system type %s", + Text_shellsafe(sysname, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + + if(sys_code == 1) { /* GNU/Linux */ + sprintf(form, + "%smount -t iso9660 -o %snodev,noexec,nosuid,ro,sbsector=%%sbsector%% %%device%% %s", + (flag & 1 ? "/bin/" : ""), + (reg_file || (xorriso->mount_opts_flag & 1) ? "loop," : ""), + Text_shellsafe(cpt, sfe, 0)); + is_safe= 1; + } else if(sys_code == 2) { /* FreeBSD */ + if(reg_file) { + +/* <<< Considered to create vnode as of + J.R. Oldroyd , 20 Nov 2008 + but for now refraining from creating that persistent file object + + strcpy(form, "n=$(mdconfig -a -t vnode -f %device%)"); + sprintf(form + strlen(form), + " && mount -t cd9660 -o noexec,nosuid -s %%sbsector%% /dev/\"$n\" %s", + Text_shellsafe(cmd+8, sfe, 0)); +*/ + + Xorriso_msgs_submit(xorriso, 0, + "Detected regular file as mount device with FreeBSD style command.", + 0, "FAILURE", 0); + Xorriso_msgs_submit(xorriso, 0, +"Command mdconfig -a -t vnode -f can create a device node which uses the file", + 0, "HINT", 0); + {ret= 0; goto ex;} + } else { + sprintf(form, + "%smount_cd9660 -o noexec,nosuid -s %%sbsector%% %%device%% %s", + (flag & 1 ? "/sbin/" : ""), Text_shellsafe(cmd+8, sfe, 0)); + /* + Not working on FreeBSD 7.2 according to Zsolt Kuti, 11 Oct 2009: + "%smount -t cd9660 -o noexec,nosuid -o -s %%sbsector%% %%device%% %s", + */ + } + is_safe= 1; + } + sprintf(session_text, "%d", session); + sprintf(track_text, "%d", track); + sprintf(lba_text, "%d", lba); + vars[0][0]= "sbsector"; + vars[0][1]= lba_text; + vars[1][0]= "track"; + vars[1][1]= track_text; + vars[2][0]= "session"; + vars[2][1]= session_text; + vars[3][0]= "volid"; + vars[3][1]= Text_shellsafe(volid, volid_sfe, 0); + vars[4][0]= "device"; + vars[4][1]= Text_shellsafe(devadr, sfe, 0); + ret= Sregex_resolve_var(form, vars, 5, "%", "%", "%", result, SfileadrL, 0); + if(ret <= 0) + goto ex; + ret= 1 + is_safe; +ex:; + Xorriso_free_meM(form); + Xorriso_free_meM(sfe); + Xorriso_free_meM(volid_sfe); + return(ret); +} + + +int Xorriso_append_scdbackup_record(struct XorrisO *xorriso, int flag) +{ + FILE *fp= NULL; + char dummy[81], name[81], timestamp[81], size[81], md5[81]; + + if(xorriso->scdbackup_tag_written[0] == 0) + return(1); + + name[0]= timestamp[0]= size[0]= md5[0]= 0; + sscanf(xorriso->scdbackup_tag_written, "%s %s %s %s %s %s %s", + dummy, dummy, dummy, name, timestamp, size, md5); + sprintf(xorriso->info_text, "scdbackup tag written : %s %s %s %s\n", + name, timestamp, size, md5); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + + if(xorriso->scdbackup_tag_listname[0]) { + fp= fopen(xorriso->scdbackup_tag_listname, "a"); + if(fp==0) { + strcpy(xorriso->info_text, "-scdbackup_tag: Cannot open file "); + Text_shellsafe(xorriso->scdbackup_tag_listname, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + fprintf(fp, "%s %s %s %s\n", name, timestamp, size, md5); + fclose(fp); + } + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/disk_ops.h b/libisoburn/branches/1.1.8/xorriso/disk_ops.h new file mode 100644 index 00000000..fbce0f69 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/disk_ops.h @@ -0,0 +1,117 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of class DirseQ which + crawls along a directory's content list. +*/ + + +#ifndef Xorriso_pvt_diskop_includeD +#define Xorriso_pvt_diskop_includeD yes + + +/* @param flag bit0= simple readlink(): no normalization, no multi-hop +*/ +int Xorriso_resolve_link(struct XorrisO *xorriso, + char *link_path, char result_path[SfileadrL], int flag); + +int Xorriso_convert_gidstring(struct XorrisO *xorriso, char *gid_string, + gid_t *gid, int flag); + +int Xorriso_convert_modstring(struct XorrisO *xorriso, char *cmd, char *mode, + mode_t *mode_and, mode_t *mode_or, int flag); + +int Xorriso_convert_uidstring(struct XorrisO *xorriso, char *uid_string, + uid_t *uid, int flag); + +/* @param flag bit0= for Xorriso_msgs_submit: use pager +*/ +int Xorriso_hop_link(struct XorrisO *xorriso, char *link_path, + struct LinkiteM **link_stack, struct stat *stbuf, int flag); + +int Xorriso__mode_to_perms(mode_t st_mode, char perms[11], int flag); + +int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag); + +/* @param flag bit0= long format + bit1= do not print count of nodes + bit2= du format + bit3= print directories as themselves (ls -d) +*/ +int Xorriso_lsx_filev(struct XorrisO *xorriso, char *wd, + int filec, char **filev, off_t boss_mem, int flag); + +/* + @param flag >>> bit0= remove whole sub tree: rm -r + bit1= remove empty directory: rmdir + bit2= recursion: do not reassure in mode 2 "tree" + bit3= this is for overwriting and not for plain removal + bit4= count deleted files in xorriso->pacifier_count + bit5= with bit0 only remove directory content, not the directory + @return <=0 = error + 1 = removed leaf file object + 2 = removed directory or tree + 3 = did not remove on user revocation +*/ +int Xorriso_rmx(struct XorrisO *xorriso, off_t boss_mem, char *path, int flag); + +int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job, + char *abs_dir_parm, char *dir_path, + struct stat *dir_stbuf, int depth, + struct LinkiteM *link_stack, int flag); + +/* @param flag bit0= no hardlink reconstruction + bit1= do not set xorriso->node_*_prefixes + bit5= -extract_single: eventually do not insert directory tree +*/ +int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, + char **src_array, char **tgt_array, + int *problem_count, int flag); + +/* @param flag bit0= path is a directory + bit2= recursion: do not reassure in mode 2 "tree" + bit3= this is for overwriting and not for plain removal +*/ +int Xorriso_reassure_restore(struct XorrisO *xorriso, char *path, int flag); + +/* @param flag bit7= return 4 if restore fails from denied permission + do not issue error message + @return <=0 failure , 1 success , + 4 with bit7: permission to create file was denied +*/ +int Xorriso_make_tmp_path(struct XorrisO *xorriso, char *orig_path, + char *tmp_path, int *fd, int flag); + +/* @param flag bit0= change regardless of xorriso->do_auto_chmod + bit1= desired is only rx +*/ +int Xorriso_auto_chmod(struct XorrisO *xorriso, char *disk_path, int flag); + +int Xorriso_make_accessible(struct XorrisO *xorriso, char *disk_path,int flag); + +/* @param flag bit0= prefer to find a match after *img_prefixes + (but deliver img_prefixes if no other can be found) +*/ +int Xorriso_make_restore_path(struct XorrisO *xorriso, + struct Xorriso_lsT **img_prefixes, struct Xorriso_lsT **disk_prefixes, + char img_path[SfileadrL], char disk_path[SfileadrL], int flag); + +int Xorriso_restore_make_hl(struct XorrisO *xorriso, + char *old_path, char *new_path, int flag); + +int Xorriso_afile_fopen(struct XorrisO *xorriso, + char *filename, char *mode, FILE **ret_fp, int flag); + +int Xorriso_make_mount_cmd(struct XorrisO *xorriso, char *cmd, + int lba, int track, int session, char *volid, + char *devadr, char result[SfileadrL], int flag); + +int Xorriso_append_scdbackup_record(struct XorrisO *xorriso, int flag); + + +#endif /* ! Xorriso_pvt_diskop_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/drive_mgt.c b/libisoburn/branches/1.1.8/xorriso/drive_mgt.c new file mode 100644 index 00000000..a84854ad --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/drive_mgt.c @@ -0,0 +1,2734 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which operate on drives and media. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" + +#include "lib_mgt.h" +#include "drive_mgt.h" +#include "iso_img.h" +#include "sort_cmp.h" +#include "write_run.h" +#include "read_run.h" + + +static const char *un0(const char *text) +{ + if(text == NULL) + return(""); + return(text); +} + + + + +int Xorriso_auto_driveadr(struct XorrisO *xorriso, char *adr, char *result, + int flag) +{ + int ret, is_known_mmc= 0, does_exist= 0; + char *path_pt, *libburn_adr= NULL; + char *abs_pt, *abs_adr= NULL; + struct stat stbuf; + + Xorriso_alloc_meM(libburn_adr, char, BURN_DRIVE_ADR_LEN + SfileadrL); + Xorriso_alloc_meM(abs_adr, char, SfileadrL); + path_pt= adr; + if(strncmp(adr, "stdio:", 6) == 0) + path_pt= adr + 6; + else if(strncmp(adr, "mmc:", 4) == 0) + path_pt= adr + 4; + + + /* <<< replace by Xorriso_normalize_img_path() ? */; + + if(path_pt[0] != '/') { + abs_pt= getcwd(abs_adr, SfileadrL - 1); + if(abs_pt == NULL) { + Xorriso_msgs_submit(xorriso, 0, + "Relative drive path given. Cannot determine working directory.", + errno, "FAILURE", 0); + {ret= -1; goto ex;} + } + ret= Sfile_add_to_path(abs_adr, path_pt, 0); + if(ret <= 0) + {ret= -1; goto ex;} + } + + is_known_mmc= burn_drive_convert_fs_adr(path_pt, libburn_adr); + does_exist= (stat(path_pt, &stbuf) != -1); + Xorriso_process_msg_queues(xorriso,0); + + ret= Xorriso_is_in_patternlist(xorriso, xorriso->drive_whitelist, path_pt, 0); + if(ret > 0) + goto ok; + ret= Xorriso_is_in_patternlist(xorriso, xorriso->drive_blacklist, path_pt, 0); + if(ret < 0) + goto ex; + if(ret) { + strcpy(xorriso->info_text, "Drive address "); + Text_shellsafe(adr, xorriso->info_text, 1); + strcat(xorriso->info_text, + " rejected because: -drive_class 'banned' "); + Text_shellsafe(Xorriso_get_pattern(xorriso, xorriso->drive_blacklist, + ret - 1, 0), + xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + /* if in greylist and not MMC and not stdio prefix: reject */ + if(is_known_mmc < 0) + goto ex; + if(adr == path_pt && !is_known_mmc) { /* no prefix, no MMC */ + ret= Xorriso_is_in_patternlist(xorriso, xorriso->drive_greylist, path_pt,0); + if(ret < 0) + goto ex; + if(ret) { + strcpy(xorriso->info_text, "Drive address "); + Text_shellsafe(adr, xorriso->info_text, 1); + strcat(xorriso->info_text, " rejected because: "); + if(does_exist) + strcat(xorriso->info_text, "not MMC"); + else + strcat(xorriso->info_text, "not existing"); + strcat(xorriso->info_text, " and -drive_class 'risky' "); + Text_shellsafe(Xorriso_get_pattern(xorriso,xorriso->drive_greylist, + ret - 1, 0), + xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "If the address is a legitimate %s, prepend \"stdio:\"", + does_exist ? "target" : "address for a new regular file"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + {ret= 0; goto ex;} + } + } +ok:; + if(strncmp(adr, "mmc:", 4) == 0) { + if(Sfile_str(result, path_pt, 0) <= 0) + {ret= 0; goto ex;} + } else if(adr == path_pt && is_known_mmc <= 0) { + Sfile_str(result, "stdio:", 0); + if(Sfile_str(result, adr, 1) <= 0) + {ret= 0; goto ex;} + } else { + if(Sfile_str(result, adr, 0) <= 0) + {ret= 0; goto ex;} + } + if(strncmp(result, "stdio:", 6)==0) { + if(xorriso->ban_stdio_write) { + strcpy(xorriso->info_text, "Drive address banned by -ban_stdio_write : "); + Text_shellsafe(result, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + ret= 1; +ex:; + Xorriso_free_meM(libburn_adr); + Xorriso_free_meM(abs_adr); + return(ret); +} + + +/* @param flag bit0= aquire as isoburn input drive + bit1= aquire as libburn output drive (as isoburn drive if bit0) + bit2= regard overwriteable media as blank + bit3= if the drive is a regular disk file: truncate it to + the write start address + bit5= do not print toc + bit6= do not calm down drive after aquiring it + bit7= re-assess rather than aquire: + Do not give up drives, + use isoburn_drive_aquire() with re-assessment bit + @return <=0 failure , 1= ok + 2=success, but not writeable with bit1 + 3=success, but not blank and not ISO with bit0 +*/ +int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr, + int flag) +{ + int ret, hret, not_writeable= 0, has_what, aquire_flag, load_lba, ext; + int lba, track, session, params_flag, adr_mode, read_ret; + uint32_t size, offst; + struct burn_drive_info *dinfo= NULL, *out_dinfo= NULL, *in_dinfo= NULL; + struct burn_drive *drive= NULL, *out_drive= NULL, *in_drive= NULL; + enum burn_disc_status state; + IsoImage *volset = NULL; + IsoNode *root_node; + struct isoburn_read_opts *ropts= NULL; + char *libburn_adr= NULL, *off_adr= NULL, *boot_fate, *sev; + size_t value_length; + char *value= NULL; + double num; + char volid[33], *adr_data= NULL, *adr_pt; + + Xorriso_alloc_meM(libburn_adr, char, SfileadrL); + Xorriso_alloc_meM(off_adr, char, SfileadrL); + Xorriso_alloc_meM(adr_data, char, 163); + + if(show_adr == NULL) { + show_adr= adr; + ret= burn_drive_convert_fs_adr(adr, off_adr); + if(ret > 0) + adr= off_adr; + } + + if((flag&3)==0) { + sprintf(xorriso->info_text, + "XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + if(!(flag & 128)) { + ret= Xorriso_give_up_drive(xorriso, (flag&3)|8); + if(ret<=0) + goto ex; + } + if(flag & 1) + xorriso->isofs_st_out= time(0) - 1; + + ret= Xorriso_auto_driveadr(xorriso, adr, libburn_adr, 0); + if(ret <= 0) + goto ex; + if(strcmp(libburn_adr,"stdio:/dev/fd/1")==0) { + if(xorriso->dev_fd_1<0) { + sprintf(xorriso->info_text, + "-*dev \"stdio:/dev/fd/1\" was not a start argument. Cannot use it now."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } else { + sprintf(libburn_adr, "stdio:/dev/fd/%d", xorriso->dev_fd_1); + } + } + + if(flag & 128) { + if(flag & 1) + Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive, "", 16); + if(flag & 2) + Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive, "", 2 | 16); + if(in_dinfo != NULL && (out_dinfo == NULL || out_dinfo == in_dinfo)) { + dinfo= in_dinfo; + if(flag & 2) + xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive; + } else if(out_dinfo != NULL && in_dinfo == NULL) { + dinfo= out_dinfo; + if(flag & 1) + xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive; + } else if(out_dinfo != NULL || in_dinfo != NULL) { + sprintf(xorriso->info_text, + "Two different drives shall be re-assed in one call"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= 0; goto ex;} + } else { + sprintf(xorriso->info_text, "No drive aquired on re-assessment"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= 0; goto ex;} + } + } else if((flag&3)==1 && xorriso->out_drive_handle!=NULL) { + ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive, + "on attempt to compare new indev with outdev", 2); + if(ret<=0) + goto ex; + ret= burn_drive_equals_adr(out_drive, libburn_adr, 1); + if(ret==1) { + dinfo= out_dinfo; + xorriso->indev_is_exclusive= xorriso->outdev_is_exclusive; + } + } else if((flag&3)==2 && xorriso->in_drive_handle!=NULL) { + ret= Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive, + "on attempt to compare new outdev with indev", 0); + if(ret<=0) + goto ex; + ret= burn_drive_equals_adr(in_drive, libburn_adr, 1); + if(ret==1) { + dinfo= in_dinfo; + xorriso->outdev_is_exclusive= xorriso->indev_is_exclusive; + } + } + + if(dinfo == NULL || (flag & 128)) { + aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag & 3)<<3); + if(xorriso->toc_emulation_flag & 4) + aquire_flag|= 128; + if(!(xorriso->do_aaip & 1)) + aquire_flag|= 32; + if((xorriso->ino_behavior & (1 | 2)) && !(xorriso->do_aaip & (4 | 32))) + aquire_flag|= 64; + if(flag & 128) + aquire_flag|= 256; + burn_preset_device_open(xorriso->drives_exclusive, 0, 0); + burn_allow_drive_role_4(1 | (xorriso->early_stdio_test & 14)); + ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag); + burn_preset_device_open(1, 0, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret<=0) { + if(flag & 128) + sprintf(xorriso->info_text,"Cannot re-assess drive '%s'", adr); + else + sprintf(xorriso->info_text,"Cannot aquire drive '%s'", adr); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + state= isoburn_disc_get_status(dinfo[0].drive); + ret= isoburn_get_img_partition_offset(dinfo[0].drive, &offst); + if((state == BURN_DISC_APPENDABLE || state == BURN_DISC_FULL) && ret == 1) { + sprintf(xorriso->info_text, + "ISO image bears MBR with -boot_image any partition_offset=%lu", + (unsigned long) offst); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + + if(flag&1) + if(xorriso->image_start_mode&(1<<31)) /* used up setting */ + xorriso->image_start_mode= 0; /* no need to perform auto setting */ + if(flag & 1) + xorriso->indev_is_exclusive= xorriso->drives_exclusive; + if(flag & 2) + xorriso->outdev_is_exclusive= xorriso->drives_exclusive; + } + drive= dinfo[0].drive; + state= isoburn_disc_get_status(drive); + Xorriso_process_msg_queues(xorriso,0); + if(flag&1) { + if(xorriso->image_start_mode&(1<<31)) /* used up setting */ + xorriso->image_start_mode&= ~0xffff; /* perform auto setting */ + if((xorriso->image_start_mode&(1<<30))) { /* if enabled at all */ + adr_pt= xorriso->image_start_value; + adr_mode= xorriso->image_start_mode & 0xffff; + if(adr_mode == 4 && strlen(adr_pt) <= 80) { + /* Convert volid search expression into lba */ + params_flag= 0; + ret= Xorriso__bourne_to_reg(xorriso->image_start_value, adr_data, 0); + if(ret == 1) + params_flag|= 4; + ret= isoburn_get_mount_params(drive, 4, adr_data, &lba, &track, + &session, volid, params_flag); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) + goto ex; + if(session <= 0 || track <= 0 || ret == 2) { + Xorriso_msgs_submit(xorriso, 0, + "-load : Given address does not point to an ISO 9660 session", + 0, "FAILURE", 0); + ret= 0; goto ex; + } + sprintf(volid, "%d", lba); + adr_pt= volid; + adr_mode= 3; + } + ret= isoburn_set_msc1(drive, adr_mode, adr_pt, + !!(xorriso->image_start_mode & (1<<16))); + if(ret<=0) + goto ex; + if(xorriso->image_start_mode&(1<<31)) + xorriso->image_start_mode= 0; /* disable msc1 setting completely */ + else + xorriso->image_start_mode|= (1<<31); /* mark as used up */ + } + } + if(flag&1) { + volset= isoburn_get_attached_image(drive); + if(volset != NULL) { /* The image object is already created */ + iso_image_unref(volset); + } + } + + if(flag&2) { + xorriso->out_drive_handle= dinfo; + if(Sfile_str(xorriso->outdev, show_adr, 0)<=0) + {ret= -1; goto ex;} + ret= burn_drive_convert_fs_adr(adr, xorriso->outdev_off_adr); + if(ret <= 0) + xorriso->outdev_off_adr[0]= 0; + if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) { + sprintf(xorriso->info_text, "Disc status unsuitable for writing"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + not_writeable= 1; + } + } + if(flag&1) { + xorriso->in_drive_handle= dinfo; + if(Sfile_str(xorriso->indev, show_adr, 0)<=0) + {ret= -1; goto ex;} + ret= burn_drive_convert_fs_adr(adr, xorriso->indev_off_adr); + if(ret <= 0) + xorriso->indev_off_adr[0]= 0; + } else if(flag&2) { + if(xorriso->in_volset_handle==NULL) { + /* No volume loaded: create empty one */ + ret= Xorriso_create_empty_iso(xorriso, 0); + if(ret<=0) + goto ex; + } else { + iso_image_ref((IsoImage *) xorriso->in_volset_handle); + ret= isoburn_attach_image(drive, (IsoImage *) xorriso->in_volset_handle); + if(ret<=0) { + sprintf(xorriso->info_text, + "Failed to attach ISO image object to outdev"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + } + if(!(flag&32)) + Xorriso_toc(xorriso, 1 | 2 | 8); + {ret= 1+not_writeable; goto ex;} + } + + if(xorriso->in_volset_handle!=NULL) + iso_image_unref((IsoImage *) xorriso->in_volset_handle); + xorriso->in_volset_handle= NULL; + Sectorbitmap_destroy(&(xorriso->in_sector_map), 0); + Xorriso_destroy_hln_array(xorriso, 0); + Xorriso_destroy_di_array(xorriso, 0); + xorriso->boot_count= 0; + + /* check for invalid state */ + if(state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE && + state != BURN_DISC_FULL) { + sprintf(xorriso->info_text, + "Disc status not blank and unsuitable for reading"); + sev= "FAILURE"; + if(xorriso->img_read_error_mode==2) + sev= "FATAL"; + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev, 0); + Xorriso_give_up_drive(xorriso, 1|((flag&32)>>2)); + ret= 3; goto ex; + } + /* fill read opts */ + ret= isoburn_ropt_new(&ropts, 0); + if(ret<=0) + goto ex; + + ext= isoburn_ropt_noiso1999; + if((xorriso->ino_behavior & (1 | 2)) && !(xorriso->do_aaip & (1 | 4 | 32)) + && !(xorriso->do_md5 & 1)) + ext|= isoburn_ropt_noaaip; + if(!(xorriso->do_aaip & 1)) + ext|= isoburn_ropt_noacl; + if(!(xorriso->do_aaip & 4)) + ext|= isoburn_ropt_noea; + if(xorriso->ino_behavior & 1) + ext|= isoburn_ropt_noino; + if(!(xorriso->do_md5 & 1)) + ext|= isoburn_ropt_nomd5; + if(xorriso->do_md5 & 32) + ext|= isoburn_ropt_nomd5tag; + + isoburn_ropt_set_extensions(ropts, ext); + + isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555); + isoburn_ropt_set_input_charset(ropts, xorriso->in_charset); + isoburn_ropt_set_auto_incharset(ropts, !!(xorriso->do_aaip & 512)); + isoburn_ropt_set_displacement(ropts, xorriso->displacement, + xorriso->displacement_sign); + + Xorriso_set_image_severities(xorriso, 1); /* No DEBUG messages */ + Xorriso_pacifier_reset(xorriso, 0); + isoburn_set_read_pacifier(drive, Xorriso__read_pacifier, (void *) xorriso); + + /* <<< Trying to work around too much tolerance on bad image trees. + Better would be a chance to instruct libisofs what to do in + case of image read errors. There is a risk to mistake other SORRYs. + */ + if(xorriso->img_read_error_mode>0) + iso_set_abort_severity("SORRY"); + + if(state != BURN_DISC_BLANK) { + ret= isoburn_disc_get_msc1(drive, &load_lba); + if(ret > 0) { + sprintf(xorriso->info_text, + "Loading ISO image tree from LBA %d", load_lba); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + ret= Xorriso_assert_volid(xorriso, load_lba, 0); + if(ret <= 0) + goto ex; + } + + read_ret= ret= isoburn_read_image(drive, ropts, &volset); + + /* <<< Resetting to normal thresholds */ + if(xorriso->img_read_error_mode>0) + Xorriso_set_abort_severity(xorriso, 0); + + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_set_image_severities(xorriso, 0); + Xorriso_give_up_drive(xorriso, 1|((flag&32)>>2)); + sprintf(xorriso->info_text,"Cannot read ISO image tree"); + sev= "FAILURE"; + if(xorriso->img_read_error_mode==2) + sev= "FATAL"; + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, sev, 0); + if(read_ret == (int) ISO_SB_TREE_CORRUPTED && (xorriso->do_md5 & 1)) { + Xorriso_msgs_submit(xorriso, 0, +"This might be false MD5 alarm if an add-on session was written by growisofs.", + 0, "HINT", 0); + Xorriso_msgs_submit(xorriso, 0, + "In this case you get an ISO image tree by option -md5 'load_check_off'", + 0, "HINT", 0); + } else if(xorriso->img_read_error_mode!=0) { + Xorriso_msgs_submit(xorriso, 0, "You might get a partial or altered ISO image tree by option -error_behavior 'image_loading' 'best_effort' if -abort_on is set to be tolerant enough.", + 0, "HINT", 0); + } + + + ret= 3; goto ex; + } + Xorriso_pacifier_callback(xorriso, "nodes read", xorriso->pacifier_count, 0, + "", 1); /* report end count */ + xorriso->in_volset_handle= (void *) volset; + xorriso->in_sector_map= NULL; + Xorriso_set_image_severities(xorriso, 0); + + Xorriso_update_volid(xorriso, 0); + strncpy(xorriso->application_id, + un0(iso_image_get_application_id(volset)), 128); + xorriso->application_id[128]= 0; + strncpy(xorriso->publisher, un0(iso_image_get_publisher_id(volset)), 128); + xorriso->publisher[128]= 0; + strncpy(xorriso->system_id, un0(iso_image_get_system_id(volset)), 32); + xorriso->system_id[32]= 0; + strncpy(xorriso->volset_id, un0(iso_image_get_volset_id(volset)), 128); + xorriso->volset_id[128]= 0; + strncpy(xorriso->copyright_file, + un0(iso_image_get_copyright_file_id(volset)), 37); + xorriso->copyright_file[37]= 0; + strncpy(xorriso->biblio_file, un0(iso_image_get_biblio_file_id(volset)), 37); + xorriso->biblio_file[37]= 0; + strncpy(xorriso->abstract_file, + un0(iso_image_get_abstract_file_id(volset)), 37); + xorriso->abstract_file[37]= 0; + + if(xorriso->out_drive_handle != NULL && + xorriso->out_drive_handle != xorriso->in_drive_handle) { + ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive, + "on attempt to attach ISO image volset to outdev", 2); + if(ret<=0) + goto ex; + iso_image_ref((IsoImage *) xorriso->in_volset_handle); + isoburn_attach_image(out_drive, xorriso->in_volset_handle); + } + Xorriso_process_msg_queues(xorriso,0); + isoburn_ropt_get_size_what(ropts, &size, &has_what); + if(has_what & isoburn_ropt_has_el_torito) { + if(xorriso->boot_image_bin_path[0]) + boot_fate= "replaced by new boot image"; + else if(xorriso->patch_isolinux_image & 1) + boot_fate= "patched at boot info table"; + else if(xorriso->keep_boot_image) + boot_fate= "kept unchanged"; + else + boot_fate= "discarded"; + sprintf(xorriso->info_text, + "Detected El-Torito boot information which currently is set to be %s", + boot_fate); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + Xorriso_record_boot_info(xorriso, 0); + } + + if(flag & 1) { + /* Look for isofs.st and put it into xorriso->isofs_st_in */; + root_node= (IsoNode *) iso_image_get_root(volset); + ret= iso_node_lookup_attr(root_node, "isofs.st", &value_length, &value, 0); + if(ret > 0) { + if(value_length > 0) { + sscanf(value, "%lf", &num); + if(num > 0) + xorriso->isofs_st_in= num; + } + free(value); + } + } + + if(!(flag&32)) { + Xorriso_toc(xorriso, 1 | 8); + if(xorriso->loaded_volid[0] != 0 && + (state == BURN_DISC_APPENDABLE || state == BURN_DISC_FULL)) { + sprintf(xorriso->info_text,"Volume id : '%s'\n", + xorriso->loaded_volid); + Xorriso_info(xorriso, 0); + } + if(strcmp(xorriso->loaded_volid, xorriso->volid) != 0 && + !xorriso->volid_default) { + sprintf(xorriso->info_text, "New volume id: '%s'\n", xorriso->volid); + Xorriso_info(xorriso, 0); + } + } + + ret= 1+not_writeable; +ex: + Xorriso_process_msg_queues(xorriso,0); + if(ret<=0) { + hret= Xorriso_give_up_drive(xorriso, (flag&3)|((flag&32)>>2)); + if(hretdo_calm_drive & 1) && !(flag & 64)) + burn_drive_snooze(drive, 0); /* No need to make noise from start */ + } + if(ropts!=NULL) + isoburn_ropt_destroy(&ropts, 0); + Xorriso_free_meM(off_adr); + Xorriso_free_meM(libburn_adr); + Xorriso_free_meM(adr_data); + return(ret); +} + + +/* @param flag bit0=input drive + bit1=output drive + bit2=eject + bit3=no info message or toc +*/ +int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag) +{ + int in_is_out_too, ret, do_eject; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + in_is_out_too= (xorriso->in_drive_handle == xorriso->out_drive_handle); + if((flag&4) && in_is_out_too && (flag&(1|2))) { + if((flag&3)!=3) { + sprintf(xorriso->info_text,"Giving up for -eject whole -dev "); + Text_shellsafe(xorriso->indev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + flag|= 3; /* give up in/out drive to eject it */ + } + + if((flag&1) && xorriso->in_drive_handle != NULL) { + Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to give up drive", 0); + + if(!in_is_out_too) { + do_eject= !!(flag&4); + if((flag & 4) && !xorriso->indev_is_exclusive) { + sprintf(xorriso->info_text, + "Will not eject medium in non-exclusively aquired input drive."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + do_eject= 0; + } + if(drive!=NULL) + isoburn_drive_release(drive, do_eject); + if(dinfo!=NULL) + burn_drive_info_free(dinfo); + } + xorriso->in_drive_handle= NULL; + xorriso->indev[0]= 0; + + if(xorriso->in_volset_handle!=NULL) + iso_image_unref((IsoImage *) xorriso->in_volset_handle); + xorriso->in_volset_handle= NULL; + Sectorbitmap_destroy(&(xorriso->in_sector_map), 0); + Xorriso_destroy_di_array(xorriso, 0); + Xorriso_destroy_hln_array(xorriso, 0); + xorriso->loaded_volid[0]= 0; + xorriso->isofs_st_out= time(0) - 1; + xorriso->isofs_st_in= 0; + xorriso->volset_change_pending= 0; + xorriso->no_volset_present= 0; + xorriso->loaded_boot_bin_lba= 0; + xorriso->loaded_boot_cat_path[0]= 0; + xorriso->boot_count= 0; + in_is_out_too= 0; + } + if((flag&2) && xorriso->out_drive_handle!=NULL) { + do_eject= !!(flag&4); + if((flag & 4) && !xorriso->outdev_is_exclusive) { + sprintf(xorriso->info_text, + "Will not eject medium in non-exclusively aquired drive."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + do_eject= 0; + } + Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to give up drive", 2); + if(!in_is_out_too) { + if(drive!=NULL) + isoburn_drive_release(drive, do_eject); + if(dinfo!=NULL) + burn_drive_info_free(dinfo); + } + xorriso->out_drive_handle= NULL; + xorriso->outdev[0]= 0; + xorriso->outdev_off_adr[0]= 0; + } else if((flag&1) && xorriso->out_drive_handle!=NULL) { + ret= Xorriso_create_empty_iso(xorriso, 0); + if(ret<=0) + return(ret); + if(!(flag&8)) { + sprintf(xorriso->info_text, + "Only the output drive remains. Created empty ISO image.\n"); + Xorriso_info(xorriso, 0); + Xorriso_toc(xorriso, 1 | 2 | 8); + } + } + Xorriso_process_msg_queues(xorriso,0); + return(1); +} + + +int Xorriso_may_burn(struct XorrisO *xorriso, int flag) +{ + + if(xorriso->outdev_is_exclusive) + return(1); + sprintf(xorriso->info_text, "The output drive was not aquired exclusively."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, "A possible remedy is: -osirrox 'o_excl_on'"); + if(xorriso->outdev[0]) { + strcat(xorriso->info_text," -outdev "); + Text_shellsafe(xorriso->outdev, xorriso->info_text, 1); + } + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + return(0); +} + + +/* @param flag bit2=do not try to read ISO heads +*/ +int Xorriso_toc_to_string(struct XorrisO *xorriso, char **toc_text, int flag) +{ + int ret, stack_handle, toc_ret, l; + struct Xorriso_lsT *results= NULL, *infos= NULL, *lpt; + + *toc_text= NULL; + ret= Xorriso_push_outlists(xorriso, &stack_handle, 1); + if(ret <= 0) + goto ex; + toc_ret= Xorriso_toc(xorriso, flag & 4); + ret= Xorriso_pull_outlists(xorriso, stack_handle, &results, &infos, 0); + if(ret <= 0) + goto ex; + if(toc_ret <= 0) + {ret= toc_ret; goto ex;} + l= 0; + for(lpt= results; lpt != NULL; lpt= Xorriso_lst_get_next(lpt, 0)) + l+= strlen(Xorriso_lst_get_text(lpt, 0)); + *toc_text= calloc(l + 1, 1); + l= 0; + for(lpt= results; lpt != NULL; lpt= Xorriso_lst_get_next(lpt, 0)) { + strcpy((*toc_text) + l, Xorriso_lst_get_text(lpt, 0)); + l+= strlen(Xorriso_lst_get_text(lpt, 0)); + } +ex:; + Xorriso_lst_destroy_all(&results, 0); + Xorriso_lst_destroy_all(&infos, 0); + return(ret); +} + + +/* @param flag bit0+1= what to give up and/or re-assess in what role + 0=give up outdev + 1=give up indev if not outdev, re-assess outdev as indev + 2=re-assess outdev as outdev + 3=give up indev if not outdev, re-assess outdev as dev +*/ +int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag) +{ + int ret, aq_flag; + char *drive_name= NULL, *off_name= NULL; + + Xorriso_alloc_meM(drive_name, char, SfileadrL); + Xorriso_alloc_meM(off_name, char, SfileadrL); + aq_flag= flag&3; + strcpy(drive_name, xorriso->outdev); + if(xorriso->outdev_off_adr[0]) + strcpy(off_name, xorriso->outdev_off_adr); + else + strcpy(off_name, drive_name); + + if(aq_flag == 0) { + Xorriso_give_up_drive(xorriso, 2); + sprintf(xorriso->info_text,"Gave up -outdev "); + Text_shellsafe(xorriso->indev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + {ret= 1; goto ex;} + } + + /* Only give up indev, and only if it is not outdev */; + if(xorriso->in_drive_handle != xorriso->out_drive_handle && + xorriso->in_drive_handle != NULL && (aq_flag & 1)) + Xorriso_give_up_drive(xorriso, 1 | 8); + sprintf(xorriso->info_text,"Re-assessing -outdev "); + Text_shellsafe(drive_name, xorriso->info_text, 1); + if(strcmp(drive_name, off_name) != 0) { + strcat(xorriso->info_text, " ("); + Text_shellsafe(off_name, xorriso->info_text, 1); + strcat(xorriso->info_text, ")"); + } + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + + /* Re-assess outdev */ + ret= Xorriso_aquire_drive(xorriso, off_name, drive_name, aq_flag | 128); + if(ret<=0) { + sprintf(xorriso->info_text,"Could not re-assess -outdev "); + Text_shellsafe(drive_name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + + ret= 1; +ex:; + Xorriso_free_meM(drive_name); + Xorriso_free_meM(off_name); + return(ret); +} + + +/* @param flag + bit3=report to info channel (else to result channel) +*/ +int Xorriso_toc_line(struct XorrisO *xorriso, int flag) +{ + if(!(flag & 8)) { + Xorriso_result(xorriso,0); + return(1); + } + strcpy(xorriso->info_text, xorriso->result_line); + Xorriso_info(xorriso, 0); + return(1); +} + + +/* @param flag + bit1=report about output drive + bit3=report to info channel (else to result channel) + bit4=do no report failure if no drive aquired +*/ +int Xorriso_media_product(struct XorrisO *xorriso, int flag) +{ + int ret, profile_no; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + char *product_id= NULL, *media_code1= NULL, *media_code2= NULL; + char *book_type= NULL, *manuf= NULL, profile_name[80], *respt; + + respt= xorriso->result_line; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print media product info", + flag & (2 | 16)); + if(ret <= 0) + return(ret); + ret= burn_disc_get_media_id(drive, &product_id, &media_code1, &media_code2, + &book_type, 0); + if(ret > 0) { + ret= burn_disc_get_profile(drive, &profile_no, profile_name); + if(ret <= 0) + return(ret); + sprintf(respt, "Media product: %s , ", product_id); + manuf= burn_guess_manufacturer(profile_no, media_code1, media_code2, 0); + if(manuf != NULL) { + if(strncmp(manuf, "Unknown ", 8) == 0) + sprintf(respt + strlen(respt), "(not found in manufacturer list)\n"); + else + sprintf(respt + strlen(respt), "%s\n", manuf); + } else + sprintf(respt + strlen(respt), "(error during manufacturer lookup)\n"); + free(product_id); + free(media_code1); + free(media_code2); + if(book_type != NULL) + free(book_type); + if(manuf != NULL) + free(manuf); + Xorriso_toc_line(xorriso, flag & 8); + } + Xorriso_process_msg_queues(xorriso,0); + + return(1); +} + + +/* @param flag bit0=short report form + bit1=report about output drive + bit2=do not try to read ISO heads + bit3=report to info channel (else to result channel) + bit4=do no report failure if no drive aquired + bit5=only report "Drive current" and "Drive type" + bit6=report "Media product" with bit0 + bit7=only report "Drive current" +*/ +int Xorriso_toc(struct XorrisO *xorriso, int flag) +{ + int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, pmin, psec, pframe, ret; + int track_count= 0, session_no, track_no, profile_no= -1, track_size; + int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0; + int is_inout_drive= 0, drive_role, status, num_formats, emul_lba; + int not_recognizable= 0, start_lba, end_lba; + char profile_name[80],*respt,*devadr, *typetext= ""; + struct burn_toc_entry toc_entry; + struct burn_drive_info *dinfo; + struct burn_multi_caps *caps= NULL; + struct burn_drive *drive; + enum burn_disc_status s; + char mem_text[80]; + off_t start_byte= 0, num_free= 0, size; + unsigned dummy; + struct isoburn_toc_disc *disc= NULL; + struct isoburn_toc_session **sessions; + struct isoburn_toc_track **tracks; + int image_blocks= 0; + char volume_id[33]; + struct burn_toc_entry next_toc_entry; + int disk_category, part_version, num_layers, num_blocks; + char *book_name; + int num_data_from_format= 0; +/* + int num_payload= 0, num_wasted= 0, num_nondata= 0; +*/ + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print Table Of Content", + flag & (2 | 16)); + if(ret<=0) + {ret= 0; goto ex;} + + respt= xorriso->result_line; + + if(strcmp(xorriso->indev, xorriso->outdev)==0) + is_inout_drive= 1; + if(flag&2) + devadr= xorriso->outdev; + else + devadr= xorriso->indev; + sprintf(respt, "Drive current: %s '%s'\n", + (is_inout_drive ? "-dev" : (flag&2 ? "-outdev" : "-indev")), + devadr); + Xorriso_toc_line(xorriso, flag & 8); + if(flag & 128) + {ret= 1; goto ex;} + sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n", + dinfo[0].vendor, dinfo[0].product, dinfo[0].revision); + if((flag & 32) || !(flag & 1)) + Xorriso_toc_line(xorriso, flag & 8); + if(flag & 32) + {ret= 1; goto ex;} + + ret= burn_disc_get_profile(drive, &profile_no, profile_name); + s= isoburn_disc_get_status(drive); + if(profile_no == 0x0002 && s == BURN_DISC_EMPTY) + profile_no= 0; + sprintf(respt, "Media current: "); + drive_role= burn_drive_get_drive_role(drive); + if (profile_no > 0 && ret > 0) { + if (profile_name[0]) + sprintf(respt+strlen(respt), "%s", profile_name); + else + sprintf(respt+strlen(respt), "%4.4Xh", profile_no); + if(drive_role==2) + sprintf(respt+strlen(respt), ", overwriteable"); + else if(drive_role == 4) + sprintf(respt+strlen(respt), ", random read-only"); + else if(drive_role == 5) + sprintf(respt+strlen(respt), ", random write-only"); + else if(drive_role==0 || drive_role==3) + sprintf(respt+strlen(respt), ", sequential"); + strcat(respt, "\n"); + } else { + sprintf(respt+strlen(respt), "is not recognizable\n"); + not_recognizable= 1; + } + Xorriso_toc_line(xorriso, flag & 8); + + if((flag & 64) || !(flag & 1)) { + Xorriso_media_product(xorriso, flag & (2 | 8 | 16)); + if(xorriso->request_to_abort) + {ret= 1; goto ex;} + } + + sprintf(respt, "Media status : "); + if (s == BURN_DISC_FULL) { + if(not_recognizable) + sprintf(respt+strlen(respt), "is not recognizable\n"); + else + sprintf(respt+strlen(respt), "is written , is closed"); + } else if (s == BURN_DISC_APPENDABLE) { + sprintf(respt+strlen(respt), "is written , is appendable"); + } else if (s == BURN_DISC_BLANK) { + sprintf(respt+strlen(respt), "is blank"); + } else if (s == BURN_DISC_EMPTY) + sprintf(respt+strlen(respt), "is not present"); + else + sprintf(respt+strlen(respt), "is not recognizable"); + if(s == BURN_DISC_APPENDABLE || s == BURN_DISC_BLANK) { + ret= burn_disc_next_track_is_damaged(drive, 0); + if(ret & 1) + sprintf(respt+strlen(respt), " , but next track is damaged"); + else if(ret & 2) + sprintf(respt+strlen(respt), " , but no writable address"); + else if(profile_no == 0x14) { /* DVD-RW sequential */ + ret= burn_disc_get_multi_caps(drive, BURN_WRITE_TAO, &caps, 0); + if(ret == 0) + sprintf(respt+strlen(respt), " , but will need -close on"); + if(caps != NULL) + burn_disc_free_multi_caps(&caps); + } else if(profile_no == 0x15) { /* DVD-RW DL */ + sprintf(respt+strlen(respt), " , but will need -close \"on\""); + } + } + strcat(respt, "\n"); + Xorriso_toc_line(xorriso, flag & 8); + + if((s == BURN_DISC_FULL || s == BURN_DISC_APPENDABLE || + s == BURN_DISC_BLANK) && !(flag & 1)) { + ret= burn_get_read_capacity(drive, &num_data, 0); + if(ret != 1 || s == BURN_DISC_BLANK) + num_data= 0; + num_free= isoburn_disc_available_space(drive, NULL) / 2048; + nwa= -1; + if (s == BURN_DISC_APPENDABLE) { + ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); + if(ret <= 0) + nwa= -1; + } else if(s == BURN_DISC_BLANK) { + ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); + if(ret == 1) { + num_free+= nwa; + nwa= 0; + } + } + lba= num_data + num_free; + if(nwa >= 0) { + lba= nwa + num_free; + if(nwa < num_data) + num_data= nwa; + } + + /* If closed CD-RW : obtain ATIP lead out address */ + if(profile_no == 0x0a) { + ret= burn_disc_read_atip(drive); + if(ret < 0) + goto ex; + ret= burn_drive_get_start_end_lba(drive, &start_lba, &end_lba, 0); + if(s == BURN_DISC_FULL && ret == 1) { + lba= end_lba - 2; + } else { + if(ret == 1 && end_lba - 2 > lba) { + sprintf(xorriso->info_text, + "ATIP end_lba %d > overall %d", end_lba, lba); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + } + } else if(profile_no == 0x14) { + ret= burn_disc_get_phys_format_info(drive, &disk_category, + &book_name, &part_version, + &num_layers, &num_blocks, 0); + if(ret == 1 && num_blocks > lba) + lba= num_blocks; + } + + sprintf(respt, "Media blocks : %d readable , %d writable , %d overall\n", + num_data, (int) num_free, lba); + Xorriso_toc_line(xorriso, flag & 8); + } + + if(s == BURN_DISC_BLANK) { + sprintf(respt, "Media summary: 0 sessions, 0 data blocks, 0 data"); + num_free= isoburn_disc_available_space(drive, NULL); + Sfile_scale((double) num_free, mem_text,5,1e4,1); + sprintf(respt+strlen(respt), ", %s free\n", mem_text); + Xorriso_toc_line(xorriso, flag & 8); + } + if(s != BURN_DISC_FULL && s != BURN_DISC_APPENDABLE) + {ret= 1; goto ex;} + if(xorriso->request_to_abort) + {ret= 1; goto ex;} + + if(!(flag & 2)) + Xorriso_show_boot_info(xorriso, 1 | (flag & 8) | ((flag & 1) << 1)); + + disc= isoburn_toc_drive_get_disc(drive); + if(flag & 4) + sprintf(respt, "TOC layout : %3s , %9s , %10s\n", + "Idx", "sbsector", "Size"); + else + sprintf(respt, "TOC layout : %3s , %9s , %10s , %s\n", + "Idx", "sbsector", "Size", "Volume Id"); + if(!(flag&1)) + Xorriso_toc_line(xorriso, flag & 8); + + if (disc==NULL) { + Xorriso_process_msg_queues(xorriso,0); + if(drive_role == 5 && s == BURN_DISC_APPENDABLE) { + ret= burn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); + if(ret != 1) + lba= 0; + } else { + ret= isoburn_get_min_start_byte(drive, &start_byte, 0); + nwa= start_byte / 2048; + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + if(flag&1) + {ret= 1; goto ex;} + sprintf(xorriso->info_text, "Cannot obtain Table Of Content"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + } + + /* fabricate TOC */ + typetext= "Other session"; + if(flag & 4) { + ret= 0; + typetext= "Session "; + } else + ret= isoburn_read_iso_head(drive, 0, &image_blocks, volume_id, 1); + if(ret>0) { + sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n", + 1, 0, image_blocks, volume_id); + nwa= image_blocks; + } else { + ret= burn_disc_get_formats(drive, &status, &size, &dummy, + &num_formats); + if(ret <= 0 || status != BURN_FORMAT_IS_FORMATTED) + size= 0; + if(size <= 0) { + ret= burn_get_read_capacity(drive, &num_data, 0); + if(ret == 1) + size= ((off_t) num_data) * (off_t) 2048; + } else { + num_data_from_format= 1; + } + nwa= lba + size / 2048; + num_data= nwa - lba; + sprintf(respt, "%13s: %3d , %9d , %9ds , \n", + typetext, 1, lba, num_data); + } + if(!(flag&1)) + Xorriso_toc_line(xorriso, flag & 8); + last_track_start= lba; +/* + num_payload= num_data= last_track_size= nwa; +*/ + num_sessions= 1; + } else { + num_data= 0; + sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); + for (session_no= 0; session_norequest_to_abort); + session_no++) { + tracks= isoburn_toc_session_get_tracks(sessions[session_no], &num_tracks); + if (tracks==NULL) + continue; + for(track_no= 0; track_norequest_to_abort); + track_no++) { + track_count++; + is_data= 0; + isoburn_toc_track_get_entry(tracks[track_no], &toc_entry); + if (toc_entry.extensions_valid & 1) { + /* DVD extension valid */ + lba= toc_entry.start_lba; + track_size= toc_entry.track_blocks; + } else { + lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, + toc_entry.pframe); + if(track_no==num_tracks-1) { + isoburn_toc_session_get_leadout_entry(sessions[session_no], + &next_toc_entry); + } else { + isoburn_toc_track_get_entry(tracks[track_no+1], &next_toc_entry); + } + track_size= burn_msf_to_lba(next_toc_entry.pmin, next_toc_entry.psec, + next_toc_entry.pframe) - lba; + } + if(flag&(1|4)) + ret= 0; + else { + ret= isoburn_toc_track_get_emul(tracks[track_no], &emul_lba, + &image_blocks, volume_id, 0); + if(ret <= 0) + ret= isoburn_read_iso_head(drive, lba, &image_blocks, volume_id, 1); + if(image_blocks > track_size) { + sprintf(xorriso->info_text, + "Session %d bears ISO image size %ds larger than track size %ds", + session_no + 1, image_blocks, track_size); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", + 0); + image_blocks= track_size; + } + } + if(ret>0 && track_no==0) { + sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n", + session_no+1, lba, image_blocks , volume_id); + } else if(ret>0) { + sprintf(respt, "ISO track : %3d , %9d , %9ds , %s\n", + track_count, lba, image_blocks , volume_id); + } else if(track_no==0) { + typetext= "Other session"; + if(flag & 4) + typetext= "Session "; + sprintf(respt, "%13s: %3d , %9d , %9ds , \n", + typetext, session_no+1, lba, track_size); + } else { + typetext= "Other track "; + if(flag & 4) + typetext= "Track "; + sprintf(respt, "%13s: %3d , %9d , %9ds , \n", + typetext, track_count, lba, track_size); + } + if(!(flag&1)) + Xorriso_toc_line(xorriso, flag & 8); +/* + if(track_no>0) + num_payload+= lba - last_track_start; +*/ + last_track_start= lba; + if((toc_entry.control&7)>=4) /* data track */ + is_data= 1; + } + isoburn_toc_session_get_leadout_entry(sessions[session_no], &toc_entry); + if (toc_entry.extensions_valid & 1) { + lba= toc_entry.start_lba; + burn_lba_to_msf(lba, &pmin, &psec, &pframe); + } else { + lba= burn_msf_to_lba(pmin, psec, pframe); + lba= burn_msf_to_lba(toc_entry.pmin, toc_entry.psec, toc_entry.pframe); + } + last_track_size= lba - last_track_start; +/* + num_payload+= last_track_size; +*/ + if(is_data) + num_data+= last_track_size; + } + } + if(xorriso->request_to_abort) + {ret= 1; goto ex;} +/* + num_wasted= lba - num_payload; + num_nondata= lba - num_data; +*/ + + Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1); + sprintf(respt, "Media summary: %d session%s, %d data blocks, %s data", + num_sessions, (num_sessions==1 ? "" : "s"), num_data, mem_text); + if(num_data_from_format) + num_free= 0; + else + num_free= isoburn_disc_available_space(drive, NULL); + Sfile_scale((double) num_free, mem_text,5,1e4,1); + sprintf(respt+strlen(respt), ", %s free", mem_text); + + sprintf(respt+strlen(respt), "\n"); + Xorriso_toc_line(xorriso, flag & 8); + + if (s==BURN_DISC_APPENDABLE && nwa!=0) { + ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa); + if(ret>0) { + sprintf(respt, "Media nwa : %ds\n", nwa); + if(!(flag&1)) + Xorriso_toc_line(xorriso, flag & 8); + } + } + if(profile_no == 0x41 && num_sessions >= 300) { + sprintf(xorriso->info_text, + "Sequential BD-R medi/m now contains %d sessions. It is likely to soon fail writing.", + num_sessions); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + + if (disc!=NULL) + isoburn_toc_disc_free(disc); + Xorriso_process_msg_queues(xorriso,0); + ret= 1; +ex:; + return(ret); +} + + +/* @param flag bit0= try to find 'meaningful' links for enumerated devices +*/ +int Xorriso_show_devices(struct XorrisO *xorriso, int flag) +{ + char *adr= NULL, *link_adr= NULL, *adrpt; + int i, j, max_dev_len= 1, pad, ret; + struct burn_drive_info *drive_list= NULL; + unsigned int drive_count; + char *respt, perms[8]; + struct stat stbuf; + + Xorriso_alloc_meM(adr, char, BURN_DRIVE_ADR_LEN); + Xorriso_alloc_meM(link_adr, char, BURN_DRIVE_ADR_LEN); + + sprintf(xorriso->info_text, "Beginning to scan for devices ...\n"); + Xorriso_info(xorriso,0); + + burn_drive_clear_whitelist(); + while(!burn_drive_scan(&drive_list, &drive_count)) { + Xorriso_process_msg_queues(xorriso,0); + usleep(100000); + } + Xorriso_process_msg_queues(xorriso,0); + if(drive_count == 0) { + + /* >>> was a drive_list created at all ? */ + /* >>> must it be freed ? */ + + sprintf(xorriso->info_text, "No drives found"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + sprintf(xorriso->info_text, "Full drive scan done\n"); + Xorriso_info(xorriso,0); + + sprintf(xorriso->info_text, "-----------------------------------------------------------------------------\n"); + Xorriso_info(xorriso,0); + respt= xorriso->result_line; + for(i= 0; i < (int) drive_count && !(xorriso->request_to_abort); i++) { + if(burn_drive_get_adr(&(drive_list[i]), adr)<=0) + strcpy(adr, "-get_adr_failed-"); + Xorriso_process_msg_queues(xorriso,0); + adrpt= adr; + if(flag & 1) { + ret= burn_lookup_device_link(adr, link_adr, "/dev", NULL, 0, 0); + if(ret < 0) + goto ex; + if(ret == 1) + adrpt= link_adr; + } + if((int) strlen(adrpt) > max_dev_len) + max_dev_len= strlen(adrpt); + } + for(i= 0; i < (int) drive_count && !(xorriso->request_to_abort); i++) { + if(burn_drive_get_adr(&(drive_list[i]), adr)<=0) + strcpy(adr, "-get_adr_failed-"); + Xorriso_process_msg_queues(xorriso,0); + if(stat(adr,&stbuf)==-1) { + sprintf(perms,"errno=%d",errno); + } else { + strcpy(perms,"------"); + if(stbuf.st_mode&S_IRUSR) perms[0]= 'r'; + if(stbuf.st_mode&S_IWUSR) perms[1]= 'w'; + if(stbuf.st_mode&S_IRGRP) perms[2]= 'r'; + if(stbuf.st_mode&S_IWGRP) perms[3]= 'w'; + if(stbuf.st_mode&S_IROTH) perms[4]= 'r'; + if(stbuf.st_mode&S_IWOTH) perms[5]= 'w'; + } + adrpt= adr; + if(flag & 1) { + ret= burn_lookup_device_link(adr, link_adr, "/dev", NULL, 0, 0); + if(ret < 0) + goto ex; + if(ret == 1) + adrpt= link_adr; + } + sprintf(respt, "%d -dev '%s' ", i, adrpt); + pad= max_dev_len-strlen(adrpt); + if(pad>0) + for(j= 0; jinfo_text, "-----------------------------------------------------------------------------\n"); + Xorriso_info(xorriso,0); + + burn_drive_info_free(drive_list); + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + Xorriso_free_meM(adr); + Xorriso_free_meM(link_adr); + return(ret); +} + + +int Xorriso_tell_media_space(struct XorrisO *xorriso, + int *media_space, int *free_space, int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_write_opts *burn_options; + + (*free_space)= (*media_space)= 0; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to -tell_media_space", 2); + if(ret<=0) + return(0); + + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); + if(ret<=0) + return(-1); + (*free_space)= (*media_space)= + isoburn_disc_available_space(drive, burn_options) / (off_t) 2048; + burn_write_opts_free(burn_options); + + if(xorriso->volset_change_pending) { + ret= Xorriso_write_session(xorriso, 1); + if(ret>0) + (*free_space)-= ret; + } + Xorriso_process_msg_queues(xorriso,0); + return(1); +} + + +/* @return <=0 error, 1 success +*/ +int Xorriso_list_formats(struct XorrisO *xorriso, int flag) +{ + int ret, i, status, num_formats, profile_no, type, alloc_blocks, free_blocks; + off_t size; + unsigned dummy; + char status_text[80], profile_name[90], *respt; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + respt= xorriso->result_line; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to obtain format descriptor list", 1 | 2); + if(ret<=0) + return(0); + if(ret == 2) + goto ex; + ret = burn_disc_get_formats(drive, &status, &size, &dummy, + &num_formats); + if(ret<=0) { + sprintf(xorriso->info_text, "Cannot obtain format list info"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + ret= Xorriso_toc(xorriso, 3); + if(ret<=0) + goto ex; + ret= burn_disc_get_profile(drive, &profile_no, profile_name); + if(ret<=0) + goto ex; + + if(status == BURN_FORMAT_IS_UNFORMATTED) + sprintf(status_text, "unformatted, up to %.1f MiB", + ((double) size) / 1024.0 / 1024.0); + else if(status == BURN_FORMAT_IS_FORMATTED) { + if(profile_no==0x12 || profile_no==0x13 || profile_no==0x1a || + profile_no==0x43) + sprintf(status_text, "formatted, with %.1f MiB", + ((double) size) / 1024.0 / 1024.0); + else + sprintf(status_text, "written, with %.1f MiB", + ((double) size) / 1024.0 / 1024.0); + } else if(status == BURN_FORMAT_IS_UNKNOWN) { + if (profile_no > 0) + sprintf(status_text, "intermediate or unknown"); + else + sprintf(status_text, "no media or unknown media"); + } else + sprintf(status_text, "illegal status according to MMC-5"); + sprintf(respt, "Format status: %s\n", status_text); + Xorriso_result(xorriso,0); + ret= burn_disc_get_bd_spare_info(drive, &alloc_blocks, &free_blocks, 0); + if(ret == 1) { + sprintf(respt, "BD Spare Area: %d blocks consumed, %d blocks available\n", + alloc_blocks - free_blocks, free_blocks); + Xorriso_result(xorriso,0); + } + + for (i= 0; i < num_formats; i++) { + ret= burn_disc_get_format_descr(drive, i, &type, &size, &dummy); + if (ret <= 0) + continue; + sprintf(respt, "Format idx %-2d: %2.2Xh , %.fs , %.1f MiB\n", + i, type, ((double) size) / 2048.0, ((double) size) / 1024.0/1024.0); + Xorriso_result(xorriso,0); + } + ret= 1; +ex:; + return(ret); +} + + +int Xorriso_choose_speed_factor(struct XorrisO *xorriso, + int speed, int profile, + double *speed_factor, char **speed_unit, + int flag) +{ + double cd_factor = 75.0 * 2352; + double cd_speed_tolerance= 1.5, cd_speed_add; + int int_cd_speed, i; + static int cd_speed_list[]= {8, 10, 12, 16, 24, 32, 40, 48, 52, 0}; + + *speed_unit= "D"; + *speed_factor= 1385000.0; + + /* Does this look like an integer CD speed ? */ + int_cd_speed= ((double) speed) * 1000.0 / cd_factor; + cd_speed_add= cd_speed_tolerance * (double) int_cd_speed; + int_cd_speed= (((double) speed) + cd_speed_add) + * 1000.0 / cd_factor; + if(abs((int) ((double) int_cd_speed) * cd_factor / 1000.0 - + ((double) speed)) > 2 * cd_speed_add || + int_cd_speed > 64) + int_cd_speed= 0; + if(int_cd_speed > 7) { + for(i= 0; cd_speed_list[i]; i++) + if(int_cd_speed == cd_speed_list[i]) + break; + if(cd_speed_list[i] == 0) + int_cd_speed= 0; + } + + if(((profile < 0x08 || profile >= 0x100 || profile == 0x10 || profile == 0x40) + && int_cd_speed) || + (profile >= 0x08 && profile <= 0x0a)) { + *speed_unit= "C"; + *speed_factor= cd_factor; + } else if(profile >= 0x40 && profile <= 0x43) { + *speed_unit= "B"; + *speed_factor= 4495625.0; + } + return(1); +} + + +/* @return <=0 error, 1 success +*/ +int Xorriso_list_speeds(struct XorrisO *xorriso, int flag) +{ + int ret, high= -1, low= 0x7fffffff, is_cd= 0, i; + int recent_profile= 0; + char *respt, *speed_unit= "D"; + double speed_factor= 1385000.0, cd_factor= 75.0 * 2352; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_speed_descriptor *speed_list= NULL, *item, *other; + + respt= xorriso->result_line; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to obtain speed descriptor list", 1 | 2); + if(ret<=0) + return(0); + if(ret == 2) + goto ex; + ret= burn_drive_get_speedlist(drive, &speed_list); + if(ret < 0) { + sprintf(xorriso->info_text, "Cannot obtain speed list info"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + ret= 0; goto ex; + } + ret= Xorriso_toc(xorriso, 3); + if(ret<=0) { + sprintf(xorriso->info_text, + "Cannot obtain overview of drive and media content"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + ret= 0; goto ex; + } + + for (item= speed_list; item != NULL; item= item->next) { + + sprintf(xorriso->info_text, "speed= %5dk , source= %d", + item->write_speed, item->source); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + if(item->profile_loaded >= 0x08 && item->profile_loaded <= 0x0a) + is_cd= item->profile_loaded; + if(item->profile_loaded > 0) + recent_profile= item->profile_loaded; + if(item->source == 1) { + /* CD mode page 2Ah : report only if not same speed by GET PERFORMANCE */ + for(other= speed_list; other != NULL; other= other->next) + if(other->source == 2 && item->write_speed == other->write_speed) + break; + if(other != NULL) + continue; + } + Xorriso_choose_speed_factor(xorriso, item->write_speed, + item->profile_loaded, + &speed_factor, &speed_unit, 0); + sprintf(respt, "Write speed : "); + sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n", + item->write_speed, + ((double) item->write_speed) * 1000.0 / speed_factor, + speed_unit); + Xorriso_result(xorriso,0); + if(item->write_speed > high) + high= item->write_speed; + if(item->write_speed < low) + low= item->write_speed; + } + + /* Maybe there is ATIP info */ + if(is_cd) { + ret= burn_disc_read_atip(drive); + if(ret < 0) + goto ex; + if(ret > 0) { + for(i= 0; i < 2; i++) { + if(i == 0) + ret= burn_drive_get_min_write_speed(drive); + else + ret= burn_drive_get_write_speed(drive); + if(ret > 0) { + if(ret < low || (i == 0 && ret != low)) { + sprintf(respt, "Write speed l: "); + sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n", + ret, ((double) ret) * 1000.0 / cd_factor, "C"); + Xorriso_result(xorriso,0); + low= ret; + } + if(ret > high || (i == 1 && ret != high)) { + sprintf(respt, "Write speed h: "); + sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n", + ret, ((double) ret) * 1000.0 / cd_factor, "C"); + Xorriso_result(xorriso,0); + high= ret; + } + } + } + } + } + if(high > -1) { + Xorriso_choose_speed_factor(xorriso, low, recent_profile, + &speed_factor, &speed_unit, 0); + sprintf(respt, "Write speed L: "); + sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n", + low, ((double) low) * 1000.0 / speed_factor, speed_unit); + Xorriso_result(xorriso,0); + Xorriso_choose_speed_factor(xorriso, low, recent_profile, + &speed_factor, &speed_unit, 0); + sprintf(respt, "Write speed H: "); + sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n", + high, ((double) high) * 1000.0 / speed_factor, speed_unit); + Xorriso_result(xorriso,0); + } else { + sprintf(xorriso->info_text, + "Could not get any write speed information from drive"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + ret= 0; goto ex; + } + ret= 1; +ex:; + if(speed_list != NULL) + burn_drive_free_speedlist(&speed_list); + return(ret); +} + + +/* @param flag bit0= cdrecord style + bit1= obtain outdrive, else indrive + @return <=0 error, 1 success +*/ +int Xorriso_list_profiles(struct XorrisO *xorriso, int flag) +{ + int ret, i; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + int num_profiles, profiles[64]; + char is_current[64], profile_name[90], *respt; + + respt= xorriso->result_line; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to obtain profile list", 1 | (flag & 2)); + if(ret<=0) + return(0); + burn_drive_get_all_profiles(drive, &num_profiles, profiles, is_current); + for(i= 0; i < num_profiles; i++) { + ret= burn_obtain_profile_name(profiles[i], profile_name); + if(ret <= 0) + strcpy(profile_name, "unknown"); + sprintf(respt, "%s 0x%4.4X (%s)%s\n", + flag & 1 ? "Profile:" : "Profile :", + (unsigned int) profiles[i], + profile_name, is_current[i] ? " (current)" : ""); + Xorriso_result(xorriso,0); + } + return(1); +} + + +/* @param flag bit0= -inq + bit1= -checkdrive +*/ +int Xorriso_atip(struct XorrisO *xorriso, int flag) +{ + int ret, profile_number= 0; + int num_profiles= 0, profiles[64], i, can_write= 0, pf, no_medium= 0; + char is_current[64]; + char *respt, profile_name[80]; + double x_speed_max, x_speed_min= -1.0; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + enum burn_disc_status s; + char *manuf= NULL, *media_code1= NULL, *media_code2= NULL; + char *book_type= NULL, *product_id= NULL; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print drive and media info", 2); + if(ret<=0) + return(0); + respt= xorriso->result_line; + sprintf(respt, "Device type : "); + ret= burn_drive_get_drive_role(drive); + if(ret==0) + sprintf(respt+strlen(respt), "%s\n", "Emulated (null-drive)"); + else if(ret==2) + sprintf(respt+strlen(respt), "%s\n", + "Emulated (stdio-drive, 2k random read-write)"); + else if(ret==3) + sprintf(respt+strlen(respt), "%s\n", + "Emulated (stdio-drive, sequential write-only)"); + else if(ret == 4) + sprintf(respt+strlen(respt), "%s\n", + "Emulated (stdio-drive, 2k random read-only)"); + else if(ret == 5) + sprintf(respt+strlen(respt), "%s\n", + "Emulated (stdio-drive, 2k random write-only)"); + else if(ret!=1) + sprintf(respt+strlen(respt), "%s\n","Emulated (stdio-drive)"); + else + sprintf(respt+strlen(respt), "%s\n","Removable CD-ROM"); + sprintf(respt+strlen(respt), "Vendor_info : '%s'\n",dinfo->vendor); + sprintf(respt+strlen(respt), "Identifikation : '%s'\n",dinfo->product); + sprintf(respt+strlen(respt), "Revision : '%s'\n",dinfo->revision); + Xorriso_result(xorriso,1); + if(flag&1) + return(1); + + /* Do not report "Supported modes: SAO TAO" with -ROM drives */ + burn_drive_get_all_profiles(drive, &num_profiles, profiles, is_current); + if(num_profiles > 0) { + for(i= 0; i < num_profiles; i++) { + pf= profiles[i]; + if(pf == 0x09 || pf == 0x0a || pf == 0x11 || pf == 0x12 || pf == 0x13 || + pf == 0x14 || pf == 0x15 || pf == 0x1a || pf == 0x1b || pf == 0x2b || + pf == 0x41 || pf == 0x43 || pf == 0xffff) { + can_write= 1; + break; + } + } + } else + can_write= 1; + if(can_write) { + sprintf(respt, "Driver flags : BURNFREE\n"); + sprintf(respt+strlen(respt), "Supported modes: SAO TAO\n"); + Xorriso_result(xorriso,1); + } else if(flag & 2) { + sprintf(xorriso->info_text, "Not a CD/DVD/BD recorder"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + } + if(flag&2) + return(1); + + s= burn_disc_get_status(drive); + ret= burn_disc_get_profile(drive,&profile_number,profile_name); + if(ret<=0) { + profile_number= 0; + strcpy(profile_name, "-unidentified-"); + } + if(s != BURN_DISC_UNSUITABLE) { + ret= burn_disc_read_atip(drive); + if(ret>0) { + ret= burn_drive_get_min_write_speed(drive); + x_speed_min= ((double) ret)/176.4; + } + } + if(s==BURN_DISC_EMPTY) { + sprintf(respt, "Current: none\n"); + Xorriso_result(xorriso,1); + sprintf(xorriso->info_text, "No recognizable medium found in drive"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + no_medium= 1; + } else + sprintf(respt, "Current: %s\n",profile_name); + Xorriso_result(xorriso,1); + Xorriso_list_profiles(xorriso, 1 | 2); + if(no_medium) + return(1); + if(strstr(profile_name,"BD")==profile_name) { + printf("Mounted Media: %2.2Xh, %s\n", profile_number, profile_name); + } else if(strstr(profile_name,"DVD")==profile_name) { + sprintf(respt, "book type: %s (emulated booktype)\n", profile_name); + Xorriso_result(xorriso,1); + if(profile_number == 0x13) { + sprintf(respt, "xorriso: message for sdvdbackup: \"(growisofs mode Restricted Overwrite)\"\n"); + Xorriso_result(xorriso,1); + } + } else { + sprintf(respt, "ATIP info from disk:\n"); + Xorriso_result(xorriso,1); + if(burn_disc_erasable(drive)) + sprintf(respt, " Is erasable\n"); + else + sprintf(respt, " Is not erasable\n"); + Xorriso_result(xorriso,1); + { int start_lba,end_lba,min,sec,fr; + ret= burn_drive_get_start_end_lba(drive,&start_lba,&end_lba,0); + if(ret>0) { + burn_lba_to_msf(start_lba,&min,&sec,&fr); + sprintf(respt, " ATIP start of lead in: %d (%-2.2d:%-2.2d/%-2.2d)\n", + start_lba,min,sec,fr); + Xorriso_result(xorriso,1); + burn_lba_to_msf(end_lba,&min,&sec,&fr); + sprintf(respt, " ATIP start of lead out: %d (%-2.2d:%-2.2d/%-2.2d)\n", + end_lba,min,sec,fr); + Xorriso_result(xorriso,1); + } + } + ret= burn_drive_get_write_speed(drive); + x_speed_max= ((double) ret)/176.4; + if(x_speed_min<0) + x_speed_min= x_speed_max; + sprintf(respt, + " 1T speed low: %.f 1T speed high: %.f\n",x_speed_min,x_speed_max); + Xorriso_result(xorriso,1); + } + + ret= burn_disc_get_media_id(drive, &product_id, &media_code1, &media_code2, + &book_type, 0); + if(ret > 0 && media_code1 != NULL && media_code2 != NULL) + manuf= burn_guess_manufacturer(profile_number, media_code1, media_code2, 0); + if(product_id != NULL) { + sprintf(respt, "Product Id: %s\n", product_id); + Xorriso_result(xorriso,1); + } + if(manuf != NULL) { + sprintf(respt, "Producer: %s\n", manuf); + Xorriso_result(xorriso, 1); + } + if(profile_number == 0x09 || profile_number == 0x0a) { + sprintf(respt, "Manufacturer: %s\n", manuf); + Xorriso_result(xorriso, 1); + } else if(product_id != NULL && media_code1 != NULL && media_code2 != NULL){ + free(product_id); + free(media_code1); + free(media_code2); + if(book_type != NULL) + free(book_type); + product_id= media_code1= media_code2= book_type= NULL; + ret= burn_disc_get_media_id(drive, &product_id, &media_code1, &media_code2, + &book_type, 1); + if(ret > 0) { + sprintf(respt, "Manufacturer: '%s'\n", media_code1); + Xorriso_result(xorriso, 1); + if(media_code2[0]) { + sprintf(respt, "Media type: '%s'\n", media_code2); + Xorriso_result(xorriso, 1); + } + } + } + if(manuf != NULL) + free(manuf); + if(media_code1 != NULL) + free(media_code1); + if(media_code2 != NULL) + free(media_code2); + if(book_type != NULL) + free(book_type); + if(product_id != NULL) + free(product_id); + return(1); +} + + +/* @param flag bit1= outdev rather than indev + @return <0 error, 0 = no profile to see , 1= ok , 2= ok, is CD profile + 3= ok, is BD profile +*/ +int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number, + char profile_name[80], int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + *profile_number= 0; + profile_name[0]= 0; + if(((flag&2) && xorriso->out_drive_handle==NULL) || + ((!(flag&2)) && xorriso->in_drive_handle==NULL)) + return(0); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to determine media type", flag&2); + if(ret<=0) + return(0); + ret=burn_disc_get_profile(drive, profile_number, profile_name); + if(ret<=0) + return(ret); + if(*profile_number==0x08 || *profile_number==0x09 || *profile_number==0x0a) + return(2); + if(*profile_number == 0x40 || *profile_number == 0x41 || + *profile_number == 0x42 || *profile_number == 0x43) + return(3); + return(0); +} + + +/* @param flag bit0= grow_overwriteable_iso + bit1= obtain info from outdev + bit2= no need to obtain msc2 (NWA) +*/ +int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag) +{ + int ret, dummy; + struct burn_drive *drive; + struct burn_drive_info *dinfo; + enum burn_disc_status disc_state; + + *msc1= *msc2= -1; + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to obtain msinfo", flag&2); + if(ret<=0) + return(ret); + + if(flag&1) + disc_state= isoburn_disc_get_status(drive); + else + disc_state= burn_disc_get_status(drive); + if(disc_state != BURN_DISC_APPENDABLE && + !(disc_state == BURN_DISC_FULL && (flag & 4))) { + Xorriso_process_msg_queues(xorriso,0); + if(!(flag & 4)) { + sprintf(xorriso->info_text, + "%s medium is not appendable. Cannot obtain -msinfo.", + (flag&2) ? "Output" : "Input"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + return(0); + } + ret= isoburn_disc_get_msc1(drive, msc1); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, "Cannot obtain address of most recent session"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(flag & 4) + return(1); + ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &dummy, msc2); + if(ret<0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, "Cannot obtain next writeable address on media"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* @param flag bit0=input drive + bit1=output drive + bit2= wake up rather than calm down +*/ +int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag) +{ + int in_is_out_too, ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + in_is_out_too= (xorriso->in_drive_handle == xorriso->out_drive_handle); + if((flag & 1) && xorriso->in_drive_handle != NULL) { + Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to calm drive", 0); + burn_drive_snooze(drive, !!(flag & 4)); + if(in_is_out_too) + {ret= 1; goto ex;} + } + if((flag&2) && xorriso->out_drive_handle!=NULL) { + Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to calm drive", 2); + burn_drive_snooze(drive, !!(flag & 4)); + } + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* @param flag bit0= enable SCSI command logging to stderr */ +int Xorriso_scsi_log(struct XorrisO *xorriso, int flag) +{ + if(flag == 0) + burn_set_scsi_logging(0); + else + burn_set_scsi_logging(2|4); + return(1); +} + + +int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba, + off_t end_lba, char md5[16], int flag) +{ + int ret; + struct burn_drive_info *dinfo= NULL; + struct burn_drive *drive= NULL; + off_t pos, data_count, to_read; + char *data= NULL, data_md5[16]; + void *ctx = NULL; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to check session MD5 checksum", 0); + if(ret <= 0) + goto ex; + + Xorriso_alloc_meM(data, char, 64 * 1024); + + ret= iso_md5_start(&ctx); + if(ret <= 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + goto ex; + } + for(pos= start_lba; pos < end_lba; pos+= 32) { + to_read= 32; + if(pos + to_read > end_lba) + to_read= end_lba - pos; + ret= burn_read_data(drive, pos * (off_t) 2048, data, + to_read * (off_t) 2048, &data_count, 0); + if(ret <= 0) + goto ex; + iso_md5_compute(ctx, data, (int) data_count); + xorriso->pacifier_count+= data_count; + xorriso->pacifier_byte_count+= data_count; + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 0); + } + iso_md5_end(&ctx, data_md5); + ret= 1; + if(! iso_md5_match(md5, data_md5)) + ret= 0; +ex:; + Xorriso_process_msg_queues(xorriso,0); + if(ctx != NULL) + iso_md5_end(&ctx, data_md5); + Xorriso_free_meM(data); + return(ret); +} + + +int Xorriso_check_session_md5(struct XorrisO *xorriso, char *severity, + int flag) +{ + int ret, i; + IsoImage *image; + uint32_t start_lba, end_lba; + char md5[16], md5_text[33]; + + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret<=0) + return(ret); + ret= iso_image_get_session_md5(image, &start_lba, &end_lba, md5, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) + return(ret); + if(ret == 0) { + sprintf(xorriso->info_text, + "No session MD5 is recorded with the loaded session"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(0); + } + + sprintf(xorriso->info_text, "Checking loaded session by its recorded MD5.\n"); + Xorriso_info(xorriso, 0); + for(i= 0; i < 16; i++) + sprintf(md5_text + 2 * i, "%2.2x", ((unsigned char *) md5)[i]); + sprintf(xorriso->result_line, + "Session MD5 %s , LBA %.f , %.f blocks\n", + md5_text, (double) start_lba, (double) end_lba - start_lba); + Xorriso_result(xorriso,0); + ret= Xorriso_check_md5_range(xorriso, (off_t) start_lba, (off_t) end_lba, + md5, 0); + return(ret); +} + + +int Xorriso_check_for_abort(struct XorrisO *xorriso, + char *abort_file_path, + double post_read_time, + double *last_abort_file_time, int flag) +{ + struct stat stbuf; + + if(abort_file_path[0] == 0) + return(0); + if(post_read_time - *last_abort_file_time >= 0.1) { + if(stat(abort_file_path, &stbuf) != -1) { + if(stbuf.st_mtime >= xorriso->start_time) { + sprintf(xorriso->info_text, + "-check_media: Found fresh abort_file=%s", abort_file_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); + } + } + *last_abort_file_time= post_read_time; + } + return(0); +} + + +/* @param flag bit0= this is a follow-up session (i.e. on CD: TAO) + bit1= no pacifier messages + bit2= compute stream MD5 and look out for checksum tag + @return <=0 error, 1= done, 2= aborted due to limit +*/ +int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist, + struct CheckmediajoB *job, + int from_lba, int block_count, int read_chunk, + int md5_start, int flag) +{ + int i, j, ret, total_count= 0, sectors= -1, sector_size= -1, skip_reading; + int prev_quality= -1, quality= -1, retry= 0, profile_no, is_cd= 0; + int start_sec, end_sec, first_value, fret; + char profile_name[80]; + int start_lba= 0; + struct burn_drive *drive; + struct burn_drive_info *dinfo; + char *data= NULL; + off_t data_count, to_read, read_count= 0, write_amount; + double pre_read_time, post_read_time, time_diff, total_time_diff= 0; + double last_abort_file_time= 0; + void *ctx= NULL, *cloned_ctx= NULL; + char md5[16], tag_md5[16]; + uint32_t pos, range_start, range_size, next_tag= 0, lba, md5_spot_lba= 0; + int md5_spot_value= Xorriso_read_quality_untesteD, chain_broken= 0; + int tag_type= 0, valid, was_sb_tag= 0, in_track_gap= 0; + char *comparison= "", *sev_text= "DEBUG", *tag_type_name= ""; + + Xorriso_alloc_meM(data, char, 64*1024); + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to check media readability", + 2 * !!job->use_dev); + if(ret<=0) + goto ex; + ret= burn_disc_get_profile(drive, &profile_no, profile_name); + if(ret > 0) + if(profile_no >= 0x08 && profile_no <= 0x0a) + is_cd= 1; + + if(job->sector_map != NULL) { + Sectorbitmap_get_layout(job->sector_map, §ors, §or_size, 0); + sector_size/= 2048; + } + + if(job->retry > 0) + retry= 1; + else if(job->retry == 0 && is_cd) + retry= 1; + + if(flag & 4) { + ret= iso_md5_start(&ctx); + if(ret < 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + } + + start_lba= from_lba; + to_read= read_chunk; + post_read_time= Sfile_microtime(0); + for(i= 0; i < block_count; i+= to_read) { + skip_reading= 0; + ret= Xorriso_check_for_abort(xorriso, job->abort_file_path, post_read_time, + &last_abort_file_time, 0); + if(ret == 1) + goto abort_check; + if(job->item_limit > 0 && + Spotlist_count(spotlist, 0) + 2 >= job->item_limit) { + sprintf(xorriso->info_text, "-check_media: Reached item_limit=%d", + job->item_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + goto abort_check; + } + pre_read_time= Sfile_microtime(0); + if(job->time_limit > 0 + && job->start_time + job->time_limit < pre_read_time) { + sprintf(xorriso->info_text, "-check_media: Reached time_limit=%d", + job->time_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); +abort_check:; + if(prev_quality >= 0) { + ret= Spotlist_add_item(spotlist, start_lba, i + from_lba - start_lba, + prev_quality, 0); + if(ret <= 0) + goto ex; + } + ret= Spotlist_add_item(spotlist, i + from_lba, block_count - i, + Xorriso_read_quality_untesteD, 0); + if(ret > 0) + ret= 2; + goto ex; + } + + to_read= read_chunk; + if(i + to_read > block_count) + to_read= block_count - i; + if(is_cd && i + to_read + 2 >= block_count) { + /* Read last 2 blocks of CD track separately, because with TAO tracks + they are always unreadable but with SAO tracks they contain data. + */ + if(to_read > 2) + to_read-= 2; + else if(to_read > 1) { + if(flag & 1) { + quality= Xorriso_read_quality_tao_enD; + skip_reading= 1; + } else + to_read--; + } + } + + if(sector_size == read_chunk && from_lba % read_chunk == 0 + && !skip_reading) { + if(Sectorbitmap_is_set(job->sector_map, (i + from_lba) / sector_size, 0)){ + quality= Xorriso_read_quality_valiD; + skip_reading= 1; + } + } else if(sector_size > 0 && !skip_reading) { + start_sec= (i + from_lba) / sector_size; + end_sec= (i + to_read + from_lba) / sector_size; + first_value= Sectorbitmap_is_set(job->sector_map, start_sec, 0); + for(j= start_sec; j < end_sec; j++) + if(Sectorbitmap_is_set(job->sector_map, j, 0) != first_value) + break; + to_read= j * sector_size - i - from_lba; + skip_reading= !!first_value; + if(skip_reading) + quality= Xorriso_read_quality_valiD; + } + + if(skip_reading) { + pre_read_time= post_read_time= Sfile_microtime(0); + } else { + data_count= 0; + pre_read_time= Sfile_microtime(0); + ret= burn_read_data(drive, ((off_t) (i + from_lba)) * (off_t) 2048, data, + to_read * (off_t) 2048, &data_count, 4 * !retry); + post_read_time= Sfile_microtime(0); + time_diff= post_read_time - pre_read_time; + total_time_diff+= time_diff; + total_count++; + if(ret <= 0) { + Xorriso_process_msg_queues(xorriso,0); + if(data_count / 2048 < to_read) { + if(data_count > 0 && retry) { + if(prev_quality >= 0) { + ret= Spotlist_add_item(spotlist, start_lba, + i + from_lba - start_lba, prev_quality, 0); + if(ret <= 0) + goto ex; + } + ret= Spotlist_add_item(spotlist, i + from_lba, data_count / 2048, + Xorriso_read_quality_partiaL, 0); + if(ret <= 0) + goto ex; + start_lba= i + from_lba + data_count / 2048; + prev_quality= Xorriso_read_quality_unreadablE; + } + quality= Xorriso_read_quality_unreadablE; + if(retry) + to_read= data_count / 2048 + 1; + } else + quality= Xorriso_read_quality_partiaL; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret<0) + goto ex; + } else { + quality= Xorriso_read_quality_gooD; + if(time_diff > job->slow_threshold_seq && job->slow_threshold_seq > 0 && + i > 0) + quality= Xorriso_read_quality_sloW; + } + + /* MD5 checksumming */ + if(ctx != NULL) { + for(j= 0; j < to_read; j++) { + lba= i + j + from_lba; + if(lba < (uint32_t) md5_start) + continue; + ret= 0; + if(lba > (uint32_t) (md5_start) + 16 && + (next_tag == 0 || chain_broken || lba == next_tag)) { + ret= iso_util_decode_md5_tag(data + j * 2048, &tag_type, + &pos, &range_start, &range_size, + &next_tag, tag_md5, !!chain_broken); + } + valid= (ret == 1 || ret == (int) ISO_MD5_AREA_CORRUPTED) && + pos == lba; + if(valid && tag_type == 2 && (lba < ((uint32_t) md5_start) + 32 || + in_track_gap)) { + tag_type_name= "superblock"; + was_sb_tag= 1; + if(in_track_gap && range_start != ((uint32_t) md5_start) && + range_start < lba && lba - range_start <= (uint32_t) j) { + /* Looking for next session : start computing in hindsight. + Session start and superblock tag are supposed to be in the + same 64 kB chunk. + */ + iso_md5_end(&ctx, md5); + ret= iso_md5_start(&ctx); + if(ret < 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + iso_md5_compute(&ctx, data + (j - (lba - range_start)) * 2048, + (lba - range_start) * 2048); + md5_start= range_start; + in_track_gap= 0; + } + } else if(valid && tag_type == 4 && lba < 32) { + tag_type_name= "relocated 64kB superblock"; + }else if(valid && tag_type == 3 && was_sb_tag) { + tag_type_name= "tree"; + }else if(valid && tag_type == 1) { + + /* >>> ??? allow this without superblock and tree tag ? */ + + tag_type_name= "session"; + } else { + tag_type_name= ""; + } + if (tag_type_name[0]) { + if(range_start != (uint32_t) md5_start) { + sprintf(xorriso->info_text, + "Found MD5 %s tag which covers different data range", + tag_type_name); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0); + sprintf(xorriso->info_text, + " Expected: %u Found: %u", + (unsigned int) md5_start, range_start); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0); + chain_broken= 1; + valid= 0; + } else { + ret= iso_md5_clone(ctx, &cloned_ctx); + if(ret <= 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + iso_md5_end(&cloned_ctx, md5); + + if(ret == (int) ISO_MD5_AREA_CORRUPTED) { + comparison= "CORRUPTED"; + sev_text= "WARNING"; + md5_spot_value= Xorriso_read_quality_md5_mismatcH; + chain_broken= 1; + } else if(! iso_md5_match(tag_md5, md5)) { + comparison= "NON-MATCHING"; + sev_text= "WARNING"; + md5_spot_value= Xorriso_read_quality_md5_mismatcH; + chain_broken= 1; + } else { + comparison= "matching"; + sev_text= "UPDATE"; + md5_spot_value= Xorriso_read_quality_md5_matcH; + } + md5_spot_lba= lba; + sprintf(xorriso->info_text, + "Found %s MD5 %s tag: start=%d size=%d", + comparison, tag_type_name, md5_start, lba - md5_start); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + sev_text, 0); + } + if(valid && (tag_type == 1 || + (tag_type == 4 && pos == lba && lba < 32))) { + if(md5_spot_value != Xorriso_read_quality_untesteD) { + ret= Spotlist_add_item(spotlist, md5_start, + md5_spot_lba - md5_start, md5_spot_value, 0); + if(ret <= 0) + goto ex; + } + md5_spot_value= Xorriso_read_quality_untesteD; + md5_start = lba + 1; + if (md5_start % 32) + md5_start= md5_start + (32 - (md5_start % 32)); + next_tag= 0; + + iso_md5_end(&ctx, md5); + ret= iso_md5_start(&ctx); + if(ret < 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + if(tag_type == 1) + in_track_gap= 1; + continue; + } + } + iso_md5_compute(ctx, data + j * 2048, 2048); + } + } + + write_amount= data_count; + if(data_count > 0) { + read_count+= data_count; + if(job->data_to_limit >= 0 && read_count > job->data_to_limit) + write_amount-= (read_count - job->data_to_limit); + } + if(write_amount > 0) { + if(job->data_to_fd >= 0) { + ret= lseek(job->data_to_fd, + ((off_t) (i + from_lba)) * (off_t) 2048 + job->data_to_offset, + SEEK_SET); + if(ret == -1) { +failed_to_write:; + sprintf(xorriso->info_text, "Cannot write %d bytes to lba %d of ", + (int) data_count, i + from_lba); + Text_shellsafe(job->data_to_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, + "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= write(job->data_to_fd, data, write_amount); + if(ret == -1) + goto failed_to_write; + } + } + } + if(quality != prev_quality) { + if(prev_quality >= 0) { + ret= Spotlist_add_item(spotlist, start_lba, i + from_lba - start_lba, + prev_quality, 0); + if(ret <= 0) + goto ex; + } + start_lba= i + from_lba; + prev_quality= quality; + } + if(!(flag & 2)) { + xorriso->pacifier_count+= to_read; + if(post_read_time - xorriso->last_update_time >= + xorriso->pacifier_interval) + Xorriso_pacifier_callback(xorriso, "sectors examined", + xorriso->pacifier_count, xorriso->pacifier_total, "", 0); + } + } + if(prev_quality >= 0) { + ret= Spotlist_add_item(spotlist, start_lba, + block_count + from_lba - start_lba, prev_quality, 0); + if(ret <= 0) + goto ex; + } + + /* <<< for calibration of quality */ + if(total_count > 0) { + sprintf(xorriso->info_text, "Xorriso_check_interval: %.1f s / %d = %f", + total_time_diff, total_count, total_time_diff / total_count); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + + + /* MD5 checksumming : register result */ + + /* >>> ??? allow chain_broken to be a match ? */ + + if(next_tag > 0) { + sprintf(xorriso->info_text, "Missing announced MD5 tag: start=%d pos=%d", + md5_start, next_tag); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + md5_spot_value= Xorriso_read_quality_md5_mismatcH; + md5_spot_lba= next_tag; + } + if(md5_spot_value != Xorriso_read_quality_untesteD) { + ret= Spotlist_add_item(spotlist, md5_start, md5_spot_lba - md5_start, + md5_spot_value, 0); + if(ret <= 0) + goto ex; + } + + ret= 1; +ex: + if(ctx != NULL) + iso_md5_end(&ctx, md5); + Xorriso_free_meM(data); + return(ret); +} + + +int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist, + struct CheckmediajoB *job, int flag) +{ + int media_blocks= 0, read_chunk= 16, ret, mode, start_lba= 0; + int blocks, os_errno, i, j, last_track_end= -1, track_blocks, track_lba; + int num_sessions, num_tracks, declare_untested= 0, md5_start; + int read_capacity= -1, end_lba, hret, count, quality, profile_no; + char *toc_info= NULL, profile_name[80]; + struct burn_drive *drive; + struct burn_drive_info *dinfo; + struct isoburn_toc_disc *isoburn_disc= NULL; + struct isoburn_toc_session **isoburn_sessions; + struct isoburn_toc_track **iso_burn_tracks; + struct burn_toc_entry isoburn_entry; + struct stat stbuf; + struct burn_multi_caps *caps= NULL; + + *spotlist= NULL; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to check media readability", + 2 * !!job->use_dev); + if(ret<=0) + goto ex; + + /* >>> determine medium type dependent blocking factor: + 32 kB for CD (with 2kB retry) and DVD, 64 kB for BD + eventually adjust read_chunk + */; + if(job->min_block_size != 0) + read_chunk= job->min_block_size; + + ret= Spotlist_new(spotlist, 0); + if(ret <= 0) + {ret= -1; goto ex;} + + if(job->sector_map_path[0]) { + Sectorbitmap_destroy(&(job->sector_map), 0); + if(stat(job->sector_map_path, &stbuf) != -1) { + ret= Sectorbitmap_from_file(&(job->sector_map), job->sector_map_path, + xorriso->info_text, &os_errno, 0); + if(ret <= 0) { + if(xorriso->info_text[0]) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, os_errno, + "FAILURE", 0); + goto ex; + } + } + Xorriso_toc_to_string(xorriso, &toc_info, 4 * !job->map_with_volid); + } + ret= Xorriso_open_job_data_to(xorriso, job, 0); + if(ret <= 0) + goto ex; + Xorriso_pacifier_reset(xorriso, 0); + job->start_time= time(NULL); + mode= job->mode; + if(job->min_lba > 0) { + start_lba= job->min_lba; + ret= Spotlist_add_item(*spotlist, 0, job->min_lba, + Xorriso_read_quality_untesteD, 0); + if(ret <= 0) + goto ex; + } + ret= burn_get_read_capacity(drive, &read_capacity, 0); + if(ret <= 0) + read_capacity= -1; + ret = burn_disc_get_profile(drive, &profile_no, profile_name); + if(ret <= 0) + profile_no= 0; + + if(job->max_lba >= 0) { + blocks= job->max_lba + 1 - start_lba; + xorriso->pacifier_total= blocks; + ret= Xorriso_check_interval(xorriso, *spotlist, job, start_lba, blocks, + read_chunk, 0, 0); + if(ret <= 0) + goto ex; + + } else if(mode == 0) { /* track by track */ + isoburn_disc= isoburn_toc_drive_get_disc(drive); + if(isoburn_disc == NULL) + goto libburn_whole_disc; + isoburn_sessions= + isoburn_toc_disc_get_sessions(isoburn_disc, &num_sessions); + for(i= 0; i < num_sessions; i++) { + iso_burn_tracks= isoburn_toc_session_get_tracks(isoburn_sessions[i], + &num_tracks); + for(j= 0; j < num_tracks; j++) { + isoburn_toc_track_get_entry(iso_burn_tracks[j], &isoburn_entry); + if(!(isoburn_entry.extensions_valid & 1)) /* should not happen */ + continue; + track_lba= isoburn_entry.start_lba; + track_blocks= isoburn_entry.track_blocks; + + /* The last track of an appendable BD-R reports more blocks than the + read capacity allows. All BD-R track sizes are multiple of 64 kB. + */ + if (i == num_sessions - 1 && + (track_lba + track_blocks > read_capacity && + track_lba + track_blocks < read_capacity + 32 && + (profile_no == 0x41 || profile_no == 0x40))) + track_blocks= read_capacity - track_lba; + + md5_start= track_lba; + if(i == 0 && j == 0) { + if(track_lba == 32) { + ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0); + if(ret > 0) { + if(caps->start_adr) { + /* block 0 to 31 are the overall mount entry of overwriteable */ + track_lba= 0; + track_blocks+= 32; + } + } + } + } + if(last_track_end >= 0 && last_track_end < track_lba && + last_track_end >= start_lba) { + ret= Spotlist_add_item(*spotlist, last_track_end, + track_lba - last_track_end, + Xorriso_read_quality_off_tracK, 0); + if(ret <= 0) + goto ex; + xorriso->pacifier_count+= track_lba - last_track_end; + } + last_track_end= track_lba + track_blocks; + + if(track_lba < start_lba) { + track_blocks-= start_lba - track_lba; + track_lba= start_lba; + } + if(track_blocks <= 0) + continue; + if(declare_untested) { + ret= Spotlist_add_item(*spotlist, track_lba, track_blocks, + Xorriso_read_quality_untesteD, 0); + if(ret <= 0) + goto ex; + } else { + ret= Xorriso_check_interval(xorriso, *spotlist, job, track_lba, + track_blocks, read_chunk, md5_start, + (i > 0) | (4 * (xorriso->do_md5 & 1))); + if(ret <= 0) + goto ex; + if(ret == 2) + declare_untested= 1; + } + } + } + + } else if(mode == 1) { /* isoburn disc capacity */ + isoburn_disc= isoburn_toc_drive_get_disc(drive); + if(isoburn_disc == NULL) + goto libburn_whole_disc; + blocks= media_blocks= isoburn_toc_disc_get_sectors(isoburn_disc); + if(start_lba >= 0) + blocks-= start_lba; + if(media_blocks <= 0) + goto libburn_whole_disc; + xorriso->pacifier_total= blocks; + ret= Xorriso_check_interval(xorriso, *spotlist, job, start_lba, blocks, + read_chunk, 0, 0); + if(ret <= 0) + goto ex; + } else if(mode == 2) { +libburn_whole_disc:; + /* single sweep over libburn medium capacity */ + ret= burn_get_read_capacity(drive, &blocks, 0); + if(ret <= 0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, "No content detected on media"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->pacifier_total= blocks; + ret= Xorriso_check_interval(xorriso, *spotlist, job, 0, blocks, + read_chunk, 0, 0); + if(ret <= 0) + goto ex; + } + + Xorriso_pacifier_callback(xorriso, "sectors examined", + xorriso->pacifier_count, xorriso->pacifier_total, "", 1); + ret= 1; +ex:; + + if(job->data_to_fd != -1) + close(job->data_to_fd); + job->data_to_fd= -1; + + if(read_capacity >= 0) { + count= Spotlist_count(*spotlist, 0); + end_lba= 0; + for(i= 0; i < count; i++) { + Spotlist_get_item(*spotlist, i, &start_lba, &blocks, &quality, 0); + if(start_lba + blocks > end_lba) + end_lba= start_lba + blocks; + } + if(read_capacity > end_lba) { + hret= Spotlist_add_item(*spotlist, end_lba, read_capacity - end_lba, + Xorriso_read_quality_untesteD, 0); + if(hret < ret) + ret= hret; + } + } + + if(ret > 0) + ret= Xorriso_update_in_sector_map(xorriso, *spotlist, read_chunk, job, 0); + + if(ret > 0) { + ret= Xorriso_spotlist_to_sectormap(xorriso, *spotlist, read_chunk, + &(job->sector_map), !!job->untested_valid); + if(ret > 0 && job->sector_map_path[0]) { + ret= Sectorbitmap_to_file(job->sector_map, job->sector_map_path, toc_info, + xorriso->info_text, &os_errno, 0); + if(ret <= 0) { + if(xorriso->info_text[0]) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, os_errno, + "FAILURE", 0); + } + } + } + if(toc_info != NULL) + free(toc_info); + if(ret <= 0) + Spotlist_destroy(spotlist, 0); + if(caps!=NULL) + burn_disc_free_multi_caps(&caps); + if(isoburn_disc != NULL) + isoburn_toc_disc_free(isoburn_disc); + return(ret); +} + + +/* @param flag + bit0= if not MMC drive print NOTE and return 2 + bit1= obtain outdrive, else indrive + bit4= do not report failure +*/ +int Xorriso_get_drive_handles(struct XorrisO *xorriso, + struct burn_drive_info **dinfo, + struct burn_drive **drive, + char *attempt, int flag) +{ + int ret; + + if(flag&2) + *dinfo= (struct burn_drive_info *) xorriso->out_drive_handle; + else + *dinfo= (struct burn_drive_info *) xorriso->in_drive_handle; + if(*dinfo==NULL && !(flag & 16)) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, "No %s drive aquired %s", + (flag&2 ? "output" : "input"), attempt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + if(*dinfo==NULL) + return(0); + *drive= (*dinfo)[0].drive; + if(flag & 1) { + ret= burn_drive_get_drive_role(*drive); + if(ret != 1) { + sprintf(xorriso->info_text, + "Output device is not an MMC drive. Desired operation does not apply."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(2); + } + } + return((*drive)!=NULL); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/drive_mgt.h b/libisoburn/branches/1.1.8/xorriso/drive_mgt.h new file mode 100644 index 00000000..c165d495 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/drive_mgt.h @@ -0,0 +1,42 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which operate on drives + and media. +*/ + + +#ifndef Xorriso_pvt_drive_mgt_includeD +#define Xorriso_pvt_drive_mgt_includeD yes + + +int Xorriso_may_burn(struct XorrisO *xorriso, int flag); + +int Xorriso_toc_line(struct XorrisO *xorriso, int flag); + +int Xorriso_media_product(struct XorrisO *xorriso, int flag); + +int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba, + off_t end_lba, char md5[16], int flag); + +int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist, + struct CheckmediajoB *job, + int from_lba, int block_count, int read_chunk, + int md5_start, int flag); + +int Xorriso_get_drive_handles(struct XorrisO *xorriso, + struct burn_drive_info **dinfo, + struct burn_drive **drive, + char *attempt, int flag); + +int Xorriso_check_for_abort(struct XorrisO *xorriso, + char *abort_file_path, + double post_read_time, + double *last_abort_file_time, int flag); + +#endif /* ! Xorriso_pvt_drive_mgt_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/emulators.c b/libisoburn/branches/1.1.8/xorriso/emulators.c new file mode 100644 index 00000000..c7768ed6 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/emulators.c @@ -0,0 +1,2005 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the implementation of emulators for mkisofs and cdrecord. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +int Xorriso_cdrskin_uses_stdout(struct XorrisO *xorriso, int argc, char **argv, + int flag) +{ + int i; + + for(i= 0; i < argc; i++) { + if(strcmp(argv[i], "dev=-") == 0 || + strcmp(argv[i], "dev=stdio:/dev/fd/1") == 0 || + strcmp(argv[i], "-dev=-") == 0 || + strcmp(argv[i], "-dev=stdio:/dev/fd/1") == 0) + return(1); + } + return(0); +} + + +int Xorriso_cdrskin_help(struct XorrisO *xorriso, int flag) +{ + static char helptext[][80]= { +"Usage: xorriso -as cdrecord [options|source_addresses]", +"Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorriso", +"Options:", +"\t-version\tprint version information and exit emulation", +"\t--devices\tprint list of available MMC drives and exit emulation", +"\tdev=target\tpseudo-SCSI target to use as CD-Recorder", +"\t-v\t\tincrement verbose level by one", +"\t-V\t\tincrement SCSI command transport verbose level by one", +"\t-checkdrive\tcheck if a driver for the drive is present", +"\t-inq\t\tdo an inquiry for the drive", +"\tspeed=#\t\tset speed of drive", +"\tblank=type\tblank a CD-RW disc (see blank=help)", +"\tfs=#\t\tSet fifo size to # (0 to disable, default is 4 MB)", +"\t-eject\t\teject the disk after doing the work", +"\t-dummy\t\tdo everything with laser turned off", +"\t-msinfo\t\tretrieve multi-session info for mkisofs >= 1.10", +"\t-toc\t\tretrieve and print TOC/PMA data", +"\t-atip\t\tretrieve media state, print \"Is *erasable\"", +"\t-multi\t\tgenerate a TOC that allows multi session", +"\t-waiti\t\twait until input is available before opening SCSI", +"\ttsize=#\t\tannounces exact size of source data", +"\tpadsize=#\tAmount of padding", +"\t-data\t\tSubsequent tracks are CD-ROM data mode 1 (default)", +"\t-isosize\tUse iso9660 file system size for next data track", +"\t-pad\t\tpadsize=30k", +"\t-nopad\t\tDo not pad", +"\t--grow_overwriteable_iso\temulate multi-session on DVD+RW, BD-RE", +"\twrite_start_address=#\t\twrite to byte address on DVD+RW, BD-RE", +"\tstream_recording=on|number\ttry to get full speed on DVD-RAM, BD", +"\tdvd_obs=default|32k|64k\t\tbytes per DVD/BD write operation", +"\tstdio_sync=on|off|number\twhether to fsync output to \"stdio:\"", +"\t--no_rc\t\tDo not execute xorriso startup files", +"\t-help\t\tprint this text to stderr and exit emulation", +"Actually this is the integrated ISO RockRidge filesystem manipulator xorriso", +"lending its libburn capabilities to a very limited cdrecord emulation. Only", +"a single data track can be burnt to blank, appendable or overwriteable media.", +"A much more elaborate cdrecord emulator is cdrskin from the same project.", +"@End_of_helptexT@" +}; + int i; + + for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) { + sprintf(xorriso->info_text, "%s\n", helptext[i]); + Xorriso_info(xorriso,0); + } + return(1); +} + + +/* micro version of cdrskin */ +int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, + int flag) +{ + int ret, i, k, mem_do_close, aq_ret, eject_ret, msc1, msc2, hflag; + int do_atip= 0, do_checkdrive= 0, do_eject= 0, do_scanbus= 0; + int do_toc= 0, do_verbous= 0, do_version= 0, do_help= 0, do_waiti= 0; + int do_multi= 0, do_msinfo= 0, do_grow= 0, do_isosize= 0, do_xa1= 0; + double write_start_address= -1.0, tsize= -1.0; + char *track_source= NULL, *dev_adr= NULL, *cpt; + char mem_report_about_text[80], *report_about= "SORRY", blank_mode[80]; + char speed[80]; + + /* cdrecord 2.01 options which are not scheduled for implementation, yet */ + static char ignored_partial_options[][41]= { + "timeout=", "debug=", "kdebug=", "kd=", "driver=", "ts=", + "pregap=", "defpregap=", "mcn=", "isrc=", "index=", "textfile=", + "pktsize=", "cuefile=", + "gracetime=", "minbuf=", + + "assert_write_lba=", "fifo_start_at=", "dev_translation=", + "drive_scsi_dev_family=", "fallback_program=", "modesty_on_drive=", + "tao_to_sao_tsize=", + + "direct_write_amount=", "msifile=", + + "" + }; + static char ignored_full_options[][41]= { + "-d", "-silent", "-s", "-setdropts", "-prcap", + "-reset", "-abort", "-overburn", "-ignsize", "-useinfo", + "-fix", "-nofix", + "-raw", "-raw96p", "-raw16", + "-clone", "-text", + "-cdi", "-preemp", "-nopreemp", "-copy", "-nocopy", + "-scms", "-shorttrack", "-noshorttrack", "-packet", "-noclose", + "-media-info", "-minfo", + "-load", "-lock", "-raw96r", "-sao", "-dao", "-swab", + "-tao", "-force", "-format", + + "--adjust_speed_to_drive", "--allow_emulated_drives", "--allow_setuid", + "--allow_untested_media", "--any_track", "--demand_a_drive", + "--fifo_disable", "--fifo_start_empty", "--fill_up_media", + "--list_ignored_options", "--no_rc", "--no_convert_fs_adr", + "--prodvd_cli_compatible", "--single_track", + "--tell_media_space", + + "" + }; + +static char blank_help[][80]= { +"Blanking options:", +"\tall\t\tblank the entire disk", +"\tdisc\t\tblank the entire disk", +"\tdisk\t\tblank the entire disk", +"\tfast\t\tminimally blank the entire disk", +"\tminimal\t\tminimally blank the entire disk", +"\tas_needed\tblank or format medium to make it ready for (re-)use", +"\tdeformat\t\tblank a formatted DVD-RW", +"\tdeformat_quickest\tminimally blank a formatted DVD-RW to DAO only", +"\tformat_overwrite\tformat a DVD-RW to \"Restricted Overwrite\"", +"@End_of_helptexT@" +}; + + mem_do_close= xorriso->do_close; + Xorriso_alloc_meM(track_source, char, SfileadrL); + Xorriso_alloc_meM(dev_adr, char, SfileadrL); + + strcpy(mem_report_about_text, xorriso->report_about_text); + + track_source[0]= 0; + dev_adr[0]= 0; + blank_mode[0]= 0; + speed[0]= 0; + + if(xorriso->in_drive_handle != NULL) { + ret= Xorriso_option_dev(xorriso, "", 1|32); /* give up indev */ + if(ret!=1) + goto ex; + } + + + /* Assess plan, make settings */ + for(i= 0; iinfo_text, "-as %s: ", whom); + Text_shellsafe(argv[i], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + for(k=0;ignored_partial_options[k][0]!=0;k++) { + if(argv[i][0]=='-') + if(strncmp(argv[i]+1,ignored_partial_options[k], + strlen(ignored_partial_options[k]))==0) + goto no_volunteer; + if(strncmp(argv[i],ignored_partial_options[k], + strlen(ignored_partial_options[k]))==0) + goto no_volunteer; + } + for(k=0;ignored_full_options[k][0]!=0;k++) + if(strcmp(argv[i],ignored_full_options[k])==0) + goto no_volunteer; + if(0) { +no_volunteer:; + sprintf(xorriso->info_text, "-as %s: Ignored option ", whom); + Text_shellsafe(argv[i], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + continue; + } + + if(strcmp(argv[i], "-atip")==0) { + do_atip= 1; + } else if(strcmp(argv[i], "-audio")==0) { + sprintf(xorriso->info_text, "-as %s: Option -audio not supported.", whom); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } else if(strncmp(argv[i], "-blank=", 7)==0 || + strncmp(argv[i], "blank=", 6)==0) { + cpt= strchr(argv[i], '=')+1; + if(strcmp(cpt,"all")==0 || strcmp(cpt,"disc")==0 + || strcmp(cpt,"disk")==0) { + strcpy(blank_mode, "all"); + } else if(strcmp(cpt,"fast")==0 || strcmp(cpt,"minimal")==0) { + strcpy(blank_mode, "fast"); + } else if(strcmp(cpt,"help")==0) { + strcpy(blank_mode, "help"); + } else if(strcmp(cpt,"deformat")==0 || + strcmp(cpt,"deformat_sequential")==0 || + strcmp(cpt,"deformat_quickest")==0 || + strcmp(cpt,"deformat_sequential_quickest")==0) { + strcpy(blank_mode, cpt); + } else if(strcmp(cpt,"format_overwrite")==0) { + strcpy(blank_mode, "format_overwrite"); + } else if(strcmp(cpt,"as_needed")==0) { + strcpy(blank_mode, "as_needed"); + } else { + sprintf(xorriso->info_text, "-as %s: blank=", whom); + Text_shellsafe(argv[i], xorriso->info_text, 1); + strcat(xorriso->info_text, " not supported. See blank=help ."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else if(strcmp(argv[i], "-checkdrive")==0) { + do_checkdrive= 1; + } else if(strcmp(argv[i], "-data")==0) { + /* ok */; + } else if(strncmp(argv[i], "-dev=", 5)==0 || + strncmp(argv[i], "dev=", 4)==0) { + cpt= strchr(argv[i], '=')+1; + strcpy(dev_adr, cpt); + } else if(strcmp(argv[i], "--devices")==0) { + do_scanbus= 2; + } else if(strncmp(argv[i],"driveropts=", 11)==0 || + strncmp(argv[i],"-driveropts=", 12)==0) { + if(strcmp(argv[i]+11, "help")==0) { + fprintf(stderr,"Driver options:\n"); + fprintf(stderr, + "burnfree\tPrepare writer to use BURN-Free technology\n"); + } + } else if(strcmp(argv[i], "-dummy")==0) { + xorriso->do_dummy= 1; + } else if(strcmp(argv[i], "-eject")==0) { + do_eject= 1; + } else if(strncmp(argv[i], "-fs=", 4)==0 || strncmp(argv[i], "fs=", 3)==0) { + cpt= strchr(argv[i], '=')+1; + ret= Xorriso_option_fs(xorriso, cpt, 0); + if(ret<=0) + goto ex; + } else if(strcmp(argv[i], "--grow_overwriteable_iso")==0) { + do_grow= 1; + } else if(strcmp(argv[i], "-help")==0) { + do_help= 1; + } else if(strcmp(argv[i], "-isosize")==0) { + do_isosize= 1; + } else if(strcmp(argv[i], "-inq")==0) { + do_checkdrive= 2; + } else if(strcmp(argv[i], "-mode2")==0) { + Xorriso_msgs_submit(xorriso, 0, + "Defaulting option -mode2 to option -data", 0, "NOTE", 0); + } else if(strcmp(argv[i], "-msinfo")==0) { + do_msinfo= 1; + } else if(strcmp(argv[i], "-multi")==0) { + do_multi= 1; + } else if(strcmp(argv[i], "-nopad")==0) { + xorriso->padding= 0; + } else if(strcmp(argv[i], "--no_rc")==0) { + /* already performed in Xorriso_prescan_args */; + } else if(strcmp(argv[i], "-pad")==0) { + xorriso->padding= 15*2048; + } else if(strncmp(argv[i], "-padsize=", 9)==0 || + strncmp(argv[i], "padsize=", 8)==0) { + cpt= strchr(argv[i], '=')+1; + ret= Xorriso_option_padding(xorriso, cpt, 0); + if(ret<=0) + goto ex; + } else if(strcmp(argv[i], "-scanbus")==0) { + sprintf(xorriso->info_text, "-as %s: Option -scanbus not supported.", + whom); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + +/* do_scanbus= 1; */ + } else if(strncmp(argv[i], "-speed=", 7)==0 || + strncmp(argv[i], "speed=", 6)==0) { + cpt= strchr(argv[i], '=')+1; + strncpy(speed, cpt, 79); + speed[79]= 0; + + } else if(strncmp(argv[i], "-stream_recording=", 18)==0 || + strncmp(argv[i], "stream_recording=", 17)==0) { + cpt= strchr(argv[i], '=')+1; + Xorriso_option_stream_recording(xorriso, cpt, 0); + + } else if(strncmp(argv[i], "-dvd_obs=", 9)==0 || + strncmp(argv[i], "dvd_obs=", 8)==0) { + cpt= strchr(argv[i], '=') + 1; + Xorriso_option_dvd_obs(xorriso, cpt, 0); + + } else if(strncmp(argv[i], "-stdio_sync=", 12)==0 || + strncmp(argv[i], "stdio_sync=", 11)==0) { + cpt= strchr(argv[i], '=') + 1; + Xorriso_option_stdio_sync(xorriso, cpt, 0); + + } else if(strcmp(argv[i], "-toc")==0 || strcmp(argv[i], "--long_toc")==0) { + do_toc= 1; + } else if(strncmp(argv[i], "-tsize=", 7)==0 || + strncmp(argv[i], "tsize=", 6)==0) { + cpt= strchr(argv[i], '=')+1; + tsize= Scanf_io_size(cpt, 1); + if(tsize > 1024.0*1024.0*1024.0*1024.0*1024.0) { + sprintf(xorriso->info_text, "-as %s: much too large: %s",whom, argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else if(strcmp(argv[i], "-V")==0 || strcmp(argv[i],"-Verbose")==0) { + Xorriso_option_scsi_log(xorriso, "on", 0); + } else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i],"-verbose")==0) { + do_verbous++; + } else if(strcmp(argv[i], "-vv")==0) { + do_verbous+= 2; + } else if(strcmp(argv[i], "-vvv")==0) { + do_verbous+= 3; + } else if(strcmp(argv[i], "-version")==0) { + do_version= 1; + } else if(strcmp(argv[i], "-waiti")==0) { + do_waiti= 1; + } else if(strncmp(argv[i], "write_start_address=", 20)==0) { + write_start_address= Scanf_io_size(argv[i]+20,0); + } else if(strcmp(argv[i], "-xa")==0) { + Xorriso_msgs_submit(xorriso, 0, + "Defaulting option -xa to option -data", 0, "NOTE", 0); + } else if(strcmp(argv[i], "-xa1")==0) { + if(do_xa1 == 0) + do_xa1= 1; + } else if(strcmp(argv[i], "--xa1-ignore")==0) { + do_xa1= -1; + } else if(strcmp(argv[i], "-xa2")==0) { + Xorriso_msgs_submit(xorriso, 0, + "Defaulting option -xa2 to option -data", 0, "NOTE", 0); + } else if(strcmp(argv[i], "-xamix")==0) { + Xorriso_msgs_submit(xorriso, 0, + "Option -xamix not implemented and data not yet convertible to other modes", + 0, "FATAL", 0); + ret= 0; goto ex; + } else if(argv[i][0]=='-' && argv[i][1]!=0) { + sprintf(xorriso->info_text, "-as %s: Unknown option ", whom); + Text_shellsafe(argv[i], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } else { + if(track_source[0]) { + sprintf(xorriso->info_text, "-as %s: Surplus track source ", whom); + Text_shellsafe(argv[i], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, "First and only track source is "); + Text_shellsafe(track_source, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 0; goto ex; + } + if(Sfile_str(track_source, argv[i], 0)<=0) + {ret= -1; goto ex;} + } + } + + /* Perform actions */ + Xorriso_option_report_about(xorriso, "NOTE", 0); + if(do_version) { + sprintf(xorriso->result_line, "Cdrecord 2.01-Emulation Copyright (C) 2011 see libburnia-project.org xorriso\n"); + Xorriso_result(xorriso, 1); + Xorriso_option_version(xorriso, 0); + ret= 1; goto ex; + } + if(do_waiti) { + sprintf(xorriso->info_text, + "xorriso: Option -waiti pauses program until input appears at stdin\n"); + Xorriso_info(xorriso,0); + sprintf(xorriso->result_line, "Waiting for data on stdin...\n"); + Xorriso_result(xorriso, 1); + for(ret= 0; ret==0; ) + ret= Wait_for_input(0,1000000,0); + if(ret<0 || feof(stdin)) { + Xorriso_msgs_submit(xorriso, 0, + "stdin produces exception rather than data", 0, "NOTE", 0); + } + sprintf(xorriso->info_text, "xorriso: Option -waiti pausing is done.\n"); + } + if(dev_adr[0]) { + hflag= 2 | 32 | 64; + if(!do_grow) + hflag|= 8; /* consider overwriteables as blank */ + ret= Xorriso_option_dev(xorriso, dev_adr, hflag); + if(ret<=0) + goto ex; + } + + if(do_help) { + Xorriso_cdrskin_help(xorriso, 0); + ret= 1; goto ex; + } + if(do_scanbus) { + if(do_scanbus==1) + /* >>> would need -scanbus compatible output and input format */; + else + Xorriso_option_devices(xorriso, 0); + ret= 1; goto ex; + } + if(strcmp(blank_mode, "help")==0) { + for(i= 0; strcmp(blank_help[i], "@End_of_helptexT@")!=0; i++) { + sprintf(xorriso->info_text, "%s\n", blank_help[i]); + Xorriso_info(xorriso,0); + } + ret= 1; goto ex; + } + + if(!(do_checkdrive || do_atip || do_toc || blank_mode[0] || track_source[0] || + do_eject || do_msinfo)) + {ret= 1; goto ex;} + + if(xorriso->out_drive_handle==NULL) { + sprintf(xorriso->info_text, "-as %s: No output drive selected", whom); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + if(do_msinfo) { + ret= Xorriso_msinfo(xorriso, &msc1, &msc2, 2 | !!do_grow); + if(ret<=0) + goto ex; + sprintf(xorriso->result_line, "%d,%d\n", msc1, msc2); + Xorriso_result(xorriso, 1); + } + + if(speed[0]) { + ret= Xorriso_option_speed(xorriso, speed, 0); + if(ret<=0) + goto ex; + } + + if(do_verbous<=0) + report_about= "SORRY"; + else if(do_verbous<=2) + report_about= "UPDATE"; + else if(do_verbous==3) + report_about= "DEBUG"; + else + report_about= "ALL"; + Xorriso_option_report_about(xorriso, report_about, 0); + + if(do_checkdrive) { + ret= Xorriso_atip(xorriso, 2-(do_checkdrive==2)); + if(ret<=0) + goto ex; + } + if(do_atip) { + ret= Xorriso_atip(xorriso, 0); + if(ret<=0) + goto ex; + } + if(do_toc) { + ret= Xorriso_option_toc(xorriso, 0); + if(ret<=0) + goto ex; + } + if(strcmp(blank_mode, "format_overwrite")==0) { + ret= Xorriso_option_blank(xorriso, "fast", 1); + if(ret<=0) + goto ex; + } else if(blank_mode[0]) { + ret= Xorriso_option_blank(xorriso, blank_mode, 0); + if(ret<=0) + goto ex; + } + if(track_source[0]) { + xorriso->do_close= !do_multi; + ret= Xorriso_burn_track(xorriso, (off_t) write_start_address, + track_source, (off_t) tsize, + (!!do_grow) | ((!!do_isosize) << 1) | ((do_xa1 == 1) << 2)); + aq_ret= Xorriso_reaquire_outdev(xorriso, 2*(ret>0)); + if(ret<=0 && ret=0) { + eject_ret= Xorriso_option_eject(xorriso, "out", 0); + if(eject_retinfo_text, "-as %s: Job could not be performed properly.", + whom); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + Xorriso_option_report_about(xorriso, mem_report_about_text, 0); + xorriso->do_close= mem_do_close; + Xorriso_free_meM(dev_adr); + Xorriso_free_meM(track_source); + return(ret); +} + + +/* This function shall know all options of mkisofs, genisoimage, xorrisofs, ... + and the number of arguments which they expect and consume. +*/ +int Xorriso_genisofs_count_args(struct XorrisO *xorriso, int argc, char **argv, + int *count, int flag) +{ + int i; + char *cmd; + + static char partial_options[][41]= { + "errctl=", + "isolinux_mbr=", "--modification-date=", + "" + }; + static char arg0_options[][41]= { + "-allow-leading-dots", "-ldots", "-allow-lowercase", "-allow-multidot", + "-cache-inodes", "-no-cache-inodes", "-eltorito-alt-boot", + "-hard-disk-boot", "-no-emul-boot", "-no-boot", "-boot-info-table", + "-check-oldnames", "-d", "-D", "-dvd-video", "-f", "-gui", "-graft-points", + "-hide-joliet-trans-tbl", "-hide-rr-moved", "-J", "-joliet-long", "-l", + "-L", "-max-iso9660-filenames", "-N", "-nobak", "-no-bak", + "-no-limit-pathtables", "-force-rr", "-no-rr", + "-no-split-symlink-components", "-no-split-symlink-fields", "-pad", + "-no-pad", "-posix-H", "-posix-L", "-posix-P", "-print-size", + "-quiet", "-R", "-r", "-relaxed-filenames", "-rrip110", "-rrip112", + "-split-output", "-T", "-UDF", "-udf", "-udf-symlinks", "-no-udf-symlinks", + "-U", "-no-iso-translate", "-v", "-XA", "-xa", "-z", + "-hfs", "-no-hfs", "-apple", "-probe", "-no-desktop", "-mac-name", + "-part", "-icon-position", "-chrp-t", "-hfs-unlock", "--cap", "--netatalk", + "--double", "--ethershare", "--ushare", "--exchange", "--sgi", "--xinet", + "--macbin", "--single", "--dave", "--sfm", "--osx-double", "--osx-hfs", + "-debug", "-omit-period", "-disable-deep-relocation", "-joliet", + "-full-iso9660-filenames", "-follow-links", "-help", + "-transparent-compression", + "-omit-version-number", "-rational-rock", "-rock", "-translation-table", + "-untranslated-filenames", "-verbose", "-version", "-g", "-h", + "-no-mac-files", "-chrp-boot", + "--hardlinks", "--acl", "--xattr", "--md5", "--for_backup", + "--protective-msdos-label", "--boot-catalog-hide", "--no-emul-toc", + "--emul-toc", "-disallow_dir_id_ext", "--old-empty", + "--old-root-no-md5", "--old-root-devno", "--old-root-no-ino", + "--no_rc", + "" + }; + static char arg1_options[][41]= { + "-abstract", "-A", "-appid", "-biblio", "-b", "-B", "-boot-load-seg", + "-boot-load-size", "-C", "-c", "-check-session", "-copyright", + "-dir-mode", "-file-mode", "-G", "-gid", "-hide", "-hide-list", + "-hidden", "-hidden-list", "-hide-joliet", "-hide-joliet-list", + "-hide-udf", "-hide-udf-list", "-input-charset", "-output-charset", + "-iso-level", "-jcharset", "-log-file", "-m", "-exclude-list", "-M", + "-dev", "-new-dir-mode", "-o", "-p", "-preparer", + "-path-list", "-publisher", "-root", + "-old-root", "-s", "-sectype", "-sort", "-sparc-boot", "-sparc-label", + "-stream-media-size", "-stream-file-name", "-sunx86-boot", "-sunx86-label", + "-sysid", "-table-name", "-ucs-level", "-uid", "-V", "-volset", + "-volset-size", "-volset-seqno", "-x", "-P", + "-map", "-magic", "-hfs-creator", "-hfs-type", "-boot-hfs-file", "-auto", + "-cluster-size", "-hide-hfs", "-hide-hfs-list", "-hfs-volid", + "-root-info", "-prep-boot", "-input-hfs-charset", "-output-hfs-charset", + "-hfs-bless", "-hfs-parms", + "-eltorito-boot", "-generic-boot", "-eltorito-catalog", "-cdrecord-params", + "-errctl", "-exclude", "-prev-session", "-output", "-use-fileversion", + "-volid", "-old-exclude", + "-alpha-boot", "-hppa-cmdline", "-hppa-kernel-32", "-hppa-kernel-64", + "-hppa-bootloader", "-hppa-ramdisk", "-mips-boot", "-mipsel-boot", + "-jigdo-jigdo", "-jigdo-template", "-jigdo-min-file-size", + "-jigdo-force-md5", "-jigdo-exclude", "-jigdo-map", "-md5-list", + "-jigdo-template-compress", + "-checksum_algorithm_iso", "-checksum_algorithm_template", + "--stdio_sync", "--quoted_path_list", "--efi-boot", "--embedded-boot", + "-isohybrid-mbr", "-e", "-partition_offset", "-partition_hd_cyl", + "-partition_sec_hd", "-partition_cyl_align", "-untranslated_name_len", + "" + }; + static char arg2_options[][41]= { + "--scdbackup_tag", "--sort-weight", + "" + }; + static char arg3_options[][41]= { + "-append_partition", + "" + }; + static char final_options[][41]= { + "-find", + "" + }; + + cmd= argv[0]; + *count= 0; + for(i=0; partial_options[i][0]!=0; i++) + if(strncmp(partial_options[i], cmd, strlen(partial_options[i]))==0) + return(1); + for(i=0; arg0_options[i][0]!=0; i++) + if(strcmp(arg0_options[i], cmd)==0) + return(1); + *count= 1; + for(i=0; arg1_options[i][0]!=0; i++) + if(strcmp(arg1_options[i], cmd)==0) + return(1); + *count= 2; + for(i=0; arg2_options[i][0]!=0; i++) + if(strcmp(arg2_options[i], cmd)==0) + return(1); + *count= 3; + for(i=0; arg3_options[i][0]!=0; i++) + if(strcmp(arg3_options[i], cmd)==0) + return(1); + *count= argc - 1; + for(i=0; final_options[i][0]!=0; i++) + if(strcmp(final_options[i], cmd)==0) + return(1); + *count= 0; + return(0); +} + + +/* @param flag bit0= do not report eventual ignore decision +*/ +int Xorriso_genisofs_ignore(struct XorrisO *xorriso, char *whom, + char *argpt, int *i, int flag) +{ + /* mkisofs 2.01 options which are not scheduled for implementation, yet */ + static char ignored_arg0_options[][41]= { + "-allow-leading-dots", "-ldots", "-allow-multidot", + "-cache-inodes", "-no-cache-inodes", "-check-oldnames", "-D", + "-disable-deep-relocation", + "-L", "-nobak", + "-no-bak", "-force-rr", "-relaxed-filenames", "-T", + "-no-iso-translate", + "" + }; + static char ignored_arg1_options[][41]= { + "-check-session", "-hide-hfs", "-hide-hfs-list", + "-table-name", "-volset-seqno", "-volset-size", + "" + }; + int k; + + for(k=0;ignored_arg0_options[k][0]!=0;k++) + if(strcmp(argpt,ignored_arg0_options[k])==0) + goto no_volunteer; + for(k=0;ignored_arg1_options[k][0]!=0;k++) + if(strcmp(argpt,ignored_arg1_options[k])==0) { + (*i)++; + goto no_volunteer; + } + return(0); +no_volunteer:; + sprintf(xorriso->info_text, "-as %s: Ignored option ", whom); + Text_shellsafe(argpt, xorriso->info_text, 1); + if(!(flag & 1)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); +} + + +int Xorriso_genisofs_add_boot(struct XorrisO *xorriso, char *whom, + int *option_b, int *emul_boot, int flag) +{ + int ret; + + if(*option_b) + xorriso->boot_image_emul= *emul_boot; + else + xorriso->boot_image_emul= 0; + ret= Xorriso_attach_boot_image(xorriso, 0); + if(ret <= 0) + xorriso->boot_image_bin_path[0]= 0; + *option_b= 0; + *emul_boot= 2; + return(ret); +} + + +int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag) +{ + static char helptext[][160]= { +"Usage: xorriso -as mkisofs [options] file...", +"Note: This is not mkisofs. See xorriso -help, xorriso -version, man xorrisofs", +"Options:", +" -f, -follow-links Follow symbolic links", +" -graft-points Allow to use graft points for filenames", +" -help Print option help", +" -hide GLOBFILE Hide ISO9660/RR file", +" -hide-list FILE File with list of ISO9660/RR files to hide", +" -hide-joliet GLOBFILE Hide Joliet file", +" -hide-joliet-list FILE File with list of Joliet files to hide", +" -input-charset CHARSET Local input charset for file name conversion", +" -output-charset CHARSET Output charset for file name conversion", +" -iso-level LEVEL Set ISO9660 conformance level (1..3) or 4 for ISO9660 version 2", +" -disallow_dir_id_ext Do not allow dot in ISO directory names", +" -J, -joliet Generate Joliet directory information", +" -joliet-long Allow Joliet file names to be 103 Unicode characters", +" -U, -untranslated-filenames Allow Untranslated filenames (for HPUX & AIX - violates ISO9660).", +" -untranslated_name_len LEN Allow up to LEN (1..96) name characters (heavily violates ISO9660).", +" -allow-lowercase Allow lower case characters in addition to the current character set (violates ISO9660)", +" -d, -omit-period Omit trailing periods from filenames (violates ISO9660)", +" -l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names", +" -max-iso9660-filenames Allow 37 character filenames for ISO9660 names (violates ISO9660)", +" -N, -omit-version-number Omit version number from ISO9660 filename (violates ISO9660)", +" -o FILE, -output FILE Set output file name", +" -m GLOBFILE, -exclude GLOBFILE", +" Exclude file name", +" -x FILE, -old-exclude FILE Exclude file name", +" -exclude-list FILE File with list of file names to exclude", +" -pad Pad output by 300k (default)", +" -no-pad Do not pad output", +" -M FILE, -prev-session FILE Set path to previous session to merge", +" -C PARAMS, -cdrecord-params PARAMS", +" Magic paramters from cdrecord", +" -dir-mode mode Make the mode of all directories this mode.", +" -file-mode mode Make the mode of all plain files this mode.", +" -path-list FILE File with list of pathnames to process", +" --quoted_path_list FILE File with list of quoted pathnames to process", +" -print-size Print estimated filesystem size and exit", +" -quiet Run quietly", +" -R, -rock Generate Rock Ridge directory information", +" -r, -rational-rock Generate rationalized Rock Ridge directory information", +" --hardlinks Record eventual hard link relations of files", +" --acl Record eventual ACLs of files", +" --xattr Record eventual user space xattr of files", +" --md5 Compute and record MD5 checksums of data files", +" --scdbackup_tag PATH NAME With --md5 record a scdbackup checksum tag", +" --for_backup Use all options which improve backup fidelity", +" -V ID, -volid ID Set Volume ID", +" -volset ID Set Volume set ID", +" -publisher PUB Set Volume publisher", +" -A ID, -appid ID Set Application ID", +" -sysid ID Set System ID", +" -p PREP, -preparer PREP Set Volume preparer", +" -abstract FILE Set Abstract filename", +" -biblio FILE Set Bibliographic filename", +" -copyright FILE Set Copyright filename", +" -jigdo-jigdo FILE Produce a jigdo .jigdo file as well as the .iso", +" -jigdo-template FILE Produce a jigdo .template file as well as the .iso", +" -jigdo-min-file-size SIZE Minimum size for a file to be listed in the jigdo file", +" -jigdo-force-md5 PATTERN Pattern(s) where files MUST match an externally-supplied MD5sum", +" -jigdo-exclude PATTERN Pattern(s) to exclude from the jigdo file", +" -jigdo-map PATTERN1=PATTERN2", +" Pattern(s) to map paths (e.g. Debian=/mirror/debian)", +" -md5-list FILE File containing MD5 sums of the files that should be checked", +" -jigdo-template-compress ALGORITHM", +" Choose to use gzip or bzip2 compression for template data; default is gzip", +" -checksum_algorithm_iso alg1,alg2,...", +" Specify the checksum types desired for the output image (in .jigdo)", +" -checksum_algorithm_template alg1,alg2,...", +" Specify the checksum types desired for the output jigdo template", +" -b FILE, -eltorito-boot FILE", +" Set El Torito boot image name", +" -eltorito-alt-boot Start specifying alternative El Torito boot parameters", +" --efi-boot FILE Set El Torito EFI boot image name and type", +" -e FILE Set EFI boot image name (more rawly)", +" -c FILE, -eltorito-catalog FILE", +" Set El Torito boot catalog name", +" --boot-catalog-hide Hide boot catalog from ISO9660/RR and Joliet", +" -boot-load-size # Set numbers of load sectors", +" -hard-disk-boot Boot image is a hard disk image", +" -no-emul-boot Boot image is 'no emulation' image", +" -boot-info-table Patch boot image with info table", +" -G FILE, -generic-boot FILE Set generic boot image name", +" --embedded-boot FILE Alias of -G", +" --protective-msdos-label Patch System Area by partition table", +" -partition_offset LBA Make image mountable by first partition, too", +" -partition_sec_hd NUMBER Define number of sectors per head", +" -partition_hd_cyl NUMBER Define number of heads per cylinder", +" -partition_cyl_align MODE Control cylinder alignment: off, on, auto", +" -mips-boot FILE Set mips boot image name (relative to image root)", +" -mipsel-boot FILE Set mipsel boot image name (relative to image root)", +" -B FILES, -sparc-boot FILES Set sparc boot image names", +" -sparc-label label text Set sparc boot disk label", +" -append_partition NUMBER TYPE FILE", +" Append FILE after image. TYPE is hex: 0x..", +" --modification-date=YYYYMMDDhhmmsscc", +" Override date of creation and modification", +" -isohybrid-mbr FILE Set SYSLINUX mbr/isohdp[fp]x*.bin for isohybrid", +#ifdef Xorriso_with_isohybriD +" isolinux_mbr=on|auto|off Control eventual isohybrid MBR generation", +#endif +" --sort-weight NUMBER FILE Set LBA weight number to file or file tree", +" --stdio_sync on|off|number Control forced output to disk files", +" --no-emul-toc Save 64 kB size on random access output files", +" --emul-toc Multi-session history on such output files", +" --old-empty Use old style block addresses for empty files", +" -z, -transparent-compression", +" Enable transparent compression of files", +" -root DIR Set root directory for all new files and directories", +" -old-root DIR Set root directory in previous session that is searched for files", +" --old-root-no-md5 Do not record and use MD5 with -old-root", +" --old-root-no-ino Do not use disk inode numbers with -old-root", +" --old-root-devno Use disk device numbers with -old-root", +" --no_rc Do not execute startup files", +" -v, -verbose Verbose", +" -version Print the current version", +"@End_of_helptexT@" +}; + + char ra_text[80]; + int i; + + strcpy(ra_text, xorriso->report_about_text); + + Xorriso_option_report_about(xorriso, "NOTE", 0); + for(i= 0; strcmp(helptext[i], "@End_of_helptexT@")!=0; i++) { + sprintf(xorriso->info_text, "%s\n", helptext[i]); + Xorriso_info(xorriso, 1); + } + Xorriso_option_report_about(xorriso, ra_text, 0); + return(1); +} + + +/* Perform hiding. + Cumbersome: The paths and patterns apply to the disk address and not + to the Rock Ridge address. Actually even the literal form of the + mkisofs pathspec would matter (e.g. "./" versus ""). + But xorriso normalizes disk_paths before further processing. Thus + the literal form does not matter. +*/ +int Xorriso_genisofs_hide(struct XorrisO *xorriso, char *whom, + char *pattern, int hide_attrs, int flag) +{ + int zero= 0, ret; + char *argv[1]; + + if((hide_attrs & 3) == 0) + return(2); + if(strchr(pattern, '/') != NULL) { + argv[0]= pattern; + ret= Xorriso_option_not_paths(xorriso, 1, argv, &zero, + 4 | (hide_attrs & 3)); + } else { + ret= Xorriso_option_not_leaf(xorriso, pattern, hide_attrs & 3); + } + return(ret); +} + + +/* @param flag bit0= quoted list */ +int Xorriso_genisofs_hide_list(struct XorrisO *xorriso, char *whom, + char *adr, int hide_attrs, int flag) +{ + int ret, linecount= 0, argc= 0, was_failure= 0, i, fret; + char **argv= NULL; + FILE *fp= NULL; + + if(adr[0]==0) { + sprintf(xorriso->info_text, + "Empty file name given with -as %s -hide-%slist", + whom, hide_attrs == 1 ? "" : "joliet-"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(0); + } + ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0); + if(ret <= 0) + return(0); + if(ret <= 0) + return(0); + while(1) { + ret= Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, + 4 | (flag & 1) ); + if(ret <= 0) + goto ex; + if(ret == 2) + break; + for(i= 0; i < argc; i++) { + if(argv[i][0] == 0) + continue; + ret= Xorriso_genisofs_hide(xorriso, whom, argv[i], hide_attrs, 0); + if(ret <= 0 || xorriso->request_to_abort) { + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + if(ret > 0) + ret= 0; + goto ex; + } + } + } + ret= 1; +ex:; + if(flag & 1) + Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, 2); + if(fp != NULL && fp != stdin) + fclose(fp); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Strip surplus dash from known single-dash long options */ +int Xorriso_genisofs_strip_dash(struct XorrisO *xorriso, char *arg_in, + char **arg_out, int flag) +{ + int ret, count; + char *argv[1]; + + *arg_out= arg_in; + if(strlen(arg_in) < 4) + return(1); + if(arg_in[0] != '-' || arg_in[1] != '-' || arg_in[2] == '-') + return(1); + + argv[0]= arg_in + 1; + ret= Xorriso_genisofs_count_args(xorriso, 1, argv, &count, 0); + if(ret > 0) + *arg_out= arg_in + 1; + return(1); +} + + +/* micro emulation of mkisofs */ +int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, + int argc, char **argv, int flag) +{ + int ret, i, j, was_path= 0, was_other_option= 0, mem_graft_points, mem; + int do_print_size= 0, fd, idx, iso_level= 1, emul_boot= 2; + int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0; + int dir_mode= -1, file_mode= -1, count, partition_number, allow_dir_id_ext= 1; + int root_seen= 0, do_md5_mem; + mode_t mode_and, mode_or; + int with_boot_image= 0, with_cat_path= 0, with_emul_toc= 0; + int old_root_md5= 1, old_root_dev= 0, old_root_ino= 1; + int *weight_list= NULL, weight_count= 0; + int *delay_opt_list= NULL, delay_opt_count= 0; + char *sfe= NULL, *adr= NULL, ra_text[80], *pathspec= NULL; + char *ept, *add_pt, *eff_path= NULL, *indev= NULL, msc[80], *cpt; + char *old_root= NULL, *argpt, *hargv[1]; + char *boot_path, partno_text[8], *iso_rr_pt, *disk_pt, *rpt, *wpt; + char *rm_merge_args[3]; + + /* >>> This should not be static. Why is it ? */ + static char *sort_weight_args[4]= {"", "-exec", "sort_weight", ""}; + + struct stat stbuf; + + Xorriso_alloc_meM(sfe, char, 5*SfileadrL); + Xorriso_alloc_meM(adr, char, SfileadrL+8); + Xorriso_alloc_meM(pathspec, char, 2*SfileadrL); + Xorriso_alloc_meM(eff_path, char, SfileadrL); + Xorriso_alloc_meM(indev, char, SfileadrL+8); + Xorriso_alloc_meM(old_root, char, SfileadrL); + + strcpy(ra_text, xorriso->report_about_text); + + weight_list= TSOB_FELD(int, (argc / 3) + 1); + if(weight_list == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + {ret= -1; goto ex;} + } + delay_opt_list= TSOB_FELD(int, argc + 1); + if(delay_opt_list == NULL) { + cpt= (char *) weight_list; + Xorriso_no_malloc_memory(xorriso, &cpt, 0); + {ret= -1; goto ex;} + } + + if(xorriso->boot_image_cat_path[0]) + with_cat_path= -1; + adr[0]= indev[0]= msc[0]= old_root[0]= 0; + for(i= 0; iresult_line, +"mkisofs 2.01-Emulation Copyright (C) 2011 see libburnia-project.org xorriso\n" + ); + fd= xorriso->dev_fd_1; + if(fd<0) + fd= 1; + ret= write(fd, xorriso->result_line, strlen(xorriso->result_line)); + /* (result of write intentionally ignored) */ + fsync(fd); + Xorriso_option_version(xorriso, 0); + + } else if(strcmp(argpt, "-o")==0 || strcmp(argpt, "-output")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + adr[0]= 0; + if(strcmp(argv[i],"-")!=0 && strncmp(argv[i], "stdio:", 6)!=0) + strcpy(adr, "stdio:"); + if(Sfile_str(adr+strlen(adr), argv[i], 0)<=0) + {ret= -1; goto ex;} + } else if(strcmp(argpt, "-M")==0 || strcmp(argpt, "-dev")==0 || + strcmp(argpt, "-prev-session")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + if(strncmp(argv[i], "stdio:", 6)!=0) + strcpy(indev, "stdio:"); + if(Sfile_str(indev+strlen(indev), argv[i], 0)<=0) + {ret= -1; goto ex;} + } else if(strcmp(argpt, "-C")==0 || + strcmp(argpt, "-cdrecord-params")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + strncpy(msc, argv[i], sizeof(msc)-1); + msc[sizeof(msc)-1]= 0; + } else if(strcmp(argpt, "-help")==0) { + Xorriso_genisofs_help(xorriso, 0); + } else if(strcmp(argpt, "-v")==0 || strcmp(argpt, "-verbose")==0) { + strcpy(ra_text, "UPDATE"); + } else if(strcmp(argpt, "-quiet")==0) { + strcpy(ra_text, "SORRY"); + } else if(strcmp(argpt, "-f")==0 || strcmp(argpt, "-follow-links")==0) { + ret= Xorriso_option_follow(xorriso, "on", 0); + if(ret<=0) + goto problem_handler_1; + } else if(strcmp(argpt, "-iso-level")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + sscanf(argv[i], "%d", &iso_level); + if(iso_level < 1 || iso_level > 4) { + sprintf(xorriso->info_text, + "-as %s: unsupported -iso-level '%s' (use one of: 1,2,3,4)", + whom, argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto problem_handler_1; + } + if(iso_level == 4) + xorriso->do_iso1999= 1; + else { + sprintf(sfe, "iso_9660_level=%s", argv[i]); + ret= Xorriso_relax_compliance(xorriso, sfe, 0); + if(ret <= 0) + goto problem_handler_1; + } + + } else if(strcmp(argpt, "-input-charset")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* -local_charset */ + if(strcmp(argv[i], "default") == 0) + ret= Xorriso_option_charset(xorriso, "ISO-8859-1", 4); + else + ret= Xorriso_option_charset(xorriso, argv[i], 4); + if(ret <= 0) + goto problem_handler_1; + } else if(strcmp(argpt, "-output-charset")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* -charset */ + if(strcmp(argv[i], "default") == 0) + ret= Xorriso_option_charset(xorriso, "ISO-8859-1", 3); + else + ret= Xorriso_option_charset(xorriso, argv[i], 3); + if(ret <= 0) + goto problem_handler_1; + + } else if(strcmp(argpt, "-hide") == 0 || + strcmp(argpt, "-hide-list") == 0 || + strcmp(argpt, "-hide-joliet") == 0 || + strcmp(argpt, "-hide-joliet-list") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + if(strcmp(argpt, "-hide") == 0) + ret= Xorriso_genisofs_hide(xorriso, whom, argv[i], 1, 0); + else if(strcmp(argpt, "-hide-list") == 0) + ret= Xorriso_genisofs_hide_list(xorriso, whom, argv[i], 1, 0); + else if(strcmp(argpt, "-hide-joliet") == 0) + ret= Xorriso_genisofs_hide(xorriso, whom, argv[i], 2, 0); + else if(strcmp(argpt, "-hide-joliet-list") == 0) + ret= Xorriso_genisofs_hide_list(xorriso, whom, argv[i], 2, 0); + if(ret <= 0) + goto problem_handler_1; + + } else if(strcmp(argpt, "-root") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* Always absolute */ + strcpy(eff_path, "/"); + if(Sfile_str(eff_path, argv[i], argv[i][0] != '/') <= 0) + {ret= -1; goto ex;} + strcpy(xorriso->wdi, eff_path); + root_seen= 1; + + } else if(strcmp(argpt, "-old-root") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* Always absolute */ + strcpy(old_root, "/"); + if(Sfile_str(old_root, argv[i], argv[i][0] != '/') <= 0) + {ret= -1; goto ex;} + + } else if(strcmp(argpt, "--old-root-no-md5")==0) { + old_root_md5= 0; + } else if(strcmp(argpt, "--old-root-devno")==0) { + old_root_dev= 1; + } else if(strcmp(argpt, "--old-root-no-ino")==0) { + old_root_ino= 0; + + } else if(strcmp(argpt, "--hardlinks")==0) { + Xorriso_option_hardlinks(xorriso, "on", 0); + } else if(strcmp(argpt, "--acl")==0) { + Xorriso_option_acl(xorriso, "on", 0); + } else if(strcmp(argpt, "--xattr")==0) { + Xorriso_option_xattr(xorriso, "on", 0); + } else if(strcmp(argpt, "--md5")==0) { + Xorriso_option_md5(xorriso, "on", 0); + } else if(strcmp(argpt, "--scdbackup_tag")==0) { + if(i + 2 >= argc) + goto not_enough_args; + i+= 2; + ret= Xorriso_option_scdbackup_tag(xorriso, argv[i-1], argv[i], 0); + if(ret <= 0) + goto problem_handler_1; + } else if(strcmp(argpt, "--for_backup")==0) { + Xorriso_option_hardlinks(xorriso, "on", 0); + Xorriso_option_acl(xorriso, "on", 0); + Xorriso_option_xattr(xorriso, "on", 0); + Xorriso_option_md5(xorriso, "on", 0); + } else if(strcmp(argpt, "-z")==0 || + strcmp(argpt, "-transparent-compression")==0) { + Xorriso_option_zisofs(xorriso, "by_magic=on", 0); + } else if(strcmp(argpt, "--stdio_sync")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + Xorriso_option_stdio_sync(xorriso, argv[i], 0); + } else if(strcmp(argpt, "-disallow_dir_id_ext")==0) { + allow_dir_id_ext= 0; + } else if(strcmp(argpt, "--emul-toc")==0) { + with_emul_toc= 1; + xorriso->no_emul_toc&= ~1; + } else if(strcmp(argpt, "--no-emul-toc")==0) { + with_emul_toc= 0; + xorriso->no_emul_toc|= 1; + } else { + was_other_option= 1; + hargv[0]= argpt; + ret= Xorriso_genisofs_count_args(xorriso, argc - i, hargv, &count, 0); + if(ret > 0) + i+= count; /* skip eventual arguments of known option */ + } + continue; /* regular bottom of loop */ +problem_handler_1:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + Xorriso_option_report_about(xorriso, ra_text, 0); + if(adr[0]) { + if(strncmp(adr, "stdio:", 6)==0 && strncmp(adr, "stdio:/dev/fd/", 14)!=0) { + ret= Sfile_type(adr+6, 1); + if(ret==-1) { + /* ok */; + } else if(ret==2 || ret==3) { + sprintf(xorriso->info_text, + "-as %s: Cannot accept %s as target: -o %s", + whom, (ret==3 ? "symbolic link" : "directory"), + Text_shellsafe(adr+6, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + /* Regard overwriteable as blank, truncate regular files on write start */ + ret= Xorriso_option_dev(xorriso, adr, 2|8|16); + if(ret<=0) + goto ex; + } + + if(was_other_option && xorriso->out_drive_handle==NULL) { + ret= Xorriso_option_dev(xorriso, "-", 2|4); /* set outdev to stdout */ + if(ret<=0) + goto ex; + } + + if(msc[0]) { + cpt= strchr(msc, ','); + if(cpt==NULL) { +illegal_c:; + sprintf(xorriso->info_text, + "-as %s: unusable parameter with option -C: %s", + whom, Text_shellsafe(msc, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } else if(cpt==msc || msc[1]==0) + goto illegal_c; + strncpy(sfe, msc, cpt-msc); + sfe[cpt-msc]= 0; + if(xorriso->in_drive_handle!=NULL && indev[0]) { + /* give up indev before setting the load address */ + ret= Xorriso_option_dev(xorriso, "", 1); + if(ret<=0) + goto ex; + } + /* growisofs submits msc1+16 to avoid a theoretical bug in mkisofs. + Therefore this bug has to be emulated here. Sigh. + */ + ret= Xorriso_option_load(xorriso, "sbsector", sfe, 1); + if(ret<=0) + goto ex; + ret= Xorriso_option_grow_blindly(xorriso, cpt+1, 0); + if(ret<=0) + goto ex; + } + + if(old_root[0] || root_seen) { + Xorriso_option_md5(xorriso, old_root_md5 ? "on" : "off", 0); + Xorriso_option_disk_dev_ino(xorriso, + old_root_dev && old_root_ino ? "on" : + old_root_ino ? "ino_only" : "off", 0); + if(!old_root_ino) + Xorriso_option_hardlinks(xorriso, "without_update", 0); + } + if(indev[0]) { + do_md5_mem= xorriso->do_md5; + if(xorriso->do_md5 & 1) /* MD5 loading is enabled */ + xorriso->do_md5|= 32; /* Do not check tags of superblock,tree,session + because growisofs preserves the first sb tag.*/ + ret= Xorriso_option_dev(xorriso, indev, 1); + xorriso->do_md5= do_md5_mem; + if(ret<=0) + goto ex; + } + + if(!was_other_option) + {ret= 1; goto ex;} + + if(old_root[0]) { + ret= Xorriso_iso_lstat(xorriso, old_root, &stbuf, 0); + if(ret >= 0) { + if(root_seen) { + ret= Xorriso_mkdir(xorriso, xorriso->wdi, 1 | 2); + if(ret < 0) + {ret= -(ret != -1); goto ex;} + } else { + strcpy(xorriso->wdi, "/"); + } + if(strcmp(old_root, xorriso->wdi) != 0) { + ret= Xorriso_clone_under(xorriso, old_root, xorriso->wdi, 0); + if(ret <= 0) + goto ex; + } + } + } + + xorriso->padding= 300*1024; + + for(i= 0; iinfo_text, "-as %s: %s", + whom, Text_shellsafe(argv[i], sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + ret= Xorriso_genisofs_strip_dash(xorriso, argv[i], &argpt, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_genisofs_ignore(xorriso, whom, argpt, &i, 0); + if(ret == 1) + continue; + if(strcmp(argpt, "-version")==0) { + /* was already handled in first argument scan */; + + } else if(strcmp(argpt, "-R")==0 || strcmp(argpt, "-rock")==0) { + /* ok */; + } else if(strcmp(argpt, "-r")==0 || strcmp(argpt, "-rational-rock")==0){ + lower_r= 1; + } else if(strcmp(argpt, "-J")==0 || strcmp(argpt, "-joliet")==0) { + xorriso->do_joliet= 1; + } else if(strcmp(argpt, "-joliet-long")==0) { + ret= Xorriso_option_compliance(xorriso, + "joliet_long_paths:joliet_long_names", 0); + if(ret<=0) + goto problem_handler_2; + } else if(strcmp(argpt, "-graft-points")==0) { + xorriso->allow_graft_points= 1; + } else if(strcmp(argpt, "-path-list")==0 || + strcmp(argpt, "--quoted_path_list")==0) { + if(i+1>=argc) { +not_enough_args:; + sprintf(xorriso->info_text, "-as %s: Not enough arguments to option %s", + whom, argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + i++; + was_path= 1; + xorriso->pacifier_style= 1; + ret= Xorriso_option_path_list(xorriso, argv[i], + (strcmp(argpt, "--quoted_path_list")==0)); + if(ret<=0) + goto problem_handler_2; + } else if(strcmp(argpt, "-f")==0 || strcmp(argpt, "-follow-links")==0) { + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-pad")==0) { + xorriso->padding= 300*1024; + } else if(strcmp(argpt, "-no-pad")==0) { + xorriso->padding= 0; + } else if(strcmp(argpt, "-print-size")==0) { + do_print_size= 1; + } else if(strcmp(argpt, "-o")==0 || strcmp(argpt, "-output") == 0) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-M")==0 || strcmp(argpt, "-dev")==0 || + strcmp(argpt, "-prev-session")==0) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-C")==0 || + strcmp(argpt, "-cdrecord-params")==0) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-help")==0) { + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-V")==0 || strcmp(argpt, "-volid")==0 || + strcmp(argpt, "-volset")==0 || + strcmp(argpt, "-p")==0 || strcmp(argpt, "-preparer")==0 || + strcmp(argpt, "-P")==0 || strcmp(argpt, "-publisher")==0 || + strcmp(argpt, "-A")==0 || strcmp(argpt, "-appid")==0 || + strcmp(argpt, "-sysid")==0 || + strcmp(argpt, "-biblio")==0 || + strcmp(argpt, "-copyright")==0 || + strcmp(argpt, "-abstract")==0 ) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= 1; + if(strcmp(argpt, "-V")==0 || strcmp(argpt, "-volid")==0) + ret= Xorriso_option_volid(xorriso, argv[i], 0); + else if(strcmp(argpt, "-volset")==0) + ret= Xorriso_option_volset_id(xorriso, argv[i], 0); + else if(strcmp(argpt, "-p")==0 || + strcmp(argpt, "-preparer")==0) + ret= Xorriso_option_preparer_id(xorriso, argv[i], 0); + else if(strcmp(argpt, "-P")==0 || + strcmp(argpt, "-publisher")==0) + ret= Xorriso_option_publisher(xorriso, argv[i], 0); + else if(strcmp(argpt, "-A")==0 || strcmp(argpt, "-appid")==0) + ret= Xorriso_option_application_id(xorriso, argv[i], 0); + else if(strcmp(argpt, "-sysid")==0) + ret= Xorriso_option_system_id(xorriso, argv[i], 0); + else if(strcmp(argpt, "-biblio")==0) + ret= Xorriso_option_biblio_file(xorriso, argv[i], 0); + else if(strcmp(argpt, "-copyright")==0) + ret= Xorriso_option_copyright_file(xorriso, argv[i], 0); + else if(strcmp(argpt, "-abstract")==0) + ret= Xorriso_option_abstract_file(xorriso, argv[i], 0); + if(ret<=0) + goto problem_handler_2; + } else if(strcmp(argpt, "-m")==0 || strcmp(argpt, "-exclude")==0 || + strcmp(argpt, "-x")==0 || strcmp(argpt, "-old-exclude")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + mem= xorriso->do_disk_pattern; + xorriso->do_disk_pattern= 1; + if(strchr(argv[i], '/')!=NULL) { + idx= i; + ret= Xorriso_option_not_paths(xorriso, i+1, argv, &idx, 0); + } else + ret= Xorriso_option_not_leaf(xorriso, argv[i], 0); + xorriso->do_disk_pattern= mem; + if(ret<=0) + goto problem_handler_2; + } else if(strcmp(argpt, "-exclude-list")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + mem= xorriso->do_disk_pattern; + xorriso->do_disk_pattern= 1; + ret= Xorriso_option_not_list(xorriso, argv[i], 0); + xorriso->do_disk_pattern= mem; + if(ret<=0) + goto problem_handler_2; + } else if(strcmp(argpt, "-v")==0 || strcmp(argpt, "-verbose")==0 || + strcmp(argpt, "-quiet")==0) { + /* was already handled in first argument scan */; + + } else if(strcmp(argpt, "-iso-level")==0) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-no-emul-boot")==0 || + strcmp(argpt, "-hard-disk-boot")==0 || + strcmp(argpt, "-boot-info-table")==0 || + strncmp(argpt, "isolinux_mbr=", 13)==0 || + strcmp(argpt, "-eltorito-alt-boot")==0 || + strcmp(argpt, "--protective-msdos-label")==0 || + strcmp(argpt, "--boot-catalog-hide")==0) { + delay_opt_list[delay_opt_count++]= i; + if(argv[i] != argpt) + delay_opt_list[delay_opt_count - 1]|= 1<<31; + } else if(strcmp(argpt, "-b") == 0 || + strcmp(argpt, "-eltorito-boot") == 0 || + strcmp(argpt, "--efi-boot") == 0 || + strcmp(argpt, "-e") == 0 || + strcmp(argpt, "-mips-boot") == 0 || + strcmp(argpt, "-mipsel-boot") == 0 || + strcmp(argpt, "-c") == 0 || + strcmp(argpt, "-eltorito-catalog") == 0 || + strcmp(argpt, "-boot-load-size") == 0 || + strcmp(argpt, "--embedded-boot")==0 || + strcmp(argpt, "-generic-boot")==0 || + strcmp(argpt, "-G") == 0 || + strcmp(argpt, "-partition_offset") == 0 || + strcmp(argpt, "-partition_hd_cyl") == 0 || + strcmp(argpt, "-partition_sec_hd") == 0 || + strcmp(argpt, "-partition_cyl_align") == 0 || + strcmp(argpt, "-isohybrid-mbr")==0) { + if(i+1>=argc) + goto not_enough_args; + delay_opt_list[delay_opt_count++]= i; + if(argv[i] != argpt) + delay_opt_list[delay_opt_count - 1]|= 1<<31; + i++; + } else if(strncmp(argpt, "--modification-date=", 20)==0) { + ret= Xorriso_option_volume_date(xorriso, "uuid", argpt + 20, 0); + if(ret <= 0) + goto problem_handler_2; + + } else if(strcmp(argpt, "-input-charset")==0) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-output-charset")==0) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "--hardlinks")==0 || + strcmp(argpt, "--acl")==0 || + strcmp(argpt, "--xattr")==0 || + strcmp(argpt, "--md5")==0 || + strcmp(argpt, "--for_backup")==0) { + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "--scdbackup_tag")==0) { + /* was already handled in first argument scan */; + i+= 2; + } else if(strcmp(argpt, "--sort-weight")==0) { + if(i + 2 >= argc) + goto not_enough_args; + i+= 2; + /* memorize for find runs after pathspecs have been added */ + weight_list[weight_count++]= i - 2; + } else if(strcmp(argpt, "-z")==0 || + strcmp(argpt, "-transparent-compression")==0) { + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-U") == 0 || + strcmp(argpt, "-untranslated-filenames") == 0) { + Xorriso_relax_compliance(xorriso, + "no_force_dots:long_paths:long_names:omit_version:full_ascii:lowercase", 0); + } else if(strcmp(argpt, "-untranslated_name_len") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + sprintf(sfe, "untranslated_name_len=%s", argv[i]); + ret= Xorriso_relax_compliance(xorriso, sfe, 0); + if(ret <= 0) + goto problem_handler_2; + } else if(strcmp(argpt, "-N") == 0 || + strcmp(argpt, "-omit-version-number") == 0) { + Xorriso_relax_compliance(xorriso, "omit_version", 0); + } else if(strcmp(argpt, "-l") == 0 || + strcmp(argpt, "-full-iso9660-filenames") == 0 || + strcmp(argpt, "-max-iso9660-filenames") == 0) { + Xorriso_relax_compliance(xorriso, "long_names", 0); + } else if(strcmp(argpt, "-d") == 0 || + strcmp(argpt, "-omit-period") == 0) { + Xorriso_relax_compliance(xorriso, "no_force_dots", 0); + } else if(strcmp(argpt, "-allow-lowercase") == 0) { + Xorriso_relax_compliance(xorriso, "lowercase", 0); + + } else if(strcmp(argpt, "-hide") == 0 || + strcmp(argpt, "-hide-list") == 0 || + strcmp(argpt, "-hide-joliet") == 0 || + strcmp(argpt, "-hide-joliet-list") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-root") == 0 || + strcmp(argpt, "-old-root") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "--old-root-no-md5")==0 || + strcmp(argpt, "--old-root-devno")==0 || + strcmp(argpt, "--old-root-no-ino")==0) { + /* was already handled in first argument scan */; + } else if(strcmp(argpt, "-dir-mode") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_convert_modstring(xorriso, "-as mkisofs -dir-mode", + argv[i], &mode_and, &mode_or, 0); + if(ret<=0) + goto problem_handler_2; + dir_mode= mode_or; + } else if(strcmp(argpt, "-file-mode") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_convert_modstring(xorriso, "-as mkisofs -file-mode", + argv[i], &mode_and, &mode_or, 0); + if(ret<=0) + goto problem_handler_2; + file_mode= mode_or; + } else if(strcmp(argpt, "-jigdo-jigdo") == 0 || + strcmp(argpt, "-jigdo-template") == 0 || + strcmp(argpt, "-jigdo-min-file-size") == 0 || + strcmp(argpt, "-jigdo-exclude") == 0 || + strcmp(argpt, "-jigdo-force-md5") == 0 || + strcmp(argpt, "-jigdo-map") == 0 || + strcmp(argpt, "-jigdo-template-compress") == 0 || + strcmp(argpt, "-checksum_algorithm_iso") == 0 || + strcmp(argpt, "-checksum_algorithm_template") == 0 || + strcmp(argpt, "-md5-list") == 0) { + i++; + ret= Xorriso_option_jigdo(xorriso, argpt, argv[i], 0); + if(ret <= 0) + goto problem_handler_2; + } else if(strcmp(argpt, "-append_partition") == 0) { + i+= 3; + ret= Xorriso_option_append_partition(xorriso, argv[i - 2], argv[i - 1], + argv[i], 0); + if(ret <= 0) + goto problem_handler_2; + + } else if(strcmp(argpt, "-B") == 0 || + strcmp(argpt, "-sparc-boot") == 0) { + i++; + if(strlen(argv[i]) >= SfileadrL) + continue; + + /* Switch system area type to: SUN Disk Label */ + strcpy(pathspec, "sparc_label="); + strcat(pathspec, xorriso->ascii_disc_label); + ret= Xorriso_option_boot_image(xorriso, "any", pathspec, 0); + if(ret <= 0) + goto problem_handler_2; + + /* Interpret list of boot partition images or "..." */; + cpt= ept= argv[i]; + partition_number= 2; + while(ept != NULL) { + ept= strchr(cpt, ','); + if(ept != NULL) { + strncpy(pathspec, cpt, ept - cpt); + pathspec[ept - cpt]= 0; + cpt= ept + 1; + } else + strcpy(pathspec, cpt); + if(strcmp(pathspec, "...") == 0) { + for(; partition_number <= 8; partition_number++) { + sprintf(partno_text, "%d", partition_number); + ret= Xorriso_option_append_partition(xorriso, partno_text, "0x0", + ".", 0); + if(ret <= 0) + goto problem_handler_2; + } + } else { + if(partition_number > 8) { + sprintf(xorriso->info_text, + "-as %s -sparc-boot %s : Too many boot images", whom, argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE",0); + goto problem_handler_2; + } + sprintf(partno_text, "%d", partition_number); + ret= Xorriso_option_append_partition(xorriso, partno_text, "0x0", + pathspec, 0); + if(ret <= 0) + goto problem_handler_2; + partition_number++; + } + } + + } else if(strcmp(argpt, "-sparc-label") == 0) { + i++; + strncpy(xorriso->ascii_disc_label, argv[i], Xorriso_disc_label_sizE - 1); + xorriso->ascii_disc_label[Xorriso_disc_label_sizE - 1] = 0; + + } else if(strcmp(argpt, "--stdio_sync")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + /* was already handled in first argument scan */; + + } else if(strcmp(argpt, "--emul-toc")==0 || + strcmp(argpt, "--no-emul-toc")==0) { + /* was already handled in first argument scan */; + + } else if(strcmp(argpt, "--old-empty")==0) { + xorriso->do_old_empty= 1; + + } else if(strcmp(argpt, "-disallow_dir_id_ext")==0) { + /* was already handled in first argument scan */; + + } else if(strcmp(argpt, "--no_rc")==0) { + /* was already handled in Xorriso_prescan_args */; + + } else if(argpt[0]=='-' && argpt[1]!=0) { + hargv[0]= argpt; + ret= Xorriso_genisofs_count_args(xorriso, argc - i, hargv, &count, 1); + if(ret > 0) { + sprintf(xorriso->info_text, "-as %s: Unsupported option %s", + whom, Text_shellsafe(argv[i], sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + i+= count; + goto problem_handler_2; + } else + goto is_pathspec_2; + } else { +is_pathspec_2:; + /* implementing mkisofs tendency to map single-path pathspecs to / */ + if((!xorriso->allow_graft_points) || + Fileliste__target_source_limit(argv[i], '=', &ept, 0)<=0) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, argv[i], + eff_path, 2|4); + if(ret<=0) + goto problem_handler_2; + ret= Sfile_type(eff_path, + 1|((xorriso->do_follow_param||xorriso->do_follow_links)<<2)); + if(ret==2) { + strcpy(pathspec, "/="); + } else { + pathspec[0]= '/'; + pathspec[1]= 0; + ret= Sfile_leafname(eff_path, pathspec+1, 0); + if(ret>0) + strcat(pathspec, "="); + else + pathspec[0]= 0; + } + strcat(pathspec, eff_path); + } else + Sfile_str(pathspec, argv[i], 0); + add_pt= pathspec; + + if(old_root[0]) { + /* Split pathspec */ + ret= Fileliste__target_source_limit(add_pt, '=', &ept, 0); + if(ret > 0) { + *ept= 0; + iso_rr_pt= add_pt; + disk_pt= ept + 1; + } else { + iso_rr_pt= "/"; + disk_pt= add_pt; + } + + /* Unescape iso_rr_pt */ + strcpy(eff_path, iso_rr_pt); + iso_rr_pt= eff_path; + for(wpt= rpt= iso_rr_pt; *rpt != 0; rpt++) { + if(*rpt == '\\') { + if(*(rpt + 1) == '\\') + rpt++; + else if(*(rpt + 1) == '=') + continue; + } + *(wpt++) = *rpt; + } + *wpt= 0; + + if(root_seen) { + ret= Sfile_prepend_path(xorriso->wdi, iso_rr_pt, 0); + if(ret<=0) { + Xorriso_msgs_submit(xorriso, 0, "Effective path gets much too long", + 0, "FAILURE", 0); + goto problem_handler_2; + } + } + /* update_merge */ + ret= Xorriso_option_update(xorriso, disk_pt, iso_rr_pt, 1 | 8 | 32); + } else { + mem_graft_points= xorriso->allow_graft_points; + xorriso->allow_graft_points= 1; + zero= 0; + ret= Xorriso_option_add(xorriso, 1, &add_pt, &zero, + (was_path << 1) | (root_seen << 2) | 8); + xorriso->allow_graft_points= mem_graft_points; + } + if(ret<=0) + goto problem_handler_2; + + was_path= 1; + + /* Enforce odd mkisofs defaults on first pathspec */ + xorriso->pacifier_style= 1; + if(allow_dir_id_ext == 1) { + Xorriso_relax_compliance(xorriso, "allow_dir_id_ext", 0); + allow_dir_id_ext= 2; + } + if(iso_level >= 1 && iso_level <= 3) { + sprintf(sfe, "iso_9660_level=%d", iso_level); + Xorriso_relax_compliance(xorriso, sfe, 0); + iso_level= 0; + } + /* For the sake of compatibility give up emulated multi-session by default + */ + if(with_emul_toc == 0) + xorriso->no_emul_toc|= 1; + } + continue; /* regular bottom of loop */ +problem_handler_2:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + + if(old_root[0]) { + /* Delete all visited nodes which were not found on disk */ + if(root_seen) + rm_merge_args[0]= xorriso->wdi; + else + rm_merge_args[0]= "/"; + rm_merge_args[1]= "-exec"; + rm_merge_args[2]= "rm_merge"; + zero= 0; + ret= Xorriso_option_find(xorriso, 3, rm_merge_args, &zero, 2); + if(ret<=0) + goto ex; + } + + if(lower_r) { + static char *lower_r_args[3]= {"/", "-exec", "mkisofs_r"}; + zero= 0; + ret= Xorriso_option_find(xorriso, 3, lower_r_args, &zero, 2); + if(ret<=0) + goto ex; + } + if(dir_mode >= 0) { + static char *dir_mode_args[6]= {"/", "-type", "d", "-exec", "chmod", ""}; + zero= 0; + sprintf(sfe, "0%o", (unsigned int) dir_mode); + dir_mode_args[5]= sfe; + ret= Xorriso_option_find(xorriso, 6, dir_mode_args, &zero, 2); + if(ret<=0) + goto ex; + } + if(file_mode >= 0) { + static char *file_mode_args[6]= {"/", "-type", "f", "-exec", "chmod", ""}; + zero= 0; + sprintf(sfe, "0%o", (unsigned int) file_mode); + file_mode_args[5]= sfe; + ret= Xorriso_option_find(xorriso, 6, file_mode_args, &zero, 2); + if(ret<=0) + goto ex; + } + + for(j= 0; j < weight_count; j++) { + i= weight_list[j]; + /* find argv[i+2] -exec sort_weight argv[i+1] */ + zero= 0; + sort_weight_args[0]= argv[i + 2]; + sort_weight_args[3]= argv[i + 1]; + ret= Xorriso_option_find(xorriso, 4, sort_weight_args, &zero, 2); + if(ret > 0) + continue; + /* Problem handler */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + + /* After all pathspecs are added: perform boot related options */ + for(j= 0; j < delay_opt_count; j++) { + i= delay_opt_list[j] & ~(1 << 31); + if(delay_opt_list[j] & (1 << 31)) + argpt= argv[i] + 1; + else + argpt= argv[i]; + if(strcmp(argpt, "-no-emul-boot")==0) { + emul_boot= xorriso->boot_image_emul= 0; + } else if(strcmp(argpt, "-hard-disk-boot")==0) { + emul_boot= xorriso->boot_image_emul= 1; + } else if(strcmp(argpt, "-boot-info-table")==0) { + xorriso->patch_isolinux_image= 1; + } else if(strcmp(argpt, "-b") == 0 || + strcmp(argpt, "-eltorito-boot") == 0 || + strcmp(argpt, "--efi-boot") == 0 || + strcmp(argpt, "-e") == 0) { + i++; + if(strcmp(argpt, "--efi-boot") == 0) { + if(xorriso->boot_image_bin_path[0]) { + ret= Xorriso_genisofs_add_boot(xorriso, whom, + &option_b, &emul_boot, 0); + if(ret <= 0) + goto problem_handler_boot; + } + boot_path= xorriso->boot_image_bin_path; + xorriso->boot_efi_default= 1; + emul_boot= xorriso->boot_image_emul= 0; + + } else { + boot_path= xorriso->boot_image_bin_path; + if(strcmp(argpt, "-e") == 0) + xorriso->boot_platform_id= 0xef; + else + xorriso->boot_platform_id= 0x00; + xorriso->boot_efi_default= 0; + option_b= 1; + xorriso->boot_image_emul= emul_boot; + } + boot_path[0]= 0; + if(argv[i][0] != '/') + strcat(boot_path, "/"); + ret= Sfile_str(boot_path + strlen(boot_path), argv[i], 0); + if(ret <= 0) + goto ex; + if(xorriso->boot_efi_default && xorriso->boot_image_bin_path[0]) { + option_b= 0; + emul_boot= 0; + ret= Xorriso_genisofs_add_boot(xorriso, whom, + &option_b, &emul_boot, 0); + if(ret <= 0) + goto problem_handler_boot; + } + xorriso->keep_boot_image= 0; + with_boot_image= 1; + } else if(strcmp(argpt, "-c") == 0 || + strcmp(argpt, "-eltorito-catalog") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + xorriso->boot_image_cat_path[0]= 0; + if(argv[i][0] != '/') + strcat(xorriso->boot_image_cat_path, "/"); + ret= Sfile_str(xorriso->boot_image_cat_path + + strlen(xorriso->boot_image_cat_path), argv[i], 0); + if(ret <= 0) + goto ex; + if(with_cat_path == 0) + with_cat_path= 1; + } else if(strcmp(argpt, "-boot-load-size") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + sscanf(argv[i], "%d", &ret); + xorriso->boot_image_load_size= ret * 512; + } else if(strncmp(argpt, "isolinux_mbr=", 13)==0) { + sprintf(sfe, "isohybrid=%s", argpt + 13); + ret= Xorriso_option_boot_image(xorriso, "isolinux", sfe, 0); + if(ret <= 0) + goto problem_handler_boot; + } else if(strcmp(argpt, "-eltorito-alt-boot")==0) { + ret= Xorriso_genisofs_add_boot(xorriso, whom, + &option_b, &emul_boot, 0); + if(ret <= 0) + goto problem_handler_boot; + } else if(strcmp(argpt, "--embedded-boot")==0 || + strcmp(argpt, "-generic-boot")==0 || + strcmp(argpt, "-G") == 0 || + strcmp(argpt, "-isohybrid-mbr")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_set_system_area_path(xorriso, argv[i], 0); + if(ret <= 0) + goto problem_handler_boot; + if(strcmp(argpt, "-isohybrid-mbr")==0) + xorriso->system_area_options= (xorriso->system_area_options & ~3) | 2; + } else if(strcmp(argpt, "--protective-msdos-label")==0) { + xorriso->system_area_options= (xorriso->system_area_options & ~3) | 1; + } else if(strcmp(argpt, "--boot-catalog-hide")==0) { + xorriso->boot_image_cat_hidden|= 3; + } else if(strcmp(argpt, "-partition_offset") == 0 || + strcmp(argpt, "-partition_sec_hd") == 0 || + strcmp(argpt, "-partition_hd_cyl") == 0 || + strcmp(argpt, "-partition_cyl_align") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + sprintf(sfe, "%s=%.16s", argpt + 1, argv[i]); + ret= Xorriso_option_boot_image(xorriso, "any", sfe, 0); + if(ret <= 0) + goto problem_handler_boot; + + } else if(strcmp(argpt, "-mips-boot") == 0 || + strcmp(argpt, "-mipsel-boot") == 0) { + if(i + 1 >= argc) + goto not_enough_args; + i++; + if(strcmp(argpt, "-mipsel-boot") == 0) + strcpy(sfe, "mipsel_path="); + else + strcpy(sfe, "mips_path="); + ret= Sfile_str(sfe, argv[i], 1); + if(ret <= 0) + goto ex; + + ret = Xorriso_option_boot_image(xorriso, "any", sfe, 0); + if(ret <= 0) + goto problem_handler_boot; + + } + continue; /* regular bottom of loop */ +problem_handler_boot:; + /* Problem handler */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + if(with_boot_image && with_cat_path == 0) + strcpy(xorriso->boot_image_cat_path, "/boot.catalog"); + if(xorriso->boot_image_bin_path[0]) { + ret= Xorriso_genisofs_add_boot(xorriso, whom, &option_b, &emul_boot, 0); + if(ret <= 0) + goto ex; + } + /* The boot catalog has to be hidden separately */ + if(xorriso->boot_image_cat_path[0]) { + ret= Xorriso_path_is_hidden(xorriso, xorriso->boot_image_cat_path, 0); + if(ret > 0) + xorriso->boot_image_cat_hidden|= ret; + else if(ret < 0) + was_failure= 1; + } + + if(xorriso->no_emul_toc & 1) + xorriso->do_padding_by_libisofs= 1; + + if(do_print_size) { + ret= Xorriso_option_print_size(xorriso, 1); + goto ex; + } + + ret= !was_failure; +ex:; + if(was_path && (!do_print_size) && !old_root[0]) + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + if(do_print_size && xorriso->volset_change_pending == 1) + xorriso->volset_change_pending= 2; + if(weight_list != NULL) + free(weight_list); + if(delay_opt_list != NULL) + free(delay_opt_list); + Xorriso_free_meM(sfe); + Xorriso_free_meM(adr); + Xorriso_free_meM(pathspec); + Xorriso_free_meM(eff_path); + Xorriso_free_meM(indev); + Xorriso_free_meM(old_root); + return(ret); +} + + +int Xorriso_as_genisofs(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int end_idx, ret, old_idx; + + old_idx= *idx; + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + (*idx)= end_idx; + if(end_idx<=0 || old_idx>=argc) + return(1); + ret= Xorriso_genisofs(xorriso, "genisofs", end_idx-old_idx, argv+old_idx, 0); + return(ret); +} + + +int Xorriso_as_cdrskin(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int end_idx, ret, old_idx; + + old_idx= *idx; + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + (*idx)= end_idx; + if(end_idx<=0 || old_idx>=argc) + return(1); + ret= Xorriso_cdrskin(xorriso, "cdrskin", end_idx-old_idx, argv+old_idx, 0); + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/emulators.h b/libisoburn/branches/1.1.8/xorriso/emulators.h new file mode 100644 index 00000000..841535ca --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/emulators.h @@ -0,0 +1,37 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of emulators for mkisofs and cdrecord. +*/ + + +#ifndef Xorriso_pvt_emul_includeD +#define Xorriso_pvt_emul_includeD yes + +/* micro version of cdrskin */ +int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, + int flag); + +int Xorriso_cdrskin_help(struct XorrisO *xorriso, int flag); + +int Xorriso_cdrskin_uses_stdout(struct XorrisO *xorriso, int argc, char **argv, + int flag); + +int Xorriso_as_cdrskin(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* micro emulation of mkisofs */ +int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, + int argc, char **argv, int flag); + +int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag); + +int Xorriso_as_genisofs(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +#endif /* ! Xorriso_pvt_emul_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/filters.c b/libisoburn/branches/1.1.8/xorriso/filters.c new file mode 100644 index 00000000..5365b653 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/filters.c @@ -0,0 +1,701 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which operate on data filter objects. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lib_mgt.h" +#include "iso_tree.h" + +/* + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + +#include "iso_img.h" +#include "iso_manip.h" +#include "sort_cmp.h" + +*/ + + +struct Xorriso_extF { + + int flag; /* unused yet */ + + IsoExternalFilterCommand *cmd; + +}; + +int Xorriso_extf_destroy(struct XorrisO *xorriso, struct Xorriso_extF **filter, + int flag); + + +/* @param flag see struct Xorriso_extF.flag */ +int Xorriso_extf_new(struct XorrisO *xorriso, struct Xorriso_extF **filter, + char *path, int argc, char **argv, int behavior, + char *suffix, char *name, int flag) +{ + int i; + struct Xorriso_extF *o= NULL; + IsoExternalFilterCommand *cmd; + + *filter= o= calloc(sizeof(struct Xorriso_extF), 1); + if(o == NULL) + goto failure; + o->flag= flag; + o->cmd= NULL; + o->cmd= cmd= calloc(sizeof(IsoExternalFilterCommand), 1); + if(cmd == NULL) + goto failure; + cmd->version= 0; + cmd->refcount= 0; + cmd->name= NULL; + cmd->path= NULL; + cmd->argv= NULL; + cmd->argc= argc + 1; + cmd->behavior= behavior; + cmd->suffix= NULL; + cmd->suffix= strdup(suffix); + if(cmd->suffix == NULL) + goto failure; + + cmd->path= strdup(path); + if(cmd->path == NULL) + goto failure; + cmd->argv= calloc(sizeof(char *), argc + 2); + if(cmd->argv == NULL) + goto failure; + for(i= 0; i < argc + 2; i++) + cmd->argv[i]= NULL; + cmd->argv[0]= strdup(path); + if(cmd->argv[0] == NULL) + goto failure; + for(i= 0; i < argc; i++) { + cmd->argv[i + 1]= strdup(argv[i]); + if(cmd->argv[i] == NULL) + goto failure; + } + cmd->name= strdup(name); + if(cmd->name == NULL) + goto failure; + return(1); +failure:; + Xorriso_extf_destroy(xorriso, filter, 0); + return(-1); +} + + +int Xorriso_extf_destroy(struct XorrisO *xorriso, struct Xorriso_extF **filter, + int flag) +{ + int i; + IsoExternalFilterCommand *cmd; + + if(*filter == NULL) + return(0); + cmd= (*filter)->cmd; + if(cmd != NULL) { + if(cmd->refcount > 0) + return(0); + if(cmd->path != NULL) + free(cmd->path); + if(cmd->suffix != NULL) + free(cmd->suffix); + if(cmd->argv != NULL) { + for(i= 0; i < cmd->argc; i++) + if(cmd->argv[i] != NULL) + free(cmd->argv[i]); + free((char *) cmd->argv); + } + if(cmd->name != NULL) + free(cmd->name); + free((char *) cmd); + } + free((char *) *filter); + *filter= NULL; + return(1); +} + + +int Xorriso_lookup_extf(struct XorrisO *xorriso, char *name, + struct Xorriso_lsT **found_lst, int flag) +{ + struct Xorriso_extF *filter; + struct Xorriso_lsT *lst; + + for(lst= xorriso->filters; lst != NULL; lst= Xorriso_lst_get_next(lst, 0)) { + filter= (struct Xorriso_extF *) Xorriso_lst_get_text(lst, 0); + if(strcmp(filter->cmd->name, name) == 0) { + *found_lst= lst; + return(1); + } + } + return(0); +} + + +int Xorriso_destroy_all_extf(struct XorrisO *xorriso, int flag) +{ + struct Xorriso_extF *filter; + struct Xorriso_lsT *lst, *next_lst; + + for(lst= xorriso->filters; lst != NULL; lst= next_lst) { + filter= (struct Xorriso_extF *) Xorriso_lst_get_text(lst, 0); + Xorriso_lst_detach_text(lst, 0); + next_lst= Xorriso_lst_get_next(lst, 0); + Xorriso_lst_destroy(&lst, 0); + Xorriso_extf_destroy(xorriso, &filter, 0); + } + xorriso->filters= NULL; + return(1); +} + + +/* + @param flag bit0= return 2 if renaming is not possible by libisofs + (always: if demanded strip suffix is missing + or if suffix makes name length > 255) + bit1= strip suffix rather than appending it +*/ +int Xorriso_rename_suffix(struct XorrisO *xorriso, IsoNode *node, char *suffix, + char *show_path, char new_name[], int flag) +{ + int ret, lo= 0, ls= 0, strip_suffix; + char *old_name= NULL, *show_name; + + strip_suffix= !!(flag & 2); + + old_name= strdup((char *) iso_node_get_name(node)); + show_name= old_name; + if(show_path != NULL) + if(show_path[0] != 0) + show_name= show_path; + lo= strlen(old_name); + ls= strlen(suffix); + if(strip_suffix) { + if(lo <= ls) { + /* refuse gracefully */ + ret= 2; goto ex; + } + if(strcmp(old_name + lo - ls, suffix) != 0) { + ret= 2; goto ex; + } + if(lo >= SfileadrL) + goto cannot_remove_suffix; + strcpy(new_name, old_name); + new_name[lo - ls]= 0; + ret = iso_node_set_name(node, new_name); + if (ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + if (!(flag & 1)) + Xorriso_report_iso_error(xorriso, "", ret, + "Error when renaming ISO node", 0, "FAILURE", 1); +cannot_remove_suffix:; + strcpy(xorriso->info_text, "-set_filter: Cannot remove suffix from "); + Text_shellsafe(show_name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (flag & 1) ? "WARNING" : "FAILURE", 0); + ret= 2 * (flag & 1); goto ex; + } + } else { + /* check whether suffix already present */ + if(lo >= ls) + if(strcmp(old_name + lo - ls, suffix) == 0) { + /* refuse gracefully */ + ret= 2; goto ex; + } + if(lo + ls > 255) { +cannot_append_suffix:; + strcpy(xorriso->info_text, "-set_filter: Cannot append suffix to "); + Text_shellsafe(show_name, xorriso->info_text, 1); + strcat(xorriso->info_text, ". Left unfiltered."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (flag & 1) ? "WARNING" : "FAILURE", 0); + ret= 2 * (flag & 1); goto ex; + } + sprintf(new_name, "%s%s", old_name, suffix); + ret = iso_node_set_name(node, new_name); + if (ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + if (!(flag & 1)) + Xorriso_report_iso_error(xorriso, "", ret, + "Error when renaming ISO node", 0, "FAILURE", 1); + goto cannot_append_suffix; + } + } + + ret= 1; +ex:; + if(old_name != NULL) + free(old_name); + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* + @param flag bit0= return 2 if renaming is not possible + bit1= print pacifier messages + */ +int Xorriso_set_filter(struct XorrisO *xorriso, void *in_node, + char *path, char *filter_name, int flag) +{ + int ret, strip_suffix= 0, strip_filter= 0, filter_ret= 0; + int explicit_suffix= 0, internal_filter= 0; + IsoNode *node; + IsoFile *file; + struct Xorriso_lsT *found_lst; + struct Xorriso_extF *found_filter; + IsoExternalFilterCommand *cmd = NULL; + char *old_name= NULL, *new_name= NULL, *suffix= ""; + IsoStream *stream; + + Xorriso_alloc_meM(new_name, char, SfileadrL); + new_name[0]= 0; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret <= 0) + goto ex; + } + if(!LIBISO_ISREG(node)) { + strcpy(xorriso->info_text, "-set_filter: Not a regular data file node "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + ret= 0; goto ex; + } + file= (IsoFile *) node; + + if(strncmp(filter_name, "--remove-all-filters", 20) == 0) { + strip_filter= 1; + strip_suffix= 1; + if(strlen(filter_name) > 21) { + strip_suffix= (filter_name[20] != '+'); + suffix= filter_name + 21; + explicit_suffix= 1; + } + } else if(strcmp(filter_name, "--zisofs") == 0) { + internal_filter= 1; + } else if(strcmp(filter_name, "--zisofs-decode") == 0) { + internal_filter= 2; + } else if(strcmp(filter_name, "--gzip") == 0) { + internal_filter= 3; + suffix= ".gz"; + strip_suffix= 0; + explicit_suffix= 1; + } else if(strcmp(filter_name, "--gunzip") == 0 || + strcmp(filter_name, "--gzip-decode") == 0) { + internal_filter= 4; + suffix= ".gz"; + strip_suffix= 1; + explicit_suffix= 1; + } else { + ret= Xorriso_lookup_extf(xorriso, filter_name, &found_lst, 0); + if(ret < 0) + goto ex; + if(ret == 0) { + strcpy(xorriso->info_text, "-set_filter: Not a registered filter name "); + Text_shellsafe(filter_name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + found_filter= (struct Xorriso_extF *) Xorriso_lst_get_text(found_lst, 0); + cmd= found_filter->cmd; + suffix= cmd->suffix; + strip_suffix= cmd->behavior & 8; + } + + if(suffix[0]) { + + /* >>> would need full iso_rr_path of node for showing */; + + old_name= strdup((char *) iso_node_get_name(node)); + ret= Xorriso_rename_suffix(xorriso, node, suffix, path, new_name, + (flag & 1) | (strip_suffix ? 2 : 0)); + if(ret <= 0 || ret == 2) + goto ex; + } + + if(strip_filter) { + while(1) { + if(!explicit_suffix) { + stream= iso_file_get_stream(file); + + if(strncmp(stream->class->type, "gzip", 4) == 0) { + suffix= ".gz"; + strip_suffix= 1; + } else if(strncmp(stream->class->type, "pizg", 4) == 0) { + suffix= ".gz"; + strip_suffix= 0; + } else { + ret= iso_stream_get_external_filter(stream, &cmd, 0); + if(ret > 0) { + suffix= cmd->suffix; + strip_suffix= !(cmd->behavior & 8); + } + } + if(suffix[0]) { + + /* >>> would need the current renaming state of path */; + + ret= Xorriso_rename_suffix(xorriso, node, suffix, NULL, new_name, + (flag & 1) | (strip_suffix << 1)); + if(ret <= 0 || ret == 2) + goto ex; + } + } + ret= iso_file_remove_filter(file, 0); + if(ret != 1) + break; + } + filter_ret= 1; + } else if (internal_filter == 1 || internal_filter == 2) { + filter_ret = iso_file_add_zisofs_filter(file, 1 | (internal_filter & 2)); + if(filter_ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + if(!(internal_filter == 2 && filter_ret == (int) ISO_ZISOFS_WRONG_INPUT)) + Xorriso_report_iso_error(xorriso, "", filter_ret, + "Error when setting filter to ISO node", 0, "FAILURE", 1); + } + } else if (internal_filter == 3 || internal_filter == 4) { + filter_ret = iso_file_add_gzip_filter(file, + 1 | ((internal_filter == 4) << 1)); + if(filter_ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", filter_ret, + "Error when setting filter to ISO node", 0, "FAILURE", 1); + } + } else { + +#ifndef Xorriso_allow_extf_suiD + /* This is a final safety precaution before iso_file_add_external_filter() + performs fork() and executes the alleged filter program. + */ + if(getuid() != geteuid()) { + sprintf(xorriso->info_text, + "-set_filter: UID and EUID differ. Will not run external programs."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= 0; goto ex; + } +#endif /* ! Xorriso_allow_extf_suiD */ + + filter_ret = iso_file_add_external_filter(file, cmd, 0); + if(filter_ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", filter_ret, + "Error when setting filter to ISO node", 0, "FAILURE", 1); + } + } + if(filter_ret != 1 && new_name[0] && old_name != NULL) { + ret = iso_node_set_name(node, old_name); + if (ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + if (!(flag & 1)) + Xorriso_report_iso_error(xorriso, "", ret, + "Error when renaming ISO node", 0, "FAILURE", 1); + } + } + if(flag & 2) { + xorriso->pacifier_count++; + Xorriso_pacifier_callback(xorriso, "file filters processed", + xorriso->pacifier_count, xorriso->pacifier_total, "", 0); + } + if(filter_ret < 0) { + ret= 0; goto ex; + } + + ret= filter_ret; +ex:; + if(old_name != NULL) + free(old_name); + Xorriso_free_meM(new_name); + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* @param flag bit0= delete filter with the given name +*/ +int Xorriso_external_filter(struct XorrisO *xorriso, + char *name, char *options, char *path, + int argc, char **argv, int flag) +{ + int ret, delete= 0, behavior= 0, extf_flag= 0, is_banned= 0; + char *what, *what_next, *suffix= ""; + struct Xorriso_lsT *lst; + struct Xorriso_extF *found_filter, *new_filter= NULL; + +#ifndef Xorriso_allow_external_filterS + /* To be controlled by: configure --enable-external-filters */ + + sprintf(xorriso->info_text, "%s : Banned at compile time.", + flag & 1 ? "-unregister_filter" : "-external_filter"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, +"This may be changed at compile time by ./configure option --enable-external-filters"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + is_banned= 1; + +#endif /* ! Xorriso_allow_external_filterS */ + +#ifndef Xorriso_allow_extf_suiD + /* To be controlled by: configure --enable-external-filters-setuid */ + + if(getuid() != geteuid()) { + sprintf(xorriso->info_text, + "-set_filter: UID and EUID differ. Will not run external programs."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + sprintf(xorriso->info_text, +"This may be changed at compile time by ./configure option --enable-external-filters-setuid"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + is_banned= 1; + } +#endif /* ! Xorriso_allow_extf_suiD */ + + if(is_banned) + return(0); + + if(xorriso->filter_list_closed) { + sprintf(xorriso->info_text, + "%s : Banned by previous command -close_filter_list", + flag & 1 ? "-unregister_filter" : "-external_filter"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if((!(flag & 1)) && path[0] != '/') { + sprintf(xorriso->info_text, + "-external_filter : Given command path does not begin by '/' : "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + + + delete= flag & 1; + ret= Xorriso_lookup_extf(xorriso, name, &lst, 0); + if(ret < 0) + return(ret); + if(ret > 0) { + if(delete) { + found_filter= (struct Xorriso_extF *) Xorriso_lst_get_text(lst, 0); + if(found_filter->cmd->refcount > 0) { + sprintf(xorriso->info_text, + "-external_filter: Cannot remove filter because it is in use by %.f nodes : ", + (double) found_filter->cmd->refcount); + Text_shellsafe(name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + Xorriso_lst_detach_text(lst, 0); + if(xorriso->filters == lst) + xorriso->filters= Xorriso_lst_get_next(lst, 0); + Xorriso_lst_destroy(&lst, 0); + Xorriso_extf_destroy(xorriso, &found_filter, 0); + ret= 1; goto ex; + } + strcpy(xorriso->info_text, + "-external_filter: filter with given name already existing: "); + Text_shellsafe(name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(delete) { + strcpy(xorriso->info_text, + "-external_filter: filter with given name does not exist: "); + Text_shellsafe(name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + for(what= options; what!=NULL; what= what_next) { + what_next= strchr(what, ':'); + if(what_next!=NULL) { + *what_next= 0; + what_next++; + } + if(strncmp(what, "default", 7) == 0) { + suffix= ""; + behavior= 0; + } else if(strncmp(what, "suffix=", 7) == 0) { + suffix= what + 7; + } else if(strcmp(what, "remove_suffix") == 0) { + behavior|= 8; + } else if(strcmp(what, "if_nonempty") == 0) { + behavior|= 1; + } else if(strcmp(what, "if_reduction") == 0) { + behavior|= 2; + } else if(strcmp(what, "if_block_reduction") == 0) { + behavior|= 4; + } else if(strncmp(what, "used=", 5) == 0) { + ; /* this is informational output from -status */ + } else if(what[0]) { + strcpy(xorriso->info_text, + "-external_filter: unknown option "); + Text_shellsafe(what, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + + ret= Xorriso_extf_new(xorriso, &new_filter, path, argc, argv, behavior, + suffix, name, extf_flag); + if(ret <= 0) { +could_not_create:; + strcpy(xorriso->info_text, + "-external_filter: Could not create filter object"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + ret= Xorriso_lst_append_binary(&(xorriso->filters), (char *) new_filter,0, 4); + if(ret <= 0) + goto could_not_create; + ret= 1; +ex:; + if(ret <= 0) { + if(new_filter != NULL) + Xorriso_extf_destroy(xorriso, &new_filter, 0); + } + return(ret); +} + + +int Xorriso_status_extf(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag) +/* + bit1= do only report to fp +*/ +{ + int i, maxl= 4 * SfileadrL; + struct Xorriso_extF *extf; + struct Xorriso_lsT *lst; + char *line; + + line= xorriso->result_line; + for(lst= xorriso->filters; lst != NULL; lst= Xorriso_lst_get_next(lst, 0)) { + extf= (struct Xorriso_extF *) Xorriso_lst_get_text(lst, 0); + + strcpy(xorriso->result_line, "-external_filter "); + Text_shellsafe(extf->cmd->name, line, 1); + if((int) strlen(line) > maxl) + continue; + strcat(line, " "); + if(extf->cmd->suffix[0]) { + strcat(line, "suffix="); + Text_shellsafe(extf->cmd->suffix, line, 1); + if((int) strlen(line) > maxl) + continue; + strcat(line, ":"); + } + if(extf->cmd->behavior & 8) + strcat(line, "remove_suffix:"); + if(extf->cmd->behavior & 1) + strcat(line, "if_nonempty:"); + if(extf->cmd->behavior & 2) + strcat(line, "if_reduction:"); + if(extf->cmd->behavior & 4) + strcat(line, "if_block_reduction:"); + sprintf(line + strlen(line), "used=%.f ", (double) extf->cmd->refcount); + if((int) strlen(line) > maxl) + continue; + Text_shellsafe(extf->cmd->path, line, 1); + if((int) strlen(line) > maxl) + continue; + for(i= 1; i < extf->cmd->argc; i++) { + strcat(line, " "); + Text_shellsafe(extf->cmd->argv[i], line, 1); + if((int) strlen(line) > maxl) + break; + } + if(i < extf->cmd->argc) + continue; + strcat(line, " --\n"); + Xorriso_status_result(xorriso, filter, fp, flag&2); + } + if(xorriso->filter_list_closed) { + strcpy(line, "-close_filter_list\n"); + Xorriso_status_result(xorriso, filter, fp, flag&2); + } + return(1); +} + + +int Xorriso_set_zisofs_params(struct XorrisO *xorriso, int flag) +{ + int ret; + struct iso_zisofs_ctrl ctrl; + + ctrl.version= 0; + ctrl.compression_level= xorriso->zlib_level; + if(xorriso->zisofs_block_size == (1 << 16)) + ctrl.block_size_log2= 16; + else if(xorriso->zisofs_block_size == (1 << 17)) + ctrl.block_size_log2= 17; + else + ctrl.block_size_log2= 15; + ret= iso_zisofs_set_params(&ctrl, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when setting zisofs parameters", 0, "FAILURE", 1); + return(0); + } + return(1); +} + + +int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag) +/* + bit0= do only report non-default settings + bit1= do only report to fp +*/ +{ + off_t ziso_count= 0, osiz_count= 0; + off_t gzip_count= 0, gunzip_count= 0; + + iso_zisofs_get_refcounts(&ziso_count, &osiz_count, 0); + iso_gzip_get_refcounts(&gzip_count, &gunzip_count, 0); + if((flag & 1) && xorriso->zlib_level == xorriso->zlib_level_default && + xorriso->zisofs_block_size == xorriso->zisofs_block_size_default && + xorriso->zisofs_by_magic == 0 && + ziso_count == 0 && osiz_count == 0 && + gzip_count == 0 && gunzip_count == 0) { + if(filter == NULL) + return(2); + if(filter[0] == 0) + return 2; + } + sprintf(xorriso->result_line, + "-zisofs level=%d:block_size=%dk:by_magic=%s:ziso_used=%.f:osiz_used=%.f", + xorriso->zlib_level, xorriso->zisofs_block_size / 1024, + xorriso->zisofs_by_magic ? "on" : "off", + (double) ziso_count, (double) osiz_count); + sprintf(xorriso->result_line + strlen(xorriso->result_line), + ":gzip_used=%.f:gunzip_used=%.f\n", + (double) gzip_count, (double) gunzip_count); + Xorriso_status_result(xorriso, filter, fp, flag&2); + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/filters.h b/libisoburn/branches/1.1.8/xorriso/filters.h new file mode 100644 index 00000000..1be6db84 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/filters.h @@ -0,0 +1,31 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which operate on + data filter objects. +*/ + + +#ifndef Xorriso_pvt_filters_includeD +#define Xorriso_pvt_filters_includeD yes + +int Xorriso_extf_new(struct XorrisO *xorriso, struct Xorriso_extF **filter, + char *path, int argc, char **argv, int behavior, + char *suffix, char *name, int flag); + +int Xorriso_extf_destroy(struct XorrisO *xorriso, struct Xorriso_extF **filter, + int flag); + +int Xorriso_lookup_extf(struct XorrisO *xorriso, char *name, + struct Xorriso_lsT **found_lst, int flag); + +int Xorriso_rename_suffix(struct XorrisO *xorriso, IsoNode *node, char *suffix, + char *show_path, char new_name[], int flag); + + +#endif /* ! Xorriso_pvt_filters_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/findjob.c b/libisoburn/branches/1.1.8/xorriso/findjob.c new file mode 100644 index 00000000..68aaf4c7 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/findjob.c @@ -0,0 +1,1219 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the implementation of classes FindjoB, ExprnodE, + ExprtesT which perform tree searches in libisofs or in POSIX filesystem +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* ----------------------- Exprtest ----------------------- */ + + +int Exprtest_new( struct ExprtesT **ftest, struct FindjoB *boss, int flag) +{ + struct ExprtesT *f; + + *ftest= f= TSOB_FELD(struct ExprtesT,1); + if(f==NULL) + return(-1); + f->boss= boss; + f->invert= 0; + f->test_type= -1; + f->arg1= NULL; + f->arg2= NULL; + return(1); +} + + +int Exprtest_destroy(struct ExprtesT **ftest, int flag) +{ + struct ExprtesT *f; + + f= *ftest; + if(f==NULL) + return(0); + + if(f->test_type == 1 || f->test_type == 13 || f->test_type == 16) { + if(f->arg1 != NULL) + free(f->arg1); + if(f->arg2 != NULL) { + regfree(f->arg2); + free(f->arg2); + } + } else if(f->test_type == 9) { + /* arg1 is not an allocated value */; + } else { + if(f->arg1 != NULL) + free(f->arg1); + if(f->arg2 != NULL) + free(f->arg2); + } + free((char *) f); + *ftest= NULL; + return(1); +} + + +/* ----------------------- Nttpfnode ----------------------- */ + + +int Exprnode_new(struct ExprnodE **fnode, struct FindjoB *job, + struct ExprnodE *up, char *origin, int flag) +/* + bit0= set invert-property + bit1= set use_shortcuts +*/ +{ + struct ExprnodE *n; + int ret,i; + + *fnode= n= TSOB_FELD(struct ExprnodE,1); + if(n == NULL) + return(-1); + for(i= 0; i < (int) sizeof(n->origin); i++) + n->origin[i]= 0; + strncpy(n->origin, origin, sizeof(n->origin) - 1); + n->up= up; + n->invert= (flag & 1); + n->assoc= 0; + n->use_shortcuts= !!(flag & 2); + n->left= NULL; + n->left_op= -1; + n->right= NULL; + n->right_op= -1; + n->sub= NULL; + n->is_if_then_else= 0; + n->true_branch= NULL; + n->false_branch= NULL; + n->test= NULL; + n->own_value= -1; + n->composed_value= -1; + + ret= Exprtest_new(&(n->test), job, 0); + if(ret<=0){ + Exprnode_destroy(fnode, 0); + return(-1); + } + return(1); +} + + +int Exprnode_destroy(struct ExprnodE **fnode, int flag) +{ + if(*fnode == NULL) + return(0); + Exprnode_destroy(&((*fnode)->right),0); + Exprnode_destroy(&((*fnode)->sub),0); + Exprnode_destroy(&((*fnode)->true_branch),0); + Exprnode_destroy(&((*fnode)->false_branch),0); + Exprtest_destroy(&((*fnode)->test),0); + free((char *) *fnode); + *fnode= NULL; + return(1); +} + + +int Exprnode_set_is_if(struct ExprnodE *fnode, int value, int flag) +{ + fnode->is_if_then_else= value; + return(1); +} + + +int Exprnode_is_if(struct ExprnodE *fnode, int flag) +{ + return(fnode->is_if_then_else); +} + + +int Exprnode_set_branch(struct ExprnodE *fnode, struct ExprnodE *target, + int flag) +/* + bit0= false_branch (else true_branch) +*/ +{ + struct ExprnodE **branch; + + if(flag&1) + branch= &(fnode->false_branch); + else + branch= &(fnode->true_branch); + Exprnode_destroy(branch,0); + (*branch)= target; + return(1); +} + + +int Exprnode_get_branch(struct ExprnodE *fnode, struct ExprnodE **branch, + int flag) +/* + bit0= false_branch (else true_branch) +*/ +{ + if(flag&1) + (*branch)= fnode->false_branch; + else + (*branch)= fnode->true_branch; + return(1); +} + + +int Exprnode_is_defined(struct ExprnodE *fnode, int flag) +{ + struct ExprtesT *ftest; + + if(fnode==NULL) + return(0); + if(fnode->sub!=NULL) + return(1); + ftest= fnode->test; + if(ftest==NULL) + return(0); + if(ftest->test_type>=0) + return(1); + return(0); +} + + +int Exprnode_own_value(struct XorrisO *xorriso, struct ExprnodE *fnode, + void *node, char *name, char *path, + struct stat *boss_stbuf, struct stat *stbuf, int flag) +/* +flag: +return: (also from Exprtest_match() and Exprnode_tree_value() ) + <0 = error + 0 = does not match + 1 = does match + 2 = immediate decision : does not match + 3 = immediate decision : does match +*/ +{ + int ret; + + if(fnode==NULL) + return(1); + if(fnode->sub!=NULL) { + ret= Exprnode_tree_value(xorriso, fnode->sub, -1, + node, name, path, boss_stbuf, stbuf, 0); + } else { + ret= Exprtest_match(xorriso, fnode->test, node, name, path, + boss_stbuf, stbuf, 0); + } + if(ret<0) + return(ret); + if(ret>1) + return(ret); + if(fnode->invert) + ret= !ret; + return(ret); +} + + +int Exprnode_op(int value1, int value2, int op, int flag) +{ + int ret; + + if(op==0) + ret= value1 || value2 ; + else + ret= value1 && value2 ; + return(ret); +} + + +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) +/* + bit0-7= testmode: 0=head , 1=filename +return: (also from Nntpftest_match() and Nntpfnode_own_value() ) + <0 = error + 0 = does not match + 1 = does match + 2 = immediate decision : does not match + 3 = immediate decision : does match +*/ +{ + int value= 1,ret; + + if(fnode==NULL) + return(1); + if(!Exprnode_is_defined(fnode,0)) + return(1); + + if(fnode->use_shortcuts && fnode->left!=NULL){ + fnode->composed_value= left_value; + if(fnode->left_op==0) {/* OR */ + if(left_value!=0) + goto ex; + } else { /* AND */ + if(left_value==0) + goto ex; + } + } + fnode->composed_value= fnode->own_value= + Exprnode_own_value(xorriso, fnode, node, name, path, boss_stbuf, stbuf, 0); + if(fnode->own_value < 0 || fnode->own_value > 1) + return(fnode->own_value); + + if(fnode->assoc == 0){ /* left associative */ + if(fnode->left != NULL && left_value >= 0) + fnode->composed_value= + Exprnode_op(left_value, fnode->own_value, fnode->left_op, 0); + /* compute right value */ + /* is the right value relevant ? */ + if(fnode->right!=NULL){ + if(fnode->use_shortcuts){ + if(fnode->right_op==0) {/* OR */ + if(fnode->composed_value!=0) + goto ex; + } else { /* AND */ + if(fnode->composed_value==0) + goto ex; + } + } + value= Exprnode_tree_value(xorriso, fnode->right,fnode->composed_value, + node, name, path, boss_stbuf, stbuf, 0); + if(value<0 || value>1) + return(value); + fnode->composed_value= value; + } + }else{ /* right associative */ + if(fnode->right!=NULL){ + /* is the right value relevant ? */ + if(fnode->use_shortcuts){ + if(fnode->right_op==0) {/* OR */ + if(fnode->composed_value!=0) + goto ex; + } else { /* AND */ + if(fnode->composed_value==0) + goto ex; + } + } + value= Exprnode_tree_value(xorriso, fnode->right,fnode->own_value, + node, name, path, boss_stbuf, stbuf, 0); + if(value<0||value>1) + return(value); + } else + value= fnode->own_value; + fnode->composed_value= value; + if(fnode->left!=NULL && left_value>=0) + fnode->composed_value= + Exprnode_op(left_value,fnode->composed_value,fnode->left_op,0); + } +ex: + ret= fnode->composed_value; + if(fnode->is_if_then_else) { + /* The if-condition is evaluated. Now follow the chosen branch */ + struct ExprnodE *branch; + if(ret>0) + branch= fnode->true_branch; + else + branch= fnode->false_branch; + if(branch!=NULL) { + ret= Exprnode_tree_value(xorriso, branch, -1, + node, name, path, boss_stbuf, stbuf, 0); + if(ret<0) + return(ret); + if(ret>1) + return(ret); + } + fnode->composed_value= ret; + } + return(fnode->composed_value); +} + + +/* --------------------- Findjob -------------------- */ + + +int Findjob_new(struct FindjoB **o, char *start_path, int flag) +{ + struct FindjoB *m; + int ret; + + m= *o= TSOB_FELD(struct FindjoB,1); + if(m==NULL) + return(-1); + m->start_path= NULL; + m->test_tree= NULL; + m->cursor= NULL; + m->invert= 0; + m->use_shortcuts= 1; + m->action= 0; /* print */ + m->prune= 0; + m->target= NULL; /* a mere pointer, not managed memory */ + m->text_2= NULL; /* a mere pointer, not managed memory */ + m->user= 0; + m->group= 0; + m->type= 0; + m->date= 0; + m->start_path= strdup(start_path); + if(m->start_path==NULL) + goto failed; + m->found_path= NULL; + m->estim_upper_size= 0; + m->estim_lower_size= 0; + m->subjob= NULL; + m->errmsg[0]= 0; + m->errn= 0; + + ret= Exprnode_new(&(m->test_tree), m, NULL, "-find", (m->use_shortcuts)<<1); + if(ret<=0) + goto failed; + m->cursor= m->test_tree; + return(1); + +failed:; + Findjob_destroy(o, 0); + return(-1); +} + + +int Findjob_destroy(struct FindjoB **o, int flag) +{ + struct FindjoB *m; + + m= *o; + if(m==NULL) + return(0); + if(m->test_tree != NULL) + Exprnode_destroy(&(m->test_tree), 0); + if(m->start_path != NULL) + free(m->start_path); + if(m->found_path != NULL) + free(m->found_path); + free((char *) *o); + *o= NULL; + return(1); +} + + +int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag) +{ + if(o->start_path!=NULL) + free(o->start_path); + if(start_path!=NULL) { + o->start_path= strdup(start_path); + if(o->start_path==NULL) + return(-1); + } else + o->start_path= NULL; + return(1); +} + + +int Findjob_get_start_path(struct FindjoB *o, char **start_path, int flag) +{ + *start_path= o->start_path; + return(1); +} + + +int Findjob_cursor_complete( struct FindjoB *job, int flag) +{ + int ret; + + if(job==NULL) + return(0); + ret= Exprnode_is_defined(job->cursor,0); + return(ret); +} + + +int Findjob_is_restrictive(struct FindjoB *job, int flag) +{ + if(job == NULL) + return(0); + if(job->test_tree == NULL) + return(0); + if(!Exprnode_is_defined(job->test_tree, 0)) + return(0); + return(1); +} + + +int Findjob_new_node(struct FindjoB *job, struct ExprnodE **fnode, + char *origin, int flag) +/* + bit0= open new branch + bit1= with bit1 : do not register as sub-node of job->cursor +*/ +{ + int ret; + struct ExprnodE *f; + + ret= Exprnode_new(fnode,job,NULL,origin, + job->invert|((job->use_shortcuts)<<1)); + if(ret<=0) + return(ret); + f= *fnode; + if(flag&1) { + f->up= job->cursor; + if(job->cursor!=NULL && !(flag&2)) { + if(job->cursor->sub!=NULL) { + /* This would become a memory leak */ + job->errn= -2; + sprintf(job->errmsg, + "Program error while parsing -job : sub branch overwrite"); + return(0); + } else + job->cursor->sub= f; + } + } else { + f->up= job->cursor->up; + f->left= job->cursor; + if(job->cursor!=NULL) + job->cursor->right= f; + } + job->invert= 0; + return(1); +} + + +/* If an operator is expected : use -and + @param flag bit0= prepare for a pseudo-test: + if an operator is expected, do nothing and return 2 +*/ +int Findjob_default_and(struct FindjoB *o, int flag) +{ + int ret; + + if(Findjob_cursor_complete(o, 0)) { + if(flag & 1) + return(2); + ret= Findjob_and(o, 0); + if(ret <= 0) + return(ret); + } + return(1); +} + + +int Findjob_open_bracket(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *fnode; + + ret= Findjob_default_and(job, 0); + if(ret <= 0) + return(ret); + ret= Findjob_new_node(job, &fnode, "-sub", 1); + if(ret <= 0) + return(ret); + job->cursor= fnode; + return(1); +} + + +int Findjob_close_bracket(struct FindjoB *job, int flag) +{ + if(!Findjob_cursor_complete(job, 0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, closing-bracket found"); + return(0); + } + + if(job->cursor->up==NULL){ + job->errn= -1; + sprintf(job->errmsg, + "No bracket open when encountering closing bracket."); + return(0); + } + job->cursor= job->cursor->up; + return(1); +} + + +int Findjob_not(struct FindjoB *job, int flag) +{ + int ret; + + ret= Findjob_default_and(job, 0); + if(ret <= 0) + return(ret); + job->cursor->invert= !job->cursor->invert; + return(1); +} + + +int Findjob_and(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *fnode; + + if(!Findjob_cursor_complete(job, 0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, binary operator found"); + return(0); + } + + ret= Findjob_new_node(job, &fnode, "-and", 0); + if(ret<=0) + return(ret); + job->cursor->right_op= 1; + job->cursor->assoc= 1; /* compute right side first */ + fnode->left_op= 1; + fnode->assoc= 0; /* compute left side first */ + job->cursor= fnode; + return(1); +} + + +int Findjob_or(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *fnode; + + if(!Findjob_cursor_complete(job, 0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, binary operator found"); + return(0); + } + + ret= Findjob_new_node(job, &fnode, "-or", 0); + if(ret<=0) + return(ret); + job->cursor->right= fnode; + job->cursor->right_op= 0; + /* if existing : compute left side first */ + job->cursor->assoc= (job->cursor->left == NULL); + fnode->left= job->cursor; + fnode->left_op= 0; + fnode->assoc= 0; /* no right side yet : compute left side first */ + job->cursor= fnode; + return(1); +} + + +int Findjob_if(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *fnode; + + ret= Findjob_default_and(job, 0); + if(ret <= 0) + return(ret); + ret= Findjob_new_node(job, &fnode, "-if", 1); + if(ret<=0) + return(ret); + Exprnode_set_is_if(fnode,1,0); + job->cursor= fnode; + return(1); +} + + +int Findjob_then(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *fnode,*branch= NULL; + + if(! Findjob_cursor_complete(job,0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, -then-operator found"); + return(0); + } + /* Finding the -if that matches this -then + Do not go up one node but look for the leftmost one. + If everything is right we are at level of the -if node */ + while(job->cursor->left!=NULL) + job->cursor= job->cursor->left; + Exprnode_get_branch(job->cursor, &branch, 0); + if(!Exprnode_is_if(job->cursor, 0) || branch != NULL) { + job->errn= -5; + sprintf(job->errmsg, "-then-operator found outside its proper range."); + return(0); + } + ret= Findjob_new_node(job, &fnode, "-then", 1|2); + if(ret <= 0) + return(ret); + Exprnode_set_branch(job->cursor, fnode, 0); + job->cursor= fnode; + return(1); +} + + +int Findjob_else(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *fnode, *true_branch, *false_branch; + + if(! Findjob_cursor_complete(job, 0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, -else-operator found"); + return(0); + } + if(job->cursor->up == NULL) + goto improper_range; + job->cursor= job->cursor->up; + Exprnode_get_branch(job->cursor, &true_branch, 0); + Exprnode_get_branch(job->cursor, &false_branch, 1); + if(!Exprnode_is_if(job->cursor, 0) || + true_branch == NULL || false_branch != NULL) { +improper_range:; + job->errn= -5; + sprintf(job->errmsg, "-else-operator found outside its proper range."); + return(0); + } + ret= Findjob_new_node(job, &fnode, "-else", 1 | 2); + if(ret <= 0) + return(ret); + Exprnode_set_branch(job->cursor, fnode, 1); + job->cursor= fnode; + return(1); +} + + +int Findjob_elseif(struct FindjoB *job, int flag) +{ + int ret; + struct ExprnodE *true_branch, *false_branch; + + if(!Findjob_cursor_complete(job, 0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, -elseif-operator found"); + return(0); + } + if(job->cursor->up == NULL) + goto improper_range; + job->cursor= job->cursor->up; + Exprnode_get_branch(job->cursor, &true_branch, 0); + Exprnode_get_branch(job->cursor, &false_branch, 1); + if(!Exprnode_is_if(job->cursor, 0) || + true_branch==NULL || false_branch!=NULL) { +improper_range:; + job->errn= -5; + sprintf(job->errmsg, + "-elseif-operator found outside its proper range."); + return(0); + } + job->cursor= job->cursor->up; + /* -elseif is equivalent to the three-step sequence : -endif -or -if + ( -endif has already been performed by following job->cursor->up ) */ + ret= Findjob_or(job, 0); + if(ret <= 0) + return(0); + ret= Findjob_if(job, 0); + if(ret <= 0) + return(0); + return(1); +} + + +int Findjob_endif(struct FindjoB *job, int flag) +{ + struct ExprnodE *true_branch; + + if(!Findjob_cursor_complete(job,0)) { + job->errn= -3; + sprintf(job->errmsg, + "Unary operator or expression expected, -endif found"); + return(0); + } + if(job->cursor->up==NULL) + goto improper_range; + /* test wether parent node is -if */ + job->cursor= job->cursor->up; + Exprnode_get_branch(job->cursor, &true_branch, 0); + if(!Exprnode_is_if(job->cursor,0) || true_branch == NULL) { +improper_range:; + job->errn= -5; + sprintf(job->errmsg, "-endif-mark found outside its proper range."); + return(0); + } + /* go to grand parent node */ + job->cursor= job->cursor->up; + return(1); +} + + +/* @param flag bit0-1= 0= -name , 1= -wholename , 2= -disk_name +*/ +int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag) +{ + char *regexpr= NULL; + regex_t *name_re; + struct ExprtesT *t; + int ret; + + regexpr= TSOB_FELD(char, 2*SfileadrL+2); + if(regexpr == NULL) + {ret= -1; goto ex;} + if(strlen(name_expr)>=SfileadrL) + {ret= 0; goto ex;}; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + goto ex; + t= o->cursor->test; + t->test_type= 1; + if ((flag & 3) == 1) + t->test_type= 13; + else if((flag & 3) == 2) + t->test_type= 16; + name_re= (regex_t *) calloc(1, sizeof(regex_t)); + if(name_re == NULL) + {ret= -1; goto ex;}; + t->arg1= strdup(name_expr); + if(t->arg1 == NULL) { + free((char *) name_re); + {ret= -1; goto ex;}; + } + Xorriso__bourne_to_reg(name_expr, regexpr, 0); + if(regcomp(name_re, regexpr, 0) != 0) { + free((char *) name_re); + {ret= 0; goto ex;}; + } + t->arg2= name_re; + ret= 1; +ex:; + Xorriso_free_meM(regexpr); + return(ret); +} + + +int Findjob_set_file_type(struct FindjoB *o, char file_type, int flag) +{ + static char known[]= {"bcdpf-lsmeX"}; + struct ExprtesT *t; + int ret; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + return(ret); + + if(file_type != 0) + if(strchr(known, file_type) == NULL) + return(0); + t= o->cursor->test; + t->test_type= 2; + t->arg1= calloc(1, 1); + if(t->arg1 == NULL) + return(-1); + *((char *) t->arg1)= file_type; + return(1); +} + + +/* @param value -1= only without property, 1= only with property + @param flag bit0= pseudo-test: + if no operator is open, do nothing and return 2 +*/ +int Findjob_set_prop_filter(struct FindjoB *o, int test_type, int value, + int flag) +{ + struct ExprtesT *t; + int ret; + + ret= Findjob_default_and(o, flag & 1); + if(ret <= 0 || ret == 2) + return(ret); + + t= o->cursor->test; + t->test_type= test_type; + if(value < 0) + t->invert= !t->invert; + return(1); +} + + +/* @param value -1= only undamaged files, 1= only damaged files +*/ +int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, 3, value, 0); + return(ret); +} + + +int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count, + int flag) +{ + struct ExprtesT *t; + int ret; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + return(ret); + + t= o->cursor->test; + t->test_type= 4; + t->arg1= calloc(sizeof(int), 1); + t->arg2= calloc(sizeof(int), 1); + if(t->arg1 == NULL || t->arg2 == NULL) + return(-1); + *((int *) t->arg1)= start_lba; + if(start_lba > 0) + *((int *) t->arg2)= start_lba + count - 1; + else + *((int *) t->arg2)= start_lba - count + 1; + return(1); +} + + +int Findjob_set_test_hidden(struct FindjoB *o, int mode, int flag) +{ + struct ExprtesT *t; + int ret; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + return(ret); + + t= o->cursor->test; + t->test_type= 17; + t->arg1= calloc(sizeof(int), 1); + if(t->arg1 == NULL) + return(-1); + *((int *) t->arg1)= mode; + return(1); +} + + +/* @param value -1= files without ACL, 1= only files with ACL +*/ +int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, 5, value, 0); + return(ret); +} + + +/* @param value -1= files without xattr, 1= only files with xattr + @param flag bit0=-has_any_xattr rather than -has_xattr +*/ +int Findjob_set_xattr_filter(struct FindjoB *o, int value, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, (flag & 1 ? 14 : 6), value, 0); + return(ret); +} + + +/* @param value -1= files without aaip, 1= only files with aaip +*/ +int Findjob_set_aaip_filter(struct FindjoB *o, int value, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, 7, value, 0); + return(ret); +} + + +/* @param value -1= files without filter, 1= files with filter +*/ +int Findjob_set_filter_filter(struct FindjoB *o, int value, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, 8, value, 0); + return(ret); +} + + +int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag) +{ + struct ExprtesT *t; + int ret; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + return(ret); + + t= o->cursor->test; + t->test_type= 9; + t->arg1= wanted_node; + return(1); +} + + +int Findjob_set_commit_filter_2(struct FindjoB *o, int flag) +{ + int ret; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + return(ret); + + o->cursor->test->test_type= 10; + return(1); +} + + +int Findjob_set_decision(struct FindjoB *o, char *decision, int flag) +{ + struct ExprtesT *t; + int ret; + + ret= Findjob_default_and(o, 0); + if(ret <= 0) + return(ret); + + t= o->cursor->test; + t->test_type= 11; + t->arg1= strdup(decision); + if(t->arg1 == NULL) + return(-1); + return(1); +} + + +/* @param value -1= true, 1= false + @param flag bit0= pseudo-test: + if no operator is open, do nothing and return 2 +*/ +int Findjob_set_false(struct FindjoB *o, int value, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, 0, value, flag & 1); + return(ret); +} + + +int Findjob_set_prune(struct FindjoB *o, int flag) +{ + int ret; + + ret= Findjob_set_prop_filter(o, 12, 0, 0); + return(ret); +} + + +int Findjob_set_found_path(struct FindjoB *o, char *path, int flag) +{ + if(o->found_path != NULL) + free(o->found_path); + if(path != NULL) { + o->found_path= strdup(path); + if(o->found_path == NULL) + return(-1); + } else + o->found_path= NULL; + return(1); +} + + +int Findjob_get_found_path(struct FindjoB *o, char **path, int flag) +{ + *path= o->found_path; + return(1); +} + + +int Findjob_get_action(struct FindjoB *o, int flag) +{ + return(o->action); +} + + +/* @return <0 error, >=0 see above struct FindjoB.action +*/ +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) +{ + *target= o->target; + *text_2= o->text_2; + *user= o->user; + *group= o->group; + *mode_and= o->mode_and; + *mode_or= o->mode_or; + *type= o->type; + *date= o->date; + *subjob= o->subjob; + return(o->action); +} + + +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) +{ + int ret; + + ret= Exprnode_tree_value(xorriso, o->test_tree, -1, + node, name, path, boss_stbuf, stbuf, 0); + if(ret == 3) + ret= 1; + else if(ret == 2) + ret= 0; + return(ret); +} + + +int Findjob_set_action_target(struct FindjoB *o, int action, char *target, + int flag) +{ + o->action= action; + o->target= target; + return(1); +} + + +int Findjob_set_action_type(struct FindjoB *o, int action, int type, + int flag) +{ + o->action= action; + o->type= type; + return(1); +} + + +int Findjob_set_action_text_2(struct FindjoB *o, int action, char *target, + char* text_2, int flag) +{ + o->action= action; + o->target= target; + o->text_2= text_2; + return(1); +} + + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag) +{ + int ret; + + if(flag&1) { + o->action= 0; + Findjob_destroy(&(o->subjob), 0); + ret= Findjob_new(&(o->subjob), "", 0); + if(ret<=0) + return(-1); + Findjob_set_action_chown(o->subjob, user, 0); + o->action= 9; + } else { + o->action= 4; + o->user= user; + } + return(1); +} + + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag) +{ + int ret; + + if(flag&1) { + o->action= 0; + Findjob_destroy(&(o->subjob), 0); + ret= Findjob_new(&(o->subjob), "", 0); + if(ret<=0) + return(-1); + Findjob_set_action_chgrp(o->subjob, group, 0); + o->action= 10; + } else { + o->action= 5; + o->group= group; + } + return(1); +} + + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chmod(struct FindjoB *o, + mode_t mode_and, mode_t mode_or, int flag) +{ + int ret; + + if(flag&1) { + o->action= 0; + Findjob_destroy(&(o->subjob), 0); + ret= Findjob_new(&(o->subjob), "", 0); + if(ret<=0) + return(-1); + Findjob_set_action_chmod(o->subjob, mode_and, mode_or, 0); + o->action= 11; + } else { + o->action= 6; + o->mode_and= mode_and; + o->mode_or= mode_or; + } + return(1); +} + + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag) +{ + int ret; + + if(flag&1) { + o->action= 0; + Findjob_destroy(&(o->subjob), 0); + ret= Findjob_new(&(o->subjob), "", 0); + if(ret<=0) + return(-1); + Findjob_set_action_ad(o->subjob, type, date, 0); + o->action= 12; + } else { + o->action= 7; + o->type= type; + o->date= date; + } + return(1); +} + + +int Findjob_set_action_subjob(struct FindjoB *o, int action, + struct FindjoB *subjob, int flag) +{ + o->action= action; + Findjob_destroy(&(o->subjob), 0); + o->subjob= subjob; + return(1); +} + + +int Findjob_set_action_found_path(struct FindjoB *o, int flag) +{ + o->action= 23; + Findjob_set_found_path(o, NULL, 0); + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/findjob.h b/libisoburn/branches/1.1.8/xorriso/findjob.h new file mode 100644 index 00000000..8c480bd3 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/findjob.h @@ -0,0 +1,412 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of classes FindjoB, ExprnodE, ExprtesT + which perform tree searches in libisofs or in POSIX filesystem. +*/ + + +#ifndef Xorriso_pvt_findjob_includeD +#define Xorriso_pvt_findjob_includeD yes + + +#define Xorriso_findjob_on_expR yes + +#ifdef Xorriso_findjob_on_expR + +/* + A single Testnode. +*/ +struct ExprtesT { + + struct FindjoB *boss; + + int invert; /* 0=normal 1=invert result */ + + /* + 0= -false (with invert : -true) + 1= -name char *arg1 (regex_t in *arg2) + 2= -type char *arg1 + 3= -damaged + 4= -lba_range int *arg1 int *arg2 + 5= -has_acl + 6= -has_xattr + 7= -has_aaip + 8= -has_filter + 9= -wanted_node IsoNode *arg1 (for internal use, arg1 not allocated) + 10= -pending_data + 11= -decision char *arg1 ("yes", "no") + 12= -prune + 13= -wholename char *arg1 (regex_t in *arg2) + 14= -has_any_xattr + 15= -has_md5 + 16= -disk_name char *arg1 (regex_t in *arg2) + 17= -hidden int *arg1 (bit0=iso_rr, bit1=joliet) + */ + int test_type; + + void *arg1; + void *arg2; + +}; + + +/* + A computational node. + A tree of these nodes forms the expression. + Sequences of AND/OR operations form branches, brackets spawn new branches, + NOT inverts node's test resp. subtree result. +*/ +struct ExprnodE { + + struct ExprnodE *up; + + char origin[8]; + + /* Operators */ + int invert; /* 0=normal 1=invert own result (subtree or test, but not op) */ + + int assoc; /* + 0= left : compute own value, combine with left value, + compute right value, combine with current value + 1= right: compute own value, compute right value, + combine own and right, combine with left value + */ + + int use_shortcuts; /* 0= evaluate all tests of -and and -or, + 1= evaluate only until the combined result is known + */ + + struct ExprnodE *left; + int left_op; /* 0=OR , 1=AND */ + + struct ExprnodE *right; + int right_op; /* see left_op */ + + /* Brackets : a pointer to the first node in a subchain */ + struct ExprnodE *sub; + + int is_if_then_else; + struct ExprnodE *true_branch; + struct ExprnodE *false_branch; + + /* elementary test : if sub!=NULL , test is ignored */ + struct ExprtesT *test; + + /* Result */ + int own_value; + int composed_value; + +}; + + +struct FindjoB { + + char *start_path; + + struct ExprnodE *test_tree; + + struct ExprnodE *cursor; + int invert; /* 0=normal 1=set invert-property for next new test node */ + int use_shortcuts; + + /* 0= echo + 1= rm (also rmdir) + 2= rm_r +>>> 3= mv target + 4= chown user + 5= chgrp group + 6= chmod mode_and mode_or + 7= alter_date type date + 8= lsdl + 9= chown_r user + 10= chgrp_r group + 11= chmod_r mode_and mode_or + 12= alter_date_r type date + 13= find + 14= compare disk_equivalent_of_start_path + 15= in_iso iso_rr_equivalent_of_start_path + 16= not_in_iso iso_rr_equiv + 17= update disk_equiv + 18= add_missing iso_rr_equiv + 19= empty_iso_dir iso_rr_equiv + 20= is_full_in_iso iso_rr_equiv + 21= report_damage + 22= report_lba + 23= internal: memorize path of last matching node in found_path + 24= getfacl + 25= setfacl access_acl default_acl + 26= getfattr + 27= setfattr + 28= set_filter name + 29= show_stream + 30= internal: count by xorriso->node_counter + 31= internal: register in xorriso->node_array + 32= internal: widen_hardlinks disk_equiv: update nodes marked in di_do_widen + 33= get_any_xattr + 34= get_md5 + 35= check_md5 + 36= make_md5 + 37= mkisofs_r + 38= sort_weight number + 39= hide on|iso_rr|joliet|off + 40= estimate_size + 41= update_merge disk_equiv + 42= rm_merge + 43= clear_merge + 44= list_extattr + */ + int action; + int prune; + + /* action specific parameters */ + char *target; + char *text_2; + uid_t user; + gid_t group; + mode_t mode_and, mode_or; + int type; /* see Xorriso_set_time flag, also used as weight */ + time_t date; + char *found_path; + off_t estim_upper_size; + off_t estim_lower_size; + struct FindjoB *subjob; + + /* Errors */ + char errmsg[4096]; + int errn; /* + >0 = UNIX errno + -1 = close_bracket: no bracket open + -2 = binary operator or closing bracket expected + -3 = unexpected binary operator or closing bracket + -4 = unsupported command + -5 = -then -elseif -else -endif without -if or at wrong place + */ +}; + + +int Exprnode_destroy(struct ExprnodE **fnode, int flag); + +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); + + +int Findjob_new(struct FindjoB **o, char *start_path, int flag); + +int Findjob_destroy(struct FindjoB **o, int flag); + +int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag); + +int Findjob_get_start_path(struct FindjoB *o, char **start_path, int flag); + +int Findjob_set_commit_filter_2(struct FindjoB *o, int flag); + +int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count, + int flag); + +int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag); + +/* @param value -1= only undamaged files, 1= only damaged files +*/ +int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag); + +int Findjob_set_test_hidden(struct FindjoB *o, int mode, int flag); + + +int Findjob_set_decision(struct FindjoB *o, char *decision, int flag); + +int Findjob_open_bracket(struct FindjoB *job, int flag); + +int Findjob_close_bracket(struct FindjoB *job, int flag); + +int Findjob_not(struct FindjoB *job, int flag); + +int Findjob_and(struct FindjoB *job, int flag); + +int Findjob_or(struct FindjoB *job, int flag); + +int Findjob_if(struct FindjoB *job, int flag); + +int Findjob_then(struct FindjoB *job, int flag); + +int Findjob_else(struct FindjoB *job, int flag); + +int Findjob_elseif(struct FindjoB *job, int flag); + +int Findjob_endif(struct FindjoB *job, int flag); + +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); + +int Findjob_set_action_found_path(struct FindjoB *o, int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_target(struct FindjoB *o, int action, char *target, + int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chmod(struct FindjoB *o, + mode_t mode_and, mode_t mode_or, int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag); + +/* @param flag bit0= -wholename rather than -name +*/ +int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag); + +int Findjob_set_file_type(struct FindjoB *o, char file_type, int flag); + +/* @param value -1= files without ACL, 1= only files with ACL +*/ +int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag); + +/* @param value -1= files without xattr, 1= only files with xattr + @param flag bit0=-has_any_xattr rather than -has_xattr +*/ +int Findjob_set_xattr_filter(struct FindjoB *o, int value, int flag); + +/* @param value -1= files without aaip, 1= only files with aaip +*/ +int Findjob_set_aaip_filter(struct FindjoB *o, int value, int flag); + +/* @param value -1= files without filter, 1= files with filter +*/ +int Findjob_set_filter_filter(struct FindjoB *o, int value, int flag); + +/* @param value -1= only without property, 1= only with property + @param flag bit0= pseudo-test: + if no operator is open, do nothing and return 2 +*/ +int Findjob_set_prop_filter(struct FindjoB *o, int test_type, int value, + int flag); + +/* @param value -1= true, 1= false + @param flag bit0= pseudo-test: + if no operator is open, do nothing and return 2 +*/ +int Findjob_set_false(struct FindjoB *o, int value, int flag); + +int Findjob_set_prune(struct FindjoB *o, int flag); + + +int Findjob_set_action_subjob(struct FindjoB *o, int action, + struct FindjoB *subjob, int flag); + +int Findjob_set_action_text_2(struct FindjoB *o, int action, char *target, + char* text_2, int flag); + +int Findjob_set_action_type(struct FindjoB *o, int action, int type, int flag); + + +int Findjob_get_action(struct FindjoB *o, int flag); + +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); + +int Findjob_set_found_path(struct FindjoB *o, char *path, int flag); + +int Findjob_get_found_path(struct FindjoB *o, char **path, int flag); + +#else /* Xorriso_findjob_on_expR */ + + +struct FindjoB; + + +int Findjob_new(struct FindjoB **o, char *start_path, int flag); + +int Findjob_destroy(struct FindjoB **job, int flag); + + +/* @return 0=no match , 1=match , <0 = error +*/ +int Findjob_test(struct FindjoB *job, char *name, + struct stat *boss_stbuf, struct stat *stbuf, + int depth, int flag); + +/* @return <0 error, >=0 see xorriso.c struct FindjoB.action +*/ +int Findjob_get_action(struct FindjoB *o, int flag); + +/* @return <0 error, >=0 see xorriso.c struct FindjoB.action +*/ +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); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_target(struct FindjoB *o, int action, char *target, + int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_chmod(struct FindjoB *o, + mode_t mode_and, mode_t mode_or, int flag); + +/* @param flag bit0= recursive +*/ +int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag); + +int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag); + +int Findjob_set_action_found_path(struct FindjoB *o, int flag); + +int Findjob_get_start_path(struct FindjoB *o, char **start_path, int flag); + +int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count, + int flag); + +int Findjob_get_lba_damage_filter(struct FindjoB *o, int *start_lba, + int *end_lba, int *damage_filter, int flag); + +int Findjob_get_commit_filter(struct FindjoB *o, int *commit_filter, int flag); + +int Findjob_get_acl_filter(struct FindjoB *o, int *acl_filter, int flag); + +int Findjob_get_xattr_filter(struct FindjoB *o, int *xattr_filter, int flag); + +int Findjob_get_aaip_filter(struct FindjoB *o, int *aaip_filter, int flag); + +int Findjob_get_filter_filter(struct FindjoB *o, int *value, int flag); + +int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag); + +int Findjob_get_wanted_node(struct FindjoB *o, void **wanted_node, int flag); + +int Findjob_set_found_path(struct FindjoB *o, char *path, int flag); + +int Findjob_get_found_path(struct FindjoB *o, char **path, int flag); + +#endif /* ! Xorriso_findjob_on_expR */ + + +#endif /* ! Xorriso_pvt_findjob_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/iso_img.c b/libisoburn/branches/1.1.8/xorriso/iso_img.c new file mode 100644 index 00000000..c99190ec --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/iso_img.c @@ -0,0 +1,1177 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which operate on ISO images and their + global properties. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + +#include "lib_mgt.h" +#include "iso_img.h" +#include "iso_tree.h" +#include "drive_mgt.h" + + +int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag) +{ + int ret, hflag; + IsoImage *volume; + + ret= Xorriso_get_volume(xorriso, &volume, 1); + if(ret<=0) + return(ret); + hflag= (~xorriso->do_aaip) & 1; + if((xorriso->ino_behavior & (1 | 2)) && !(xorriso->do_aaip & (4 | 16))) + hflag|= 2; + iso_image_set_ignore_aclea(volume, hflag); + return(1); +} + + +int Xorriso_update_volid(struct XorrisO *xorriso, int flag) +{ + int gret, sret= 1; + + gret= Xorriso_get_volid(xorriso, xorriso->loaded_volid, 0); + if(gret<=0 || (!xorriso->volid_default) || xorriso->loaded_volid[0]==0) + sret= Xorriso_set_volid(xorriso, xorriso->volid, 1); + return(gret>0 && sret>0); +} + + +int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag) +{ + int ret; + IsoImage *volset; + struct isoburn_read_opts *ropts; + struct burn_drive_info *dinfo= NULL; + struct burn_drive *drive= NULL; + + if(xorriso->out_drive_handle != NULL) { + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to attach volset to drive", 2); + if(ret<=0) + return(ret); + } + if(xorriso->in_volset_handle!=NULL) { + iso_image_unref((IsoImage *) xorriso->in_volset_handle); + xorriso->in_volset_handle= NULL; + Sectorbitmap_destroy(&(xorriso->in_sector_map), 0); + Xorriso_destroy_di_array(xorriso, 0); + Xorriso_destroy_hln_array(xorriso, 0); + xorriso->loaded_volid[0]= 0; + xorriso->volset_change_pending= 0; + xorriso->boot_count= 0; + xorriso->no_volset_present= 0; + } + + ret= isoburn_ropt_new(&ropts, 0); + if(ret<=0) + return(ret); + /* Note: no return before isoburn_ropt_destroy() */ + isoburn_ropt_set_extensions(ropts, isoburn_ropt_pretend_blank); + isoburn_ropt_set_input_charset(ropts, xorriso->in_charset); + isoburn_set_read_pacifier(drive, NULL, NULL); + ret= isoburn_read_image(drive, ropts, &volset); + Xorriso_process_msg_queues(xorriso,0); + isoburn_ropt_destroy(&ropts, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Failed to create new empty ISO image object"); + Xorriso_report_iso_error(xorriso, "", ret, xorriso->info_text, 0, "FATAL", + 0); + return(-1); + } + xorriso->in_volset_handle= (void *) volset; + xorriso->in_sector_map= NULL; + Xorriso_update_volid(xorriso, 0); + xorriso->volset_change_pending= 0; + xorriso->boot_count= 0; + xorriso->no_volset_present= 0; + return(1); +} + + +int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + IsoImage *image; + ElToritoBootImage *bootimg; + IsoFile *bootimg_node; + IsoBoot *bootcat_node; + + xorriso->loaded_boot_bin_lba= -1; + xorriso->loaded_boot_cat_path[0]= 0; + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to record boot LBAs", 0); + if(ret<=0) + return(0); + image= isoburn_get_attached_image(drive); + if(image == NULL) + return(0); + ret= iso_image_get_boot_image(image, &bootimg, + &bootimg_node, &bootcat_node); + iso_image_unref(image); /* release obtained reference */ + if(ret != 1) + return(0); + if(bootimg_node != NULL) + Xorriso__file_start_lba((IsoNode *) bootimg_node, + &(xorriso->loaded_boot_bin_lba), 0); + if(bootcat_node != NULL) + Xorriso_path_from_lba(xorriso, (IsoNode *) bootcat_node, 0, + xorriso->loaded_boot_cat_path, 0); + return(1); +} + + +int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag) +{ + int ret, image_blocks; + char volid[33]; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + if(xorriso->assert_volid[0] == 0) + return(1); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to perform -assert_volid", 0); + if(ret<=0) + return(0); + ret= isoburn_read_iso_head(drive, msc1, &image_blocks, volid, 1); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) { + sprintf(xorriso->info_text, + "-assert_volid: Cannot determine Volume Id at LBA %d.", msc1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + xorriso->assert_volid_sev, 0); + return(0); + } + ret= Sregex_match(xorriso->assert_volid, volid, 0); + if(ret < 0) + return(2); + if(ret == 0) { + strcpy(xorriso->info_text, + "-assert_volid: Volume id does not match pattern: "); + Text_shellsafe(xorriso->assert_volid, xorriso->info_text, 1); + strcat(xorriso->info_text, " <> "); + Text_shellsafe(volid, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + xorriso->assert_volid_sev, 0); + return(0); + } + return(ret); +} + + +/* @return <0 yes , 0 no , <0 error */ +int Xorriso_is_isohybrid(struct XorrisO *xorriso, IsoFile *bootimg_node, + int flag) +{ + int ret; + unsigned char buf[68]; + void *data_stream= NULL; + + ret= Xorriso_iso_file_open(xorriso, "", (void *) bootimg_node, + &data_stream, 1); + if(ret <= 0) + return(-1); + ret= Xorriso_iso_file_read(xorriso, data_stream, (char *) buf, 68, 0); + Xorriso_iso_file_close(xorriso, &data_stream, 0); + if(ret <= 0) + return(0); + if(buf[64] == 0xfb && buf[65] == 0xc0 && buf[66] == 0x78 && buf[67] == 0x70) + return(1); + return(0); +} + + +int Xorriso_image_has_md5(struct XorrisO *xorriso, int flag) +{ + int ret; + IsoImage *image; + uint32_t start_lba, end_lba; + char md5[16]; + + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret<=0) + return(ret); + ret= iso_image_get_session_md5(image, &start_lba, &end_lba, md5, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) + return(0); + return(1); +} + + +static const char *un0(const char *text) +{ + if(text == NULL) + return(""); + return(text); +} + + +int Xorriso_pvd_info(struct XorrisO *xorriso, int flag) +{ + int ret, msc1= -1, msc2, i; + IsoImage *image; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + char *msg, block_head[8]; + off_t head_count; + + msg= xorriso->result_line; + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret<=0) + return(ret); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, "", 16); + if(ret > 0) { + ret= Xorriso_msinfo(xorriso, &msc1, &msc2, 1 | 4); + if(ret<0) + return(ret); + Xorriso_toc(xorriso, 128); + if(msc1 >= 0) { + for(i = msc1 + 16; i < msc1 + 32; i++) { + ret= burn_read_data(drive, (off_t) i * (off_t) 2048, block_head, + (off_t) sizeof(block_head), &head_count, 2); + if(ret <= 0) { + i= msc1 + 32; + break; + } + if(block_head[0] == 1 && strncmp(block_head + 1, "CD001", 5) == 0) + break; + } + if(i < msc1 + 32) { + sprintf(msg, "PVD address : %ds\n", i); + Xorriso_result(xorriso,0); + } + } + } + sprintf(msg, "Volume Id : %s\n", un0(iso_image_get_volume_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "Volume Set Id: %s\n", xorriso->volset_id); + Xorriso_result(xorriso,0); + sprintf(msg, "Publisher Id : %s\n", xorriso->publisher); + Xorriso_result(xorriso,0); + sprintf(msg, "Preparer Id : %s\n", + un0(iso_image_get_data_preparer_id(image))); + Xorriso_result(xorriso,0); + sprintf(msg, "App Id : %s\n", xorriso->application_id); + Xorriso_result(xorriso,0); + sprintf(msg, "System Id : %s\n", xorriso->system_id); + Xorriso_result(xorriso,0); + sprintf(msg, "CopyrightFile: %s\n", xorriso->copyright_file); + Xorriso_result(xorriso,0); + sprintf(msg, "Abstract File: %s\n", xorriso->abstract_file); + Xorriso_result(xorriso,0); + sprintf(msg, "Biblio File : %s\n", xorriso->biblio_file); + Xorriso_result(xorriso,0); + return(1); +} + + +/* @param flag bit0= do not mark image as changed */ +int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag) +{ + int ret; + IsoImage *volume; + + if(xorriso->in_volset_handle == NULL) + return(2); + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(ret); + iso_image_set_volume_id(volume, volid); + if(!(flag&1)) + Xorriso_set_change_pending(xorriso, 1); + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Volume ID: '%s'",iso_image_get_volume_id(volume)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + return(1); +} + + +int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag) +{ + int ret; + IsoImage *volume; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(ret); + strncpy(volid, iso_image_get_volume_id(volume), 32); + volid[32]= 0; + return(1); +} + + +/* + bit0= do only report non-default settings + bit1= do only report to fp + bit2= is_default + bit3= append -boot_image any next + bit4= eventually concentrate boot options +*/ +int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path, + char *bin_path, int platform_id, + int patch_isolinux, int emul, off_t load_size, + unsigned char *id_string, + unsigned char *selection_crit, char *form, + char *filter, FILE *fp, int flag) +{ + int is_default, no_defaults, i, is_default_id= 0, ret; + char *line, *bspec= NULL, zeros[28]; + off_t file_size; + struct stat stbuf; + + Xorriso_alloc_meM(bspec, char, SfileadrL + 80); + + no_defaults= flag & 1; + line= xorriso->result_line; + + if(flag & 16) { + /* Allow to concentrate boot options. */ + memset(zeros, 0, 28); + if(memcmp(id_string, zeros, 28) == 0 && + memcmp(selection_crit, zeros, 20) == 0) + is_default_id= 1; + + /* -boot_image isolinux dir= ... */ + bspec[0]= 0; + if(strcmp(form, "isolinux") != 0 && strcmp(form, "any") != 0) + ; + else if(strcmp(bin_path, "/isolinux.bin") == 0 && + strcmp(cat_path, "/boot.cat") == 0) + strcpy(bspec, "dir=/"); + else if(strcmp(bin_path, "/isolinux/isolinux.bin") == 0 && + strcmp(cat_path, "/isolinux/boot.cat") == 0) + strcpy(bspec, "dir=/isolinux"); + else if(strcmp(xorriso->boot_image_bin_path, + "/boot/isolinux/isolinux.bin") == 0 + && strcmp(xorriso->boot_image_cat_path, + "/boot/isolinux/boot.cat") == 0) + strcpy(bspec, "dir=/boot/isolinux"); + memset(zeros, 0, 28); + if(bspec[0] && platform_id == 0 && patch_isolinux && + load_size == 2048 && is_default_id && emul == 0) { + sprintf(line, "-boot_image isolinux %s\n", bspec); + Xorriso_status_result(xorriso,filter,fp,flag&2); + {ret= 1; goto ex;}; + } + + file_size= 0; + ret= Xorriso_iso_lstat(xorriso, bin_path, &stbuf, 2 | 4); + if(ret == 0) + file_size= ((stbuf.st_size / (off_t) 512) + + !!(stbuf.st_size % (off_t) 512)) * 512; + if(platform_id == 0xef && !patch_isolinux && + load_size == file_size && is_default_id && emul == 0) { + sprintf(line, "-boot_image any efi_path="); + Text_shellsafe(bin_path, line, 1); + strcat(line, "\n"); + Xorriso_status_result(xorriso,filter,fp,flag&2); + {ret= 1; goto ex;}; + } + } + + is_default= (bin_path[0] == 0) || (flag & 4); + sprintf(line, "-boot_image %s bin_path=", form); + Text_shellsafe(bin_path, line, 1); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (emul == 0); + sprintf(line, "-boot_image %s emul_type=%s\n", + form, emul == 2 ? "diskette" : emul == 1 ? "hard_disk" : "no_emulation"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (platform_id == 0 || (flag & 4)); + sprintf(line, "-boot_image %s platform_id=0x%-2.2x\n", form, platform_id); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= ((patch_isolinux & 1) == 0 || bin_path[0] == 0 || (flag & 4)); + sprintf(line, "-boot_image %s boot_info_table=%s\n", + (patch_isolinux & 2) ? "grub" : form, patch_isolinux ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (load_size == 2048 || (flag & 4)); + sprintf(line, "-boot_image %s load_size=%lu\n", + form, (unsigned long) load_size); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= 1; + if(!(flag & 4)) + for(i= 0; i < 20; i++) + if(selection_crit[i]) + is_default= 0; + sprintf(line, "-boot_image %s sel_crit=", form); + for(i= 0; i < 20; i++) + sprintf(line + strlen(line), "%-2.2X", (unsigned int) selection_crit[i]); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= 1; + if(!(flag & 4)) + for(i= 0; i < 28; i++) + if(id_string[i]) + is_default= 0; + sprintf(line, "-boot_image %s id_string=", form); + for(i= 0; i < 28; i++) + sprintf(line + strlen(line), "%-2.2X", (unsigned int) id_string[i]); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + ret= 1; +ex:; + Xorriso_free_meM(bspec); + return(ret); +} + + +/* + bit0= do only report non-default settings + bit1= do only report to fp +*/ +int Xorriso_boot_status_non_mbr(struct XorrisO *xorriso, IsoImage *image, + char *filter, FILE *fp, int flag) +{ + int i, num_boots, sa_type; + char *paths[15], *line; + + line= xorriso->result_line; + + sa_type= (xorriso->system_area_options & 0xfc) >> 2; + if(sa_type == 3) { + sprintf(line, "-boot_image any sparc_label="); + Text_shellsafe(xorriso->ascii_disc_label, line, 1); + strcat(line, "\n"); + Xorriso_status_result(xorriso, filter, fp, flag & 2); + return(0); + } + if(sa_type != 1 && sa_type != 2) + return(0); + num_boots= iso_image_get_mips_boot_files(image, paths, 0); + Xorriso_process_msg_queues(xorriso, 0); + if(num_boots <= 0) + return(num_boots); + if(sa_type == 2) + num_boots= 1; + for(i= 0; i < num_boots; i++) { + sprintf(line, "-boot_image any mips%s_path=", sa_type ==2 ? "el" : ""); + Text_shellsafe(paths[i], line, 1); + strcat(line, "\n"); + Xorriso_status_result(xorriso, filter, fp, flag & 2); + } + return(num_boots); +} + + +/* + bit0= do only report non-default settings + bit1= do only report to fp +*/ +int Xorriso_append_part_status(struct XorrisO *xorriso, IsoImage *image, + char *filter, FILE *fp, int flag) +{ + int i; + + for(i= 0; i < Xorriso_max_appended_partitionS; i++) { + if(xorriso->appended_partitions[i] == NULL) + continue; + sprintf(xorriso->result_line, "-append_partition %d 0x%2.2x ", + i + 1, (unsigned int) xorriso->appended_part_types[i]); + Text_shellsafe(xorriso->appended_partitions[i], xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + Xorriso_status_result(xorriso, filter, fp, flag & 2); + } + return(1); +} + + +/* + bit0= do only report non-default settings + bit1= do only report to fp +*/ +int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag) +{ + int ret, i, num_boots, hflag; + int bin_path_in_use= 0, is_default, no_defaults; + char *path= NULL, *form= "any", *line, *hpt; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + IsoImage *image= NULL; + ElToritoBootImage **boots = NULL; + IsoFile **bootnodes = NULL; + int platform_id, patch, load_size; + enum eltorito_boot_media_type media_type; + unsigned char id_string[29], sel_crit[21]; + + Xorriso_alloc_meM(path, char, SfileadrL); + line= xorriso->result_line; + no_defaults= flag & 1; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print boot info", 2 | 16); + if(ret<=0) + goto no_image; + image= isoburn_get_attached_image(drive); + Xorriso_process_msg_queues(xorriso,0); + if(image == NULL) + goto no_image; + + ret= Xorriso_boot_status_non_mbr(xorriso, image, filter, fp, flag & 3); + if(ret < 0) /* == 0 is normal */ + {ret= 0; goto ex;} + + if(xorriso->boot_count == 0 && xorriso->boot_image_bin_path[0] == 0) { +no_image:; + if(xorriso->patch_isolinux_image & 1) { + sprintf(line, "-boot_image %s patch\n", + xorriso->patch_isolinux_image & 2 ? "grub" : form); + is_default= 0; + } else if(xorriso->keep_boot_image) { + sprintf(line, "-boot_image %s keep\n", form); + is_default= 0; + } else { + sprintf(line, "-boot_image %s discard\n", form); + is_default= 1; + } + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + ret= 1; goto after_el_torito; + } + + + if(xorriso->boot_image_bin_path[0] || xorriso->boot_count > 0) + bin_path_in_use= 1; + if(xorriso->boot_image_cat_path[0] && bin_path_in_use) { + is_default= 0; + sprintf(line,"-boot_image %s cat_path=", form); + Text_shellsafe(xorriso->boot_image_cat_path, line, 1); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + if(bin_path_in_use) { + is_default= !xorriso->boot_image_cat_hidden; + hpt= Xorriso__hide_mode_text(xorriso->boot_image_cat_hidden & 3, 0); + sprintf(line, "-boot_image %s cat_hidden=%s\n", form, hpt); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + if(xorriso->boot_count > 0) { + + /* show attached boot image info */; + + ret= iso_image_get_all_boot_imgs(image, &num_boots, &boots, &bootnodes, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret == 1 && num_boots > 0) { + for(i= 0; i < num_boots; i++) { + ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootnodes[i], path, 0); + if(ret <= 0) + continue; + platform_id= el_torito_get_boot_platform_id(boots[i]); + patch= el_torito_get_isolinux_options(boots[i], 0); + el_torito_get_boot_media_type(boots[i], &media_type); + load_size= el_torito_get_load_size(boots[i]) * 512; + el_torito_get_id_string(boots[i], id_string); + el_torito_get_selection_crit(boots[i], sel_crit); + if(media_type == ELTORITO_FLOPPY_EMUL) + media_type= 2; + else if(media_type == ELTORITO_HARD_DISC_EMUL) + media_type= 1; + else + media_type= 0; + ret= Xorriso_boot_item_status(xorriso, xorriso->boot_image_cat_path, + path, platform_id, patch & 1, media_type, + load_size, id_string, sel_crit, "any", + filter, fp, 16 | (flag & 3)); + if(ret <= 0) + continue; + sprintf(line,"-boot_image %s next\n", form); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + } + } + + /* Show pending boot image info */ + if(strcmp(xorriso->boot_image_bin_form, "isolinux") == 0 || + strcmp(xorriso->boot_image_bin_form, "grub") == 0) + form= xorriso->boot_image_bin_form; + + if(xorriso->boot_count > 0 && + xorriso->boot_platform_id == 0 && + xorriso->patch_isolinux_image == 0 && + xorriso->boot_image_bin_path[0] == 0 && + xorriso->boot_image_emul == 0 && + xorriso->boot_image_load_size == 4 * 512) { + for(i= 0; i < 20; i++) + if(xorriso->boot_selection_crit[i]) + break; + if(i >= 20) + for(i= 0; i < 28; i++) + if(xorriso->boot_id_string[i]) + break; + if(i >= 28) + {ret= 1; goto ex;} /* Images registered, pending is still default */ + } + + hflag= 16; + if(xorriso->boot_platform_id == 0xef && !xorriso->boot_efi_default) + hflag= 0; + ret= Xorriso_boot_item_status(xorriso, xorriso->boot_image_cat_path, + xorriso->boot_image_bin_path, xorriso->boot_platform_id, + xorriso->patch_isolinux_image, xorriso->boot_image_emul, + xorriso->boot_image_load_size, xorriso->boot_id_string, + xorriso->boot_selection_crit, form, + filter, fp, hflag | (flag & 3)); + if(ret <= 0) + goto ex; + +after_el_torito:; + ret = Xorriso_append_part_status(xorriso, image, filter, fp, flag & 3); + if(ret <= 0) + goto ex; + + ret= 1; +ex: + if(boots != NULL) + free(boots); + if(bootnodes != NULL) + free(bootnodes); + if(image != NULL) + iso_image_unref(image); + Xorriso_free_meM(path); + return(ret); +} + + +int Xorriso__append_boot_params(char *line, ElToritoBootImage *bootimg, + int flag) +{ + unsigned int platform_id; + + platform_id= el_torito_get_boot_platform_id(bootimg); + if(platform_id != 0) + sprintf(line + strlen(line), + " , platform_id=0x%-2.2X ", (unsigned int) platform_id); + if(el_torito_seems_boot_info_table(bootimg, 0)) + sprintf(line + strlen(line), " , boot_info_table=on"); + return(1); +} + + +/* @param flag bit0= no output if no boot record was found + bit1= short form + bit3= report to info channel (else to result channel) +*/ +int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag) +{ + int ret, bin_path_valid= 0,has_isolinux_mbr= 0, i, num_boots; + unsigned int mbr_lba= 0; + off_t lb0_count; + char *respt, *path; + unsigned char *lb0= NULL; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + IsoImage *image= NULL; + ElToritoBootImage *bootimg, **boots = NULL; + IsoFile *bootimg_node, **bootnodes = NULL; + IsoBoot *bootcat_node; + + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(lb0, unsigned char, 2048); + + respt= xorriso->result_line; + + if(xorriso->boot_count > 0) { + if(!(flag & 1)) { + sprintf(respt, "Boot record : overridden by -boot_image any next\n"); + Xorriso_toc_line(xorriso, flag & 8); + } + ret= 1; goto ex; + } + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print boot info", 16); + if(ret<=0) + goto no_boot; + image= isoburn_get_attached_image(drive); + if(image == NULL) { + ret= 0; +no_boot:; + if(!(flag & 1)) { + sprintf(respt, "Boot record : none\n"); + Xorriso_toc_line(xorriso, flag & 8); + } + goto ex; + } + + /* Using the nodes with extreme care . They might be deleted meanwhile. */ + ret= iso_image_get_boot_image(image, &bootimg, &bootimg_node, &bootcat_node); + if(ret != 1) + goto no_boot; + + ret= iso_image_get_all_boot_imgs(image, &num_boots, &boots, &bootnodes, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret != 1) { + num_boots= 0; + } else { + ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootnodes[0], path, 0); + if(ret > 0) + bin_path_valid= 1; + } + sprintf(respt, "Boot record : El Torito"); + if(bin_path_valid) + ret= Xorriso_is_isohybrid(xorriso, bootimg_node, 0); + else + ret= 0; + if(ret > 0) { + /* Load and examine potential MBR */ + ret= burn_read_data(drive, (off_t) 0, (char *) lb0, (off_t) 2048, + &lb0_count, 2); + if(ret > 0) { + has_isolinux_mbr= 1; + if(lb0[510] != 0x55 || lb0[511] != 0xaa) + has_isolinux_mbr= 0; + mbr_lba= lb0[432] | (lb0[433] << 8) | (lb0[434] << 16) | (lb0[435] << 24); + mbr_lba/= 4; + if(mbr_lba != (unsigned int) xorriso->loaded_boot_bin_lba) + has_isolinux_mbr= 0; + if(has_isolinux_mbr) { + for(i= 0; i < 426; i++) + if(strncmp((char *) (lb0 + i), "isolinux", 8) == 0) + break; + if(i >= 426) + has_isolinux_mbr= 0; + } + for(i= 462; i < 510; i++) + if(lb0[i]) + break; + if(i < 510) + has_isolinux_mbr= 0; + } + if(has_isolinux_mbr) + strcat(respt, " , ISOLINUX isohybrid MBR pointing to boot image"); + else + strcat(respt, " , ISOLINUX boot image capable of isohybrid"); + } + strcat(respt, "\n"); + Xorriso_toc_line(xorriso, flag & 8); + if(flag & 2) + {ret= 1; goto ex;} + + if(xorriso->loaded_boot_cat_path[0]) { + sprintf(respt, "Boot catalog : "); + Text_shellsafe(xorriso->loaded_boot_cat_path, respt, 1); + strcat(respt, "\n"); + } else { + sprintf(respt, "Boot catalog : -not-found-at-load-time-\n"); + } + Xorriso_toc_line(xorriso, flag & 8); + + if(bin_path_valid) { + sprintf(respt, "Boot image : "); + Text_shellsafe(path, respt, 1); + } else if(xorriso->loaded_boot_bin_lba <= 0) { + sprintf(respt, "Boot image : -not-found-at-load-time-"); + } else { + sprintf(respt, "Boot image : -not-found-any-more-by-lba=%d", + xorriso->loaded_boot_bin_lba); + } + Xorriso__append_boot_params(respt, bootimg, 0); + strcat(respt, "\n"); + Xorriso_toc_line(xorriso, flag & 8); + + if(num_boots > 1) { + for(i= 1; i < num_boots; i++) { + ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootnodes[i], path, 0); + if(ret > 0) { + sprintf(respt, "Boot image : "); + Text_shellsafe(path, respt, 1); + } else + sprintf(respt, "Boot image : -not-found-any-more-"); + Xorriso__append_boot_params(respt, boots[i], 0); + strcat(respt, "\n"); + Xorriso_toc_line(xorriso, flag & 8); + } + } + ret= 1; +ex:; + if(boots != NULL) + free(boots); + if(bootnodes != NULL) + free(bootnodes); + if(image != NULL) + iso_image_unref(image); /* release obtained reference */ + Xorriso_free_meM(path); + Xorriso_free_meM(lb0); + return(ret); +} + + +/* @param flag bit0=silently return 0 if no volume/image is present +*/ +int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume, + int flag) +{ + if(xorriso->in_volset_handle==NULL) { + if(flag & 1) + return(0); + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"No ISO image present."); + if(xorriso->indev[0]==0 && xorriso->outdev[0]==0) + sprintf(xorriso->info_text+strlen(xorriso->info_text), + " No -dev, -indev, or -outdev selected."); + else + sprintf(xorriso->info_text+strlen(xorriso->info_text), + " Possible program error with drive '%s'.", xorriso->indev); + + if(!xorriso->no_volset_present) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->no_volset_present= 1; + return(0); + } + *volume= (IsoImage *) xorriso->in_volset_handle; + xorriso->no_volset_present= 0; + return(*volume != NULL); +} + + +int Xorriso_change_is_pending(struct XorrisO *xorriso, int flag) +{ + if(flag & 1) + return(xorriso->volset_change_pending == 1); + return(!!xorriso->volset_change_pending); +} + + +/* @param flag bit0= do not set hln_change_pending */ +int Xorriso_set_change_pending(struct XorrisO *xorriso, int flag) +{ + int ret; + IsoImage *image; + + ret= Xorriso_get_volume(xorriso, &image, 1); + if(ret <= 0) + return ret; + /* Do not override mark of -as mkisofs -print-size */ + if(xorriso->volset_change_pending != 2) + xorriso->volset_change_pending= 1; + if(!(flag & 1)) + xorriso->hln_change_pending= 1; + return(1); +} + + +/** + @param flag bit0= print mount command to result channel rather than + performing it + bit1= do not allow prefixes with cmd + bit2= interpret unprefixed cmd as shell: +*/ +int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode, + char *adr_value, char *cmd, int flag) +{ + int ret, lba, track, session, params_flag= 0, is_safe= 0, is_extra_drive= 0; + int give_up= 0, mount_chardev= 0, status, aquire_flag= 0; + char volid[33], *devadr, *mount_command= NULL, *adr_data= NULL, *adr_pt; + char *dev_path, *libburn_adr= NULL; + char *dpt, *sysname= ""; + struct stat stbuf; + struct burn_drive_info *dinfo= NULL; + struct burn_drive *drive= NULL; + + Xorriso_alloc_meM(mount_command, char, SfileadrL); + Xorriso_alloc_meM(adr_data, char, 163); + Xorriso_alloc_meM(libburn_adr, char, BURN_DRIVE_ADR_LEN + SfileadrL); + + devadr= dev; + adr_pt= adr_value; + if(strcmp(dev, "indev") == 0) { + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to perform -mount \"indev\"", 0); + if(ret<=0) + goto ex; + dev_path= devadr= xorriso->indev; + if(strncmp(dev_path, "stdio:", 6) == 0) + dev_path+= 6; + else if(strncmp(dev_path, "mmc:", 4) == 0) + dev_path+= 4; + if(xorriso->in_drive_handle == xorriso->out_drive_handle) + give_up= 3; + else + give_up= 1; + } else if(strcmp(dev, "outdev") == 0) { + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to perform -mount \"outdev\"", + 2); + if(ret<=0) + goto ex; + dev_path= devadr= xorriso->outdev; + if(strncmp(dev_path, "stdio:", 6) == 0) + dev_path+= 6; + else if(strncmp(dev_path, "mmc:", 4) == 0) + dev_path+= 4; + if(xorriso->in_drive_handle == xorriso->out_drive_handle) + give_up= 3; + else + give_up= 2; + } else { + is_extra_drive= 1; + dev_path= dev; + if(strncmp(dev_path, "stdio:", 6) == 0) + dev_path+= 6; + else if(strncmp(dev_path, "mmc:", 4) == 0) + dev_path+= 4; + + /* do only accept regular files and block devices */ + ret= stat(dev_path, &stbuf); + if(ret == -1) { + sprintf(xorriso->info_text, "Cannot determine properties of file "); + Text_shellsafe(dev_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + ret= System_uname(&sysname, NULL, NULL, NULL, 0); + if(ret > 0 && strcmp(sysname, "FreeBSD") == 0) + mount_chardev= 1; + if(!(S_ISREG(stbuf.st_mode) || (S_ISBLK(stbuf.st_mode) && !mount_chardev) + || (S_ISCHR(stbuf.st_mode) && !mount_chardev))) { + sprintf(xorriso->info_text, + "File object is not suitable as mount device: "); + Text_shellsafe(dev_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + /* Aquire drive as direct libburn address or via stdio: prefix */ + if(strncmp(dev, "mmc:", 4) == 0) + ret= burn_drive_convert_fs_adr(dev + 4, libburn_adr); + else + ret= burn_drive_convert_fs_adr(dev, libburn_adr); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) + {ret= -1; goto ex;} + if(ret == 0 && strncmp(dev, "stdio:", 6) != 0 && + strncmp(dev, "mmc:", 4) != 0) + sprintf(libburn_adr, "stdio:%s", dev); + burn_preset_device_open( + xorriso->drives_exclusive && !(xorriso->mount_opts_flag & 1), 0, 0); + aquire_flag= 1; + if((xorriso->toc_emulation_flag & 2) && adr_mode == 3) + aquire_flag|= 16; + ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag); + burn_preset_device_open(1, 0, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) + {ret= 0; goto ex;} + drive= dinfo[0].drive; + } + + if(adr_mode == 4 && strlen(adr_pt) <= 80) { + ret= Xorriso__bourne_to_reg(adr_pt, adr_data, 0); + if(ret == 1) { + params_flag|= 4; + adr_pt= adr_data; + } + } + ret= isoburn_get_mount_params(drive, adr_mode, adr_pt, &lba, &track, + &session, volid, params_flag); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) + goto ex; + if(((session <= 0 || track <= 0) && !(aquire_flag & 16)) || ret == 2) { + Xorriso_msgs_submit(xorriso, 0, + "-mount : Given address does not point to an ISO 9660 session", + 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(strstr(devadr, "stdio:") == devadr) + devadr+= 6; + if(strstr(devadr, "mmc:") == devadr) + devadr+= 4; + ret= Xorriso_make_mount_cmd(xorriso, cmd, lba, track, session, volid, devadr, + mount_command, flag & (2 | 4)); + if(ret <= 0) + goto ex; + if(ret == 2) + is_safe= 1; + + if(is_extra_drive) { + isoburn_drive_release(drive, 0); + burn_drive_info_free(dinfo); + drive= NULL; + } else if(give_up > 0 && !((flag & 1) || (xorriso->mount_opts_flag & 1))) { + Xorriso_give_up_drive(xorriso, give_up); + if(ret <= 0) + goto ex; + } + Xorriso_process_msg_queues(xorriso,0); + + sprintf(xorriso->info_text, "Volume id : "); + Text_shellsafe(volid, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso, 0); + if(flag & 1) { + sprintf(xorriso->result_line, "%s\n", mount_command); + Xorriso_result(xorriso,0); + } else { + sprintf(xorriso->info_text, "Mount command: %s\n", mount_command); + Xorriso_info(xorriso, 0); + if(!is_safe) { + Xorriso_msgs_submit(xorriso, 0, + "-mount : Will not perform mount command which stems from command template.", + 0, "SORRY", 0); + sprintf(xorriso->result_line, "%s\n", mount_command); + Xorriso_result(xorriso,0); + } else { + ret= Xorriso_execv(xorriso, mount_command, "/bin:/sbin", &status, 1); + if(WIFEXITED(status) && WEXITSTATUS(status) != 0) { + sprintf(xorriso->info_text, + "-mount : mount command failed with exit value %d", + (int) WEXITSTATUS(ret)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + sprintf(xorriso->info_text, "\nMounted session %d of device ", session); + Text_shellsafe(dev_path, xorriso->info_text, 1); + dpt= strchr(cmd, ':'); + if(dpt == NULL) + dpt= cmd ; + else + dpt++; + sprintf(xorriso->info_text + strlen(xorriso->info_text), " as directory "); + Text_shellsafe(dpt, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso, 0); + } + } + ret= 1; +ex:; + if(is_extra_drive && drive != NULL) { + isoburn_drive_release(drive, 0); + burn_drive_info_free(dinfo); + Xorriso_process_msg_queues(xorriso,0); + } + Xorriso_free_meM(mount_command); + Xorriso_free_meM(adr_data); + Xorriso_free_meM(libburn_adr); + return(ret); +} + + +/* @param flag bit0= give up all boot file paths + bit1= refuse if already a path is added +*/ +int Xorriso_add_mips_boot_file(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + IsoImage *image; + char *paths[15]; + + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret <= 0) + return ret; + if(flag & 1) { + iso_image_give_up_mips_boot(image, 0); + Xorriso_process_msg_queues(xorriso,0); + return(1); + } + if(flag & 2) { + ret= iso_image_get_mips_boot_files(image, paths, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) + goto report_error; + if(ret > 0) { + Xorriso_msgs_submit(xorriso, 0, + "There is already a boot image file registered.", + 0, "FAILURE", 0); + return(0); + } + } + ret = iso_image_add_mips_boot_file(image, path, 0); + Xorriso_process_msg_queues(xorriso,0); + if (ret < 0) { +report_error:; + Xorriso_report_iso_error(xorriso, "", ret, + "Error when adding MIPS boot file", + 0, "FAILURE", 1); + return(0); + } + return(1); +} + + +int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type, + int options, char *cmd, int flag) +{ + int old_type, old_options; + static char *type_names[4] = { + "MBR", "MIPS Big Endian Volume Header", "MIPS Little Endian Boot Block", + "SUN Disk Label"}; + + old_type= (xorriso->system_area_options & 0xfc) >> 2; + old_options= xorriso->system_area_options & ~0xfc; + if((old_type != 0 || old_options != 0) && + (old_type != sa_type || (old_options != 0 && old_options != options))) { + sprintf(xorriso->info_text, "%s : First sector already occupied by %s", + cmd, old_type < 4 ? type_names[old_type] : "other boot facility"); + if(old_type == 0 && old_options == 2) + strcat(xorriso->info_text, " for ISOLINUX isohybrid"); + if(old_type == 0 && old_options == 1) + strcat(xorriso->info_text, " for partition table"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto hint_revoke; + } + xorriso->system_area_options= ((sa_type << 2) & 0xfc) | (options & ~0xfc); + if(sa_type == 0) + xorriso->patch_system_area= xorriso->system_area_options; + return(1); + +hint_revoke:; + if(old_type == 0) + sprintf(xorriso->info_text, "Revokable by -boot_image any discard"); + else if(old_type == 1 || old_type == 2) + sprintf(xorriso->info_text, "Revokable by -boot_image any mips_discard"); + else if(old_type == 3) + sprintf(xorriso->info_text, "Revokable by -boot_image any sparc_discard"); + if(old_type < 4) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + return(0); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/iso_img.h b/libisoburn/branches/1.1.8/xorriso/iso_img.h new file mode 100644 index 00000000..33f260ed --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/iso_img.h @@ -0,0 +1,44 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which operate on ISO images + and their global properties. +*/ + + +#ifndef Xorriso_pvt_iso_img_includeD +#define Xorriso_pvt_iso_img_includeD yes + + +int Xorriso_update_volid(struct XorrisO *xorriso, int flag); + +int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag); + +int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag); + +int Xorriso_is_isohybrid(struct XorrisO *xorriso, IsoFile *bootimg_node, + int flag); + +int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path, + char *bin_path, int platform_id, + int patch_isolinux, int emul, off_t load_size, + unsigned char *id_string, + unsigned char *selection_crit, char *form, + char *filter, FILE *fp, int flag); + +int Xorriso__append_boot_params(char *line, ElToritoBootImage *bootimg, + int flag); + +int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume, + int flag); + + + + + +#endif /* ! Xorriso_pvt_iso_img_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/iso_manip.c b/libisoburn/branches/1.1.8/xorriso/iso_manip.c new file mode 100644 index 00000000..9355f3e9 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/iso_manip.c @@ -0,0 +1,3462 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which manipulate the libisofs tree model. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + +#include "lib_mgt.h" +#include "iso_img.h" +#include "iso_tree.h" +#include "iso_manip.h" +#include "sort_cmp.h" +#include "parse_exec.h" + + + +/* @param flag bit0= give directory x-permission where is r-permission + bit1= do not transfer ACL or xattr + bit2= record dev,inode (only if enabled by xorriso) + bit5= transfer ACL or xattr from eventual link target +*/ +int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf, + char *disk_path, IsoNode *node, int flag) +{ + mode_t mode; + int ret= 1; + size_t num_attrs= 0, *value_lengths= NULL; + char **names= NULL, **values= NULL; + + mode= stbuf->st_mode; + + if((!(flag & 2)) && !(xorriso->do_aaip & 1)) + /* Will drop ACL. Update mode S_IRWXG by eventual group:: ACL entry */ + iso_local_get_perms_wo_acl(disk_path, &mode, flag & 32); + + if((flag&1) && S_ISDIR(mode)) { + if(mode&S_IRUSR) + mode|= S_IXUSR; + if(mode&S_IRGRP) + mode|= S_IXGRP; + if(mode&S_IROTH) + mode|= S_IXOTH; + } + iso_node_set_permissions(node, mode & 07777); + iso_node_set_uid(node, stbuf->st_uid); + iso_node_set_gid(node, stbuf->st_gid); + iso_node_set_atime(node, stbuf->st_atime); + iso_node_set_mtime(node, stbuf->st_mtime); + iso_node_set_ctime(node, stbuf->st_ctime); + + if((xorriso->do_aaip & 5) && !(flag & 2)) { + ret= iso_local_get_attrs(disk_path, &num_attrs, &names, &value_lengths, + &values, ((xorriso->do_aaip & 1) && !(flag & 2)) + | ((!(xorriso->do_aaip & 4)) << 2) + | (flag & 32)); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, disk_path, ret, + "Error when obtaining local ACL and xattr", 0, + "FAILURE", 1 | 2); + ret= 0; goto ex; + } + ret= iso_node_set_attrs(node, num_attrs, names, value_lengths, values, + 1 | 8); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when setting ACL and xattr to image node", + 0, "FAILURE", 1); + ret= 0; goto ex; + } + } + + if((flag & 4) && ((xorriso->do_aaip & 16) || !(xorriso->ino_behavior & 2))) { + ret= Xorriso_record_dev_inode(xorriso, disk_path, (dev_t) 0, (ino_t) 0, + (void *) node, "", flag & 32); + if(ret <= 0) + goto ex; + } + + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + iso_local_get_attrs(disk_path, &num_attrs, &names, &value_lengths, + &values, 1 << 15); /* free memory */ + return(ret); +} + + +int Xorriso_graft_split(struct XorrisO *xorriso, IsoImage *volume, + IsoDir *dir, char *disk_path, char *img_name, + char *nominal_source, char *nominal_target, + off_t size, IsoNode **node, int flag) +{ + int ret; + IsoDir *new_dir= NULL; + IsoNode *part_node; + int partno, total_parts; + off_t offset; + char *part_name= NULL; + + Xorriso_alloc_meM(part_name, char, SfileadrL); + + ret= iso_tree_add_new_dir(dir, img_name, &new_dir); + if(ret<0) + goto ex; + *node= (IsoNode *) new_dir; + if(xorriso->update_flags & 1) { + ret= Xorriso_mark_update_merge(xorriso, img_name, node, 1); + if(ret <= 0) + {ret= 0; goto ex;} + } + total_parts= size / xorriso->split_size; + if(size % xorriso->split_size) + total_parts++; + for(partno= 1; partno<=total_parts; partno++) { + offset = xorriso->split_size * (off_t) (partno-1); + Splitpart__compose(part_name, partno, total_parts, offset, + xorriso->split_size, size, 0); + ret= Xorriso_tree_graft_node(xorriso, volume, + new_dir, disk_path, part_name, + nominal_source, nominal_target, + offset, xorriso->split_size, + &part_node, 8); + if(ret<=0) + goto ex; + } + sprintf(xorriso->info_text, "Split into %d parts: ", total_parts); + Text_shellsafe(nominal_target, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 1; +ex:; + Xorriso_free_meM(part_name); + return(ret); +} + + +/* + @param flag bit0= ISO_NODE_NAME_NOT_UNIQUE exception mode: + Do not issue message. Return existing node into *node. + bit3= cut_out_node: offset and size are valid + bit8= hide in iso_rr + bit9= hide in joliet +*/ +int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, + IsoDir *dir, char *disk_path, char *img_name, + char *nominal_source, char *nominal_target, + off_t offset, off_t cut_size, + IsoNode **node, int flag) +{ + int ret, stbuf_valid= 0; + struct stat stbuf; + char *namept; + off_t size= 0; + + if(lstat(disk_path, &stbuf) != -1) { + stbuf_valid= 1; + if(S_ISREG(stbuf.st_mode)) + size= stbuf.st_size; + } + if(flag&8) { + if(cut_size > xorriso->file_size_limit && xorriso->file_size_limit > 0) { + sprintf(xorriso->info_text, + "File piece exceeds size limit of %.f bytes: %.f from ", + (double) xorriso->file_size_limit, (double) cut_size); + Text_shellsafe(disk_path, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= iso_tree_add_new_cut_out_node(volume, dir, img_name, disk_path, + offset, cut_size, node); + if(ret<0) + goto ex; + } else { + if(xorriso->split_size > 0 && size > xorriso->split_size) { + ret= Xorriso_graft_split(xorriso, volume, dir, disk_path, img_name, + nominal_source, nominal_target, size, + node, 0); + if(ret<=0) + goto ex; + } else if(size > xorriso->file_size_limit && xorriso->file_size_limit > 0) { + sprintf(xorriso->info_text, + "File exceeds size limit of %.f bytes: ", + (double) xorriso->file_size_limit); + Text_shellsafe(disk_path, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } else { + ret= iso_tree_add_new_node(volume, dir, img_name, disk_path, node); + if(ret<0) + goto ex; + } + } + if(flag & (256 | 512)) { + ret= Xorriso_set_hidden(xorriso, (void *) *node, "", (flag >> 8) & 3, 0); + if(ret <= 0) + goto ex; + } + if(stbuf_valid && ((xorriso->do_aaip & 16) || !(xorriso->ino_behavior & 2))) { + ret= Xorriso_record_dev_inode(xorriso, disk_path, + stbuf.st_dev, stbuf.st_ino, (void *) *node, "", 1); + if(ret <= 0) + goto ex; + } + if(xorriso->update_flags & 1) { + ret= Xorriso_mark_update_merge(xorriso, img_name, *node, 1); + if(ret <= 0) + goto ex; + } + +ex:; + if(ret<0) { + if(ret == (int) ISO_NODE_NAME_NOT_UNIQUE && (flag & 1)) { + iso_dir_get_node(dir, img_name, node); + } else { + Xorriso_process_msg_queues(xorriso,0); + if(ret == (int) ISO_RR_NAME_TOO_LONG || + ret == (int) ISO_RR_NAME_RESERVED || + ret == (int) ISO_RR_PATH_TOO_LONG) + namept= nominal_target; + else + namept= nominal_source; + Xorriso_report_iso_error(xorriso, namept, ret, + "Cannot add node to tree", 0, "FAILURE", 1|2); + } + return(ret); + } + if(LIBISO_ISREG(*node)) + xorriso->pacifier_byte_count+= iso_file_get_size((IsoFile *) *node); + return(1); +} + + +/* + @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function without having + a boss iterator objetc. + @param node Pointer to pointer to existing node, + *node is set to NULL, if the node gets removed. + @param flag bit0= source is directory + bit4= return 3 on rejection by exclusion or user + bit6= do not delete eventually existing node from di_array + bit7= no special handling of split file directories + @return 1= no action was needed, 2= target removed, + 3= rejected with bit4, <=0 means error +*/ +int Xoriso_handle_collision(struct XorrisO *xorriso, void *boss_iter, + IsoNode **node, char *img_path, + char *full_img_path, char *disk_path, + char *show_path, int flag) +{ + int ret, target_is_dir, target_is_split, source_is_dir; + + source_is_dir= flag & 1; + target_is_dir= LIBISO_ISDIR(*node); + + target_is_split= 0; + if(target_is_dir && !(flag & 128)) + target_is_split= Xorriso_is_split(xorriso, "", (void *) *node, 1 | 2); + + if(!((target_is_dir && !target_is_split) && source_is_dir)) { + Xorriso_process_msg_queues(xorriso, 0); + + /* handle overwrite situation */; + if(xorriso->do_overwrite == 1 || + (xorriso->do_overwrite == 2 && !(target_is_dir && !target_is_split))) { + ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, img_path, + 1 | 8 | (flag & 64)); + if(ret <= 0) + return(ret); + if(ret == 3) { + sprintf(xorriso->info_text, "User revoked adding of: "); + Text_shellsafe(show_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(3 * !!(flag & 16)); + } + *node= NULL; + return(2); + } + + if (disk_path[0]) + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + if(strcmp(full_img_path, img_path) == 0) + sprintf(xorriso->info_text, + "While grafting '%s' : file object exists and may not be overwritten", + img_path); + else + sprintf(xorriso->info_text, + "While grafting '%s' : '%s' exists and may not be overwritten", + full_img_path, img_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* @param flag bit0= recursion is active + bit1= do not report added files + bit6= do not delete eventually existing node from di_array + bit7= no special handling of split file directories + bit8= hide in iso_rr + bit9= hide in joliet +*/ +int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir, + char *img_dir_path, char *disk_dir_path, + struct LinkiteM *link_stack, int flag) +{ + IsoImage *volume; + IsoNode *node; + int ret, source_is_dir, source_is_link, fret, was_failure= 0; + int do_not_dive, hide_attrs; + struct DirseQ *dirseq= NULL; + char *name, *img_name, *srcpt, *stbuf_src= ""; + struct stat stbuf, hstbuf; + dev_t dir_dev; + struct LinkiteM *own_link_stack; + char *sfe= NULL, *sfe2= NULL; + char *disk_path= NULL, *img_path= NULL, *link_target= NULL; + +#define Xorriso_add_handle_collisioN 1 +#define Xorriso_optimistic_add_treE 1 + +#ifndef Xorriso_optimistic_add_treE +#ifndef Xorriso_add_handle_collisioN + int target_is_split= 0, target_is_dir; +#endif +#endif + + /* Avoiding large local memory objects in order to save stack space */ + sfe= malloc(5*SfileadrL); + sfe2= malloc(5*SfileadrL); + disk_path= malloc(2*SfileadrL); + img_path= malloc(2*SfileadrL); + link_target= calloc(SfileadrL, 1); + if(sfe==NULL || sfe2==NULL || disk_path==NULL || img_path==NULL || + link_target==NULL) { + Xorriso_no_malloc_memory(xorriso, &sfe, 0); + {ret= -1; goto ex;} + } + + own_link_stack= link_stack; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + stbuf_src= disk_dir_path; + if(lstat(disk_dir_path, &stbuf)==-1) + goto cannot_open_dir; + dir_dev= stbuf.st_dev; + if(S_ISLNK(stbuf.st_mode)) { + if(!(xorriso->do_follow_links || (xorriso->do_follow_param && !(flag&1)))) + {ret= 2; goto ex;} + stbuf_src= disk_dir_path; + if(stat(disk_dir_path, &stbuf)==-1) + goto cannot_open_dir; + if(dir_dev != stbuf.st_dev && + !(xorriso->do_follow_mount || (xorriso->do_follow_param && !(flag&1)))) + {ret= 2; goto ex;} + } + ret= Dirseq_new(&dirseq, disk_dir_path, 1); + if(ret<0) { + sprintf(xorriso->info_text,"Failed to create source filesystem iterator"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + if(ret==0) { +cannot_open_dir:; + Xorriso_msgs_submit(xorriso, 0, disk_dir_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text,"Cannot open as source directory: %s", + Text_shellsafe(disk_dir_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + if(Sfile_str(disk_path, disk_dir_path,0)<=0) + {ret= -1; goto ex;} + if(disk_path[0]==0 || disk_path[strlen(disk_path)-1]!='/') + strcat(disk_path,"/"); + name= disk_path+strlen(disk_path); + if(Sfile_str(img_path, img_dir_path, 0)<=0) + {ret= -1; goto ex;} + if(img_path[0] == 0) + strcat(img_path, "/"); + else if(img_path[strlen(img_path) - 1] != '/') + strcat(img_path, "/"); + img_name= img_path+strlen(img_path); + + while(1) { /* loop over directory content */ + stbuf_src= ""; + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + srcpt= disk_path; + Xorriso_process_msg_queues(xorriso,0); + ret= Dirseq_next_adr(dirseq,name,0); /* name is a pointer into disk_path */ + if(ret==0) + break; + if(ret<0) { + sprintf(xorriso->info_text,"Failed to obtain next directory entry"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + + /* Compare exclusions against disk_path resp. name */ + ret= Xorriso_path_is_excluded(xorriso, disk_path, 0); /* (is never param) */ + if(ret<0) + {ret= -1; goto ex;} + if(ret>0) + continue; + /* Check for mkisofs-style hidings */ + hide_attrs= (flag >> 8) & 3; + if(hide_attrs != 3) { + ret= Xorriso_path_is_hidden(xorriso, disk_path, 0); + if(ret<0) + return(ret); + if(ret>=0) + hide_attrs|= ret; + } + + strcpy(img_name, name); + if(Xorriso_much_too_long(xorriso, strlen(img_path), 0)<=0) + {ret= 0; goto was_problem;} + if(Xorriso_much_too_long(xorriso, strlen(srcpt), 0)<=0) + {ret= 0; goto was_problem;} + stbuf_src= srcpt; + if(lstat(srcpt, &stbuf)==-1) { +cannot_lstat:; + Xorriso_msgs_submit(xorriso, 0, srcpt, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "Cannot determine attributes of source file %s", + Text_shellsafe(srcpt, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto was_problem; + } + source_is_dir= 0; + source_is_link= S_ISLNK(stbuf.st_mode); + if(xorriso->do_follow_links && source_is_link) { + /* Xorriso_hop_link checks for wide link loops */ + ret= Xorriso_hop_link(xorriso, srcpt, &own_link_stack, &hstbuf, 0); + if(ret<0) + goto was_problem; + if(ret==1) { + ret= Xorriso_resolve_link(xorriso, srcpt, link_target, 0); + if(ret<=0) + goto was_problem; + srcpt= link_target; + stbuf_src= srcpt; + if(lstat(srcpt, &stbuf)==-1) + goto cannot_lstat; + } else { + if(Xorriso_eval_problem_status(xorriso, 0, 1|2)<0) + {ret= 0; goto was_problem;} + ret= Xorriso_resolve_link(xorriso, srcpt, link_target, 1); + if(ret<=0) + goto was_problem; + } + } else if (S_ISLNK(stbuf.st_mode)) { + ret= Xorriso_resolve_link(xorriso, srcpt, link_target, 1); + if(ret<=0) + goto was_problem; + } + do_not_dive= 0; + if(S_ISDIR(stbuf.st_mode)) { + source_is_dir= 1; + if(dir_dev != stbuf.st_dev && !xorriso->do_follow_mount) + do_not_dive= 1; + } + +#ifdef Xorriso_optimistic_add_treE + + ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name, + "", img_path, (off_t) 0, (off_t) 0, + &node, 1 | (hide_attrs << 8)); + if(ret == (int) ISO_NODE_NAME_NOT_UNIQUE) { + ret= Xoriso_handle_collision(xorriso, NULL, &node, img_path, img_path, + srcpt, img_path, + (!!source_is_dir) | (flag & (64 | 128))); + if(ret <= 0) + goto was_problem; + if(node == NULL) { + ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name, + "", img_path, (off_t) 0, (off_t) 0, + &node, (hide_attrs << 8)); + if(ret <= 0) + node= NULL; + } + } + +#else /* Xorriso_optimistic_add_treE */ + + /* does a node exist with this name ? */ + node= NULL; + if(dir != NULL) { + ret= iso_dir_get_node(dir, img_name, &node); + } else { + ret= Xorriso_node_from_path(xorriso, volume, img_path, &node, 1); + } + if(ret>0) { + target_is_dir= LIBISO_ISDIR(node); + target_is_split= 0; + if(target_is_dir && !(flag & 128)) + target_is_split= Xorriso_is_split(xorriso, "", (void *) node, 1 | 2); + + if(!((target_is_dir && !target_is_split) && source_is_dir)) { + Xorriso_process_msg_queues(xorriso,0); + + /* handle overwrite situation */; + if(xorriso->do_overwrite==1 || + (xorriso->do_overwrite==2 && !(target_is_dir && !target_is_split))) { + ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, img_path, + 1 | 8 | (flag & 64)); + if(ret<=0) + goto was_problem; + if(ret==3) { + sprintf(xorriso->info_text, "User revoked adding of: %s", + Text_shellsafe(img_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 0; goto was_problem; + } + node= NULL; + } else { + Xorriso_msgs_submit(xorriso, 0, srcpt, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "While grafting %s : file object exists and may not be overwritten by %s", + Text_shellsafe(img_path,sfe,0), Text_shellsafe(stbuf_src,sfe2,0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto was_problem; + } + } + } + + if(node==NULL) { + ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name, + "", img_path, (off_t) 0, (off_t) 0, + &node, (hide_attrs << 8)); + } + +#endif /* Xorriso_optimistic_add_treE */ + + if(node==NULL) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_msgs_submit(xorriso, 0, stbuf_src, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "Grafting failed: %s = %s", + Text_shellsafe(img_path,sfe,0), Text_shellsafe(stbuf_src,sfe2,0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto was_problem; + } + + xorriso->pacifier_count++; + if((xorriso->pacifier_count%100)==0) + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 0); + + Xorriso_set_change_pending(xorriso, 0); + if(source_is_dir) { + if(do_not_dive) { + sprintf(xorriso->info_text, "Did not follow mount point : %s", + Text_shellsafe(disk_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } else { + ret= Xorriso_add_tree(xorriso, (IsoDir *) node, + img_path, disk_path, own_link_stack, + 1 | (flag & (2 | 64 | 128))); + } + if(ret<=0) + goto was_problem; + } + + continue; /* regular bottom of loop */ +was_problem:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret<0) + goto ex; + } + + ret= 1; +ex: + if(sfe!=NULL) + free(sfe); + if(sfe2!=NULL) + free(sfe2); + if(disk_path!=NULL) + free(disk_path); + if(img_path!=NULL) + free(img_path); + if(link_target!=NULL) + free(link_target); + Xorriso_process_msg_queues(xorriso,0); + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + Dirseq_destroy(&dirseq, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* @param flag bit0= cut_out mode : base on leaf parent directory + bit1= do not check and perform hidings +*/ +int Xorriso_copy_implicit_properties(struct XorrisO *xorriso, IsoDir *dir, + char *full_img_path, char *img_path, char *full_disk_path, int flag) +{ + int ret, nfic, nic, nfdc, d, i; + char *nfi= NULL, *ni= NULL, *nfd= NULL, *cpt; + struct stat stbuf; + + Xorriso_alloc_meM(nfi, char, SfileadrL); + Xorriso_alloc_meM(ni, char, SfileadrL); + Xorriso_alloc_meM(nfd, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, full_img_path, nfi, + 1|2); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, img_path, ni, 1|2); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, full_disk_path, nfd, + 1|2|4); + if(ret<=0) + goto ex; + nfic= Sfile_count_components(nfi, 0); + nic= Sfile_count_components(ni, 0); + nfdc= Sfile_count_components(nfd, 0); + d= nfic-(flag&1)-nic; + if(d<0) + {ret= -1; goto ex;} + if(d>nfdc) + {ret= 0; goto ex;} + for(i= 0; iinfo_text, "Copied properties for "); + Text_shellsafe(ni, xorriso->info_text, 1); + sprintf(xorriso->info_text+strlen(xorriso->info_text), " from "); + Text_shellsafe(nfd, xorriso->info_text, 1); + if(!((flag&1) && d==0)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + if(!(flag & 2)) { + /* Check for mkisofs-style hidings */ + ret= Xorriso_path_is_hidden(xorriso, nfd, 0); + if(ret<0) + goto ex; + if(ret>=0) { + /* Hide dir */ + ret= Xorriso_set_hidden(xorriso, (void *) dir, "", ret, 0); + if(ret <= 0) + goto ex; + } + } + ret= 1; +ex: + Xorriso_free_meM(nfi); + Xorriso_free_meM(ni); + Xorriso_free_meM(nfd); + return(ret); +} + + +/* @param bit0= copy link target properties rather than link properties + bit1= give directory x-permission where is r-permission + bit2= record dev,inode (only if enabled by xorriso) +*/ +int Xorriso_copy_properties(struct XorrisO *xorriso, + char *disk_path, char *img_path, int flag) +{ + int ret; + IsoNode *node; + struct stat stbuf; + + ret= Xorriso_get_node_by_path(xorriso, img_path, NULL, &node, 0); + if(ret<=0) + return(ret); + if(flag & 1) { + if(stat(disk_path, &stbuf)==-1) + return(0); + } else { + if(lstat(disk_path, &stbuf)==-1) + return(0); + } + Xorriso_transfer_properties(xorriso, &stbuf, disk_path, node, + ((flag & 2) >> 1) | ((flag & 1) << 5) | (flag & 4)); + Xorriso_set_change_pending(xorriso, 0); + return(1); +} + + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= mkdir: graft in as empty directory, not as copy from disk + bit1= do not report added files + bit2= -follow, -not_*: this is not a command parameter + bit3= use offset and cut_size for cut_out_node + bit4= return 3 on rejection by exclusion or user + bit5= if directory then do not add sub tree + bit6= do not delete eventually existing node from di_array + bit7= no special handling of split file directories + bit8= hide in iso_rr + bit9= hide in joliet + @return <=0 = error , 1 = added simple node , 2 = added directory , + 3 = rejected +*/ +int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, + char *disk_path, char *img_path, + off_t offset, off_t cut_size, int flag) +{ + IsoImage *volume; + char *path= NULL, *apt, *npt, *cpt; + char *disk_path_pt, *resolved_disk_path= NULL; + IsoDir *dir= NULL, *hdir; + IsoNode *node; + int done= 0, is_dir= 0, l, ret, source_is_dir, resolve_link= 0; + int hide_attrs; + struct stat stbuf; + +#define Xorriso_graft_handle_collisioN 1 +#define Xorriso_optimistic_graft_iN 1 + +#ifndef Xorriso_optimistic_graft_iN +#ifndef Xorriso_graft_handle_collisioN + int target_is_split, target_is_dir; +#endif +#endif + + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(resolved_disk_path, char, SfileadrL); + + hide_attrs= (flag >> 8) & 3; + if (disk_path == NULL && !(flag & 1)) { + Xorriso_msgs_submit(xorriso, 0, + "Program error: Xorriso_graft_in(): disk_path == NULL && !(flag & 1)", + 0, "ABORT", 0); + {ret= -1; goto ex;} + } + if (disk_path == NULL) { + disk_path= ""; + } else { + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4)); + if(ret<0) + goto ex; + if(ret>0) + {ret= 3*!!(flag&16); goto ex;} + + /* Check for mkisofs-style hidings */ + if(hide_attrs != 3) { + ret= Xorriso_path_is_hidden(xorriso, disk_path, 0); + if(ret<0) + goto ex; + if(ret>=0) + hide_attrs|= ret; + } + } + + for(cpt= img_path; 1; cpt++) { + cpt= strstr(cpt,"/."); + if(cpt==NULL) + break; + if(cpt[2]=='.') { + if(cpt[3]=='/' || cpt[3]==0) + break; + } else if(cpt[2]=='/' || cpt[2]==0) + break; + } + if(cpt!=NULL) { + if(disk_path[0]) + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "Unsupported relative addressing in iso_rr_path "); + Text_shellsafe(img_path, xorriso->info_text, 1); + if(disk_path[0]) { + strcat(xorriso->info_text, " (disk: "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + strcat(xorriso->info_text, ")"); + } + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + strncpy(path, img_path, SfileadrL - 1); + path[SfileadrL - 1]= 0; + apt= npt= path; + + if(!(flag&1)) { + ret= lstat(disk_path, &stbuf); + if(ret!=-1) { + if(S_ISDIR(stbuf.st_mode)) + is_dir= 1; + else if((stbuf.st_mode&S_IFMT)==S_IFLNK && + (xorriso->do_follow_links || + (xorriso->do_follow_param && !(flag&4)))) { + resolve_link= 1; + ret= stat(disk_path, &stbuf); + if(ret!=-1) { + if(S_ISDIR(stbuf.st_mode)) + is_dir= 1; + } + } + } + if(ret == -1) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "Cannot determine attributes of source file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(S_ISDIR(stbuf.st_mode)) { + is_dir= 1; + } else { + l= strlen(img_path); + if(l>0) + if(img_path[l-1]=='/') + l= 0; + if(l==0) { + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "Source "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " is not a directory. Target "); + Text_shellsafe(img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " would be."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + } + + dir= iso_image_get_root(volume); + if(dir==NULL) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "While grafting '%s' : no root node available", img_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= 0; goto ex;} + } + for(npt= apt; !done; apt= npt+1) { + npt= strchr(apt, '/'); + if(npt==NULL) { + npt= apt+strlen(apt); + done= 1; + } else + *npt= 0; + if(*apt==0) { + *apt= '/'; + apt++; + if(done) + goto attach_source; + continue; + } + source_is_dir= (is_dir || (flag&1) || !done); + +#ifdef Xorriso_optimistic_graft_iN + + /* Directories of the source path are likely to exist already as directory + in the image. + That will cause two lookups with optimistic, and only one with + pessimistic. + So optimism will pay off only with the leaf. I.e. if(done). + */ + if(source_is_dir) { /* eventually create directory */ + ret= iso_dir_get_node(dir, apt, &node); + if(ret > 0) { + ret= Xoriso_handle_collision(xorriso, boss_iter, &node, path, + img_path, disk_path, + disk_path[0] ? disk_path : img_path, + (!!source_is_dir) | (flag & (16 | 64 | 128))); + if(ret <= 0 || ret == 3) + goto ex; + if(ret == 1 && node != NULL) + dir= (IsoDir *) node; + } else + node= NULL; + if(node == NULL) { + ret= iso_tree_add_new_dir(dir, apt, &hdir); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + if(disk_path[0]) + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + Xorriso_report_iso_error(xorriso, img_path, ret, + "Cannot create directory", 0, "FAILURE", 1); + sprintf(xorriso->info_text, + "While grafting '%s' : could not insert '%s'", img_path, path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(xorriso->update_flags & 1) { + ret= Xorriso_mark_update_merge(xorriso, path, (IsoNode *) hdir, 1); + if(ret <= 0) + {ret= 0; goto ex;} + } + + dir= hdir; + Xorriso_set_change_pending(xorriso, 0); + iso_node_set_ctime((IsoNode *) dir, time(NULL)); + iso_node_set_uid((IsoNode *) dir, geteuid()); + iso_node_set_gid((IsoNode *) dir, getegid()); + + if(disk_path[0] && !done) { + /* This not only copies disk directory properties + but also sets eventual hide_attrs */ + Xorriso_copy_implicit_properties(xorriso, dir, img_path, path, + disk_path, !!(flag&8)); + } + } + } + + if(done) { +attach_source:; + if(flag&1) { + /* directory node was created above */; + + } else if(is_dir) { + Xorriso_transfer_properties(xorriso, &stbuf, disk_path, + (IsoNode *) dir, 4 | 32); + if(!(flag&32)) { + ret= Xorriso_add_tree(xorriso, dir, img_path, disk_path, NULL, + flag & (2 | 64 | 128)); + if(ret<=0) + goto ex; + } + } else { + if(resolve_link) { + ret= Xorriso_resolve_link(xorriso, disk_path, resolved_disk_path, 0); + if(ret<=0) + goto ex; + disk_path_pt= resolved_disk_path; + } else + disk_path_pt= disk_path; + + ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt, + disk_path, img_path, offset, cut_size, + &node, 1 | (flag & 8) | (hide_attrs << 8)); + if(ret == (int) ISO_NODE_NAME_NOT_UNIQUE) { + ret= Xoriso_handle_collision(xorriso, boss_iter, &node, img_path, + img_path, disk_path, + disk_path[0] ? disk_path : img_path, + (flag & (16 | 64 | 128))); + if(ret <= 0 || ret == 3) + goto ex; + ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt, + disk_path, img_path, offset, cut_size, + &node, (flag & 8) | (hide_attrs << 8)); + } + if(ret<=0) { + sprintf(xorriso->info_text, "Grafting failed: "); + Text_shellsafe(img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " = "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + Xorriso_set_change_pending(xorriso, 0); + iso_node_set_name(node, apt); + + xorriso->pacifier_count++; + if(xorriso->pacifier_count%100 && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "files added", + xorriso->pacifier_count, + xorriso->pacifier_total, "", 0); + } + } else + *npt= '/'; + +#else /* Xorriso_optimistic_graft_iN */ + + node= NULL; + ret= iso_dir_get_node(dir, apt, &node); + if(ret>0) { + +#ifdef Xorriso_graft_handle_collisioN + + ret= Xoriso_handle_collision(xorriso, boss_iter, &node, path, img_path, + disk_path, + disk_path[0] ? disk_path : img_path, + (!!source_is_dir) | (flag & (16 | 64 | 128))); + if(ret <= 0 || ret == 3) + goto ex; + if(ret == 2) + goto handle_path_node; + +#else /* Xorriso_graft_handle_collisioN */ + + target_is_dir= LIBISO_ISDIR(node); + + target_is_split= 0; + if(target_is_dir && !(flag & 128)) + target_is_split= Xorriso_is_split(xorriso, "", (void *) node, 1 | 2); + + if(!((target_is_dir && !target_is_split) && source_is_dir)) { + Xorriso_process_msg_queues(xorriso,0); + + /* handle overwrite situation */; + if(xorriso->do_overwrite==1 || + (xorriso->do_overwrite==2 && !(target_is_dir && !target_is_split))) { + ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, path, + 1 | 8 | (flag & 64)); + if(ret<=0) + goto ex; + if(ret==3) { + sprintf(xorriso->info_text, "User revoked adding of: "); + if(disk_path[0]) + Text_shellsafe(disk_path, xorriso->info_text, 1); + else + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + {ret= 3*!!(flag&16); goto ex;} + } + node= NULL; + goto handle_path_node; + } + + if (disk_path[0]) + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "While grafting '%s' : '%s' exists and may not be overwritten", + img_path, path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + +#endif /* ! Xorriso_graft_handle_collisioN */ + + dir= (IsoDir *) node; + } + +handle_path_node:; + if(node==NULL && source_is_dir) { /* make a directory */ + ret= iso_tree_add_new_dir(dir, apt, &hdir); + if(ret<0) { + Xorriso_process_msg_queues(xorriso,0); + if(disk_path[0]) + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + Xorriso_report_iso_error(xorriso, img_path, ret, + "Cannot create directory", 0, "FAILURE", 1); + sprintf(xorriso->info_text, + "While grafting '%s' : could not insert '%s'", img_path, path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(xorriso->update_flags & 1) { + ret= Xorriso_mark_update_merge(xorriso, path, (IsoNode *) hdir, 1); + if(ret <= 0) + {ret= 0; goto ex;} + } + + dir= hdir; + Xorriso_set_change_pending(xorriso, 0); + iso_node_set_ctime((IsoNode *) dir, time(NULL)); + iso_node_set_uid((IsoNode *) dir, geteuid()); + iso_node_set_gid((IsoNode *) dir, getegid()); + + if(disk_path[0] && !done) + /* This not only copies disk directory properties + but also sets eventual hide_attrs */ + Xorriso_copy_implicit_properties(xorriso, dir, img_path, path, disk_path, + !!(flag&8)); + } + if(done) { +attach_source:; + if(flag&1) { + /* directory node was created above */; + + } else if(is_dir) { + Xorriso_transfer_properties(xorriso, &stbuf, disk_path, + (IsoNode *) dir, 4 | 32); + if(!(flag&32)) { + ret= Xorriso_add_tree(xorriso, dir, img_path, disk_path, NULL, + flag & (2 | 64 | 128)); + if(ret<=0) + goto ex; + } + } else { + if(resolve_link) { + ret= Xorriso_resolve_link(xorriso, disk_path, resolved_disk_path, 0); + if(ret<=0) + goto ex; + disk_path_pt= resolved_disk_path; + } else + disk_path_pt= disk_path; + + ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt, + disk_path, img_path, offset, cut_size, + &node, (flag&8) | (hide_attrs << 8)); + if(ret<=0) { + sprintf(xorriso->info_text, "Grafting failed: "); + Text_shellsafe(img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " = "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + Xorriso_set_change_pending(xorriso, 0); + iso_node_set_name(node, apt); + + xorriso->pacifier_count++; + if(xorriso->pacifier_count%100 && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "files added", + xorriso->pacifier_count, + xorriso->pacifier_total, "", 0); + } + } else + *npt= '/'; + +#endif /* ! Xorriso_optimistic_graft_iN */ + + } + + Xorriso_process_msg_queues(xorriso,0); + ret= 1+!!is_dir; +ex:; + Xorriso_free_meM(path); + Xorriso_free_meM(resolved_disk_path); + return(ret); +} + + +/* @param flag bit0= -follow: disk_path is not a command parameter +*/ +int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path, + off_t startbyte, off_t bytecount, char *iso_rr_path, int flag) +{ + int ret; + char *eff_source= NULL, *eff_dest= NULL; + struct stat stbuf; + + Xorriso_alloc_meM(eff_source, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_source, + 2|4); + if(ret<=0) + goto ex; + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&1)); + if(ret!=0) + {ret= 0; goto ex;} + + if(lstat(eff_source, &stbuf)==-1) { + Xorriso_msgs_submit(xorriso, 0, eff_source, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "-cut_out: Cannot determine type of "); + Text_shellsafe(eff_source, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + + if((stbuf.st_mode&S_IFMT) == S_IFLNK) { + if(!(xorriso->do_follow_links || (xorriso->do_follow_param && !(flag&1)))) + goto unsupported_type; + if(stat(eff_source, &stbuf)==-1) { + Xorriso_msgs_submit(xorriso, 0, eff_source, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "-cut_out: Cannot determine link target type of "); + Text_shellsafe(eff_source, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + {ret= 0; goto ex;} + } + } + if(S_ISREG(stbuf.st_mode)) { + if(stbuf.st_sizeinfo_text, + "-cut_out: Byte offset %.f larger than file size %.f", + (double) startbyte, (double) stbuf.st_size); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0); + {ret= 0; goto ex;} + } + } else { +unsupported_type:; + Xorriso_msgs_submit(xorriso, 0, eff_source, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "-cut_out: Unsupported file type (%s) with ", + Ftypetxt(stbuf.st_mode, 0)); + Text_shellsafe(eff_source, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, iso_rr_path, eff_dest, + 2); + if(ret<=0) + goto ex; + + ret= Xorriso_graft_in(xorriso, NULL, eff_source, eff_dest, + startbyte, bytecount, 8); +ex:; + Xorriso_free_meM(eff_source); + Xorriso_free_meM(eff_dest); + return(ret); +} + + +/* @param flag bit0= do not produce info message on success + bit1= do not raise protest if directory already exists + @return 1=success, + 0=was already directory, -1=was other type, -2=other error +*/ +int Xorriso_mkdir(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + char *eff_path= NULL; + + Xorriso_alloc_meM(eff_path, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 1); + if(ret<0) + {ret= -2; goto ex;} + if(ret>0) { + if(ret == 2 && (flag & 2)) + {ret= 0; goto ex;} + sprintf(xorriso->info_text,"-mkdir: Address already existing "); + Text_shellsafe(eff_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (ret==2 ? "WARNING" : "FAILURE"), 0); + {ret= -1 + (ret == 2); goto ex;} + } + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 2); + if(ret<0) + {ret= -2; goto ex;} + ret= Xorriso_graft_in(xorriso, NULL, NULL, eff_path, (off_t) 0, (off_t) 0, 1); + if(ret<=0) + {ret= -2; goto ex;} + if(!(flag&1)) { + sprintf(xorriso->info_text, "Created directory in ISO image: "); + Text_shellsafe(eff_path, xorriso->info_text, 1); + Xorriso_info(xorriso, 0); + } + ret= 1; +ex:; + Xorriso_free_meM(eff_path); + return(ret); +} + + +/* @param boss_iter If not NULL then this is an iterator suitable for + iso_dir_iter_remove() which is then to be used instead + of iso_node_remove(). + @param flag bit0= remove whole sub tree: rm -r + bit1= remove empty directory: rmdir + bit2= recursion: do not reassure in mode 2 "tree" + bit3= this is for overwriting and not for plain removal + bit4= count deleted files in xorriso->pacifier_count + bit5= with bit0 only remove directory content, not the directory + bit6= do not delete eventually existing node from di_array + @return <=0 = error + 1 = removed simple node + 2 = removed directory or tree + 3 = did not remove on user revocation +*/ +int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem, + char *path, int flag) +{ + int ret, is_dir= 0, pl, not_removed= 0, fret; + IsoNode *victim_node, *node; + IsoDir *boss_node, *root_dir; + IsoDirIter *iter= NULL; + IsoImage *volume; + char *sub_name, *name; + char *sfe= NULL, *sub_path= NULL; + off_t mem; + IsoNode **node_array= NULL; + int node_count= 0, node_idx; + + /* Avoiding large local memory objects in order to save stack space */ + sfe= malloc(5*SfileadrL); + sub_path= malloc(2*SfileadrL); + if(sfe==NULL || sub_path==NULL) { + Xorriso_no_malloc_memory(xorriso, &sfe, 0); + {ret= -1; goto ex;} + } + +#ifndef Libisofs_iso_dir_iter_sufficienT + /* Ticket 127: A80301 - A80302 + I do not not deem IsoDirIter safe for node list manipulations. + The parameter boss_iter once was intended to allow such but + has now been downgraded to a mere check for eventual programming bugs. + */ + if(boss_iter!=NULL) { + sprintf(xorriso->info_text, + "Program error: Xorriso_rmi() was requested to delete iterated node %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= -1; goto ex; + } +#endif /* Libisofs_iso_dir_iter_sufficienT */ + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + if(Xorriso_much_too_long(xorriso, strlen(path), 0)<=0) + {ret= 0; goto ex;} + ret= Xorriso_node_from_path(xorriso, volume, path, &victim_node, 0); + if(ret<=0) + goto ex; + root_dir= iso_image_get_root(volume); + if(((void *) root_dir) == ((void *) victim_node) && !(flag & 1)) { + sprintf(xorriso->info_text, "May not delete root directory"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + if(LIBISO_ISDIR(victim_node)) + is_dir= 1; + if(!is_dir) { + if(flag&2) { /* rmdir */ + sprintf(xorriso->info_text, "%s in loaded ISO image is not a directory", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else { + if(flag&1) { /* rm -r */ + if((xorriso->do_reassure==1 && !xorriso->request_not_to_ask) || + (flag&32) || ((void *) root_dir) == ((void *) victim_node)) { + /* Iterate over subordinates and delete them */ + mem= boss_mem; + + ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, + &iter, &node_array, &node_count, &node_idx, + &node, 1|2); + if(ret<=0) { +cannot_create_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + ret= -1; goto ex; + } + pl= strlen(path); + strcpy(sub_path, path); + if(pl==0 || sub_path[pl-1]!='/') { + sub_path[pl++]= '/'; + sub_path[pl]= 0; + } + sub_name= sub_path+pl; + while(1) { + ret= Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter, + &node_array, &node_count, &node_idx, &node, 0); + if(ret<0) + goto ex; + if(ret==0 || xorriso->request_to_abort) + break; + name= (char *) iso_node_get_name(node); + if(Xorriso_much_too_long(xorriso, pl+1+strlen(name), 0)<=0) + {ret= 0; goto rm_r_problem_handler;} + strcpy(sub_name, name); + ret= Xorriso_rmi(xorriso, iter, mem, sub_path, + (flag & ( 1 | 2 | 8 | 16 | 64)) | 4); + if(ret==3 || ret<=0 || xorriso->request_to_abort) { +rm_r_problem_handler:; + not_removed= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret<0) + goto dir_not_removed; + } + } + if(flag&32) + {ret= 2; goto ex;} + + if(not_removed) { +dir_not_removed:; + sprintf(xorriso->info_text, "Directory not removed: %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + if(ret>0) + ret= 3; + goto ex; + } + } + } else { + if(!(flag&2)) { /* not rmdir */ + sprintf(xorriso->info_text, "%s in loaded ISO image is a directory", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + ret= iso_dir_get_children((IsoDir *) victim_node, &iter); + Xorriso_process_msg_queues(xorriso,0); + if(ret<0) + goto cannot_create_iter; + if(ret>0) { + if(iso_dir_iter_next(iter, &node) == 1) { + sprintf(xorriso->info_text, + "Directory not empty on attempt to delete: %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + } + } + + if(((void *) root_dir) == ((void *) victim_node)) + {ret= 2; goto ex;} + + if(xorriso->request_to_abort) + {ret= 3; goto ex;} + boss_node= iso_node_get_parent(victim_node); + Xorriso_process_msg_queues(xorriso,0); + if(boss_node==NULL) { + sprintf(xorriso->info_text, + "Cannot find parent node of %s in loaded ISO image", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + while((xorriso->do_reassure==1 || (xorriso->do_reassure==2 && !(flag&4))) + && !xorriso->request_not_to_ask) { + /* ls -ld */ + Xorriso_ls_filev(xorriso, xorriso->wdi, 1, &path, (off_t) 0, 1|2|8); + if(is_dir) /* du -s */ + Xorriso_ls_filev(xorriso, xorriso->wdi, 1, &path, (off_t) 0, 2|4); + if(flag&8) + sprintf(xorriso->info_text, + "File exists. Remove ? n= keep old, y= remove, x= abort, @= stop asking\n"); + else + sprintf(xorriso->info_text, + "Remove above file ? n= keep it, y= remove it, x= abort, @= stop asking\n"); + Xorriso_info(xorriso, 4); + ret= Xorriso_request_confirmation(xorriso, 1|2|4|16); + if(ret<=0) + goto ex; + if(xorriso->request_to_abort) { + sprintf(xorriso->info_text, + "Removal operation aborted by user before file: %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 3; goto ex; + } + if(ret==3) + continue; + if(ret==6) /* yes */ + break; + if(ret==4) { /* yes, do not ask again */ + xorriso->request_not_to_ask= 1; + break; + } + if(ret==1) { /* no */ + sprintf(xorriso->info_text, "Kept in existing state: %s", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 3; goto ex; + } + } + + if(!(flag & 64)) + Xorriso_invalidate_di_item(xorriso, victim_node, 0); + +#ifdef Libisofs_iso_dir_iter_sufficienT + + if(boss_iter!=NULL) { + ret= iso_dir_iter_remove((IsoDirIter *) boss_iter); + if(ret<0) + ret= -1; + } else + ret= iso_node_remove(victim_node); + +#else /* ! Libisofs_iso_dir_iter_sufficienT */ + + ret= iso_node_remove(victim_node); + +#endif /* Libisofs_iso_dir_iter_sufficienT */ + + Xorriso_process_msg_queues(xorriso,0); + if(ret<0) { + Xorriso_report_iso_error(xorriso, path, ret, "Cannot remove node", 0, + "FATAL", 1); + sprintf(xorriso->info_text, + "Internal failure to remove %s from loaded ISO image", + Text_shellsafe(path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= -1; goto ex; + } + + if(flag&16) + xorriso->pacifier_count++; + Xorriso_set_change_pending(xorriso, 0); + ret= 1+!!is_dir; +ex:; + if(sfe!=NULL) + free(sfe); + if(sub_path!=NULL) + free(sub_path); + Xorriso_findi_iter(xorriso, (IsoDir *) victim_node, &mem, &iter, + &node_array, &node_count, &node_idx, &node, (1<<31)); + return(ret); +} + + +int Xorriso_overwrite_dest(struct XorrisO *xorriso, void *boss_iter, + char *eff_dest, int dest_ret, char *activity, + int flag) +{ + int ret; + + if(dest_ret==2 && xorriso->do_overwrite!=1) { + sprintf(xorriso->info_text, "%s: May not overwrite directory: ", activity); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } else if (dest_ret==1 && !xorriso->do_overwrite) { + sprintf(xorriso->info_text, "%s: May not overwite: ", activity); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } else if(dest_ret>0) { + ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, eff_dest, 1|8); + if(ret<=0) + return(0); + if(ret==3) { + sprintf(xorriso->info_text, "%s: User revoked removal of: ", activity); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(0); + } + } + return(1); +} + + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter, + char *origin, char *dest, int flag) +{ + int ret, ol, dest_ret; + char *eff_dest= NULL, *dir_adr= NULL, *cpt; + char *leafname, *eff_origin= NULL, *old_leafname; + IsoImage *volume; + IsoDir *origin_dir, *dest_dir; + IsoNode *node, *iso_node; + + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(dir_adr, char, SfileadrL); + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + +#ifndef Libisofs_iso_dir_iter_sufficienT + /* Ticket 127: A80301 - A80302 + I do not not deem IsoDirIter safe for node list manipulations. + The parameter boss_iter once was intended to allow such but + has now been downgraded to a mere check for eventual programming bugs. + */ + if(boss_iter!=NULL) { + sprintf(xorriso->info_text, + "Program error: Xorriso_rename() was requested to delete iterated node "); + Text_shellsafe(origin, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } +#endif /* Libisofs_iso_dir_iter_sufficienT */ + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, origin, eff_origin, 0); + if(ret<=0) + goto ex; + dest_ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest,1); + if(dest_ret<0) + {ret= dest_ret; goto ex;} + if(dest_ret==0) { /* obtain eff_dest address despite it does not exist */ + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest, 2); + if(ret<=0) + goto ex; + } + + /* Prevent that destination is a subordinate of origin + (that would be a black hole plopping out of the universe) */ + ol= strlen(eff_origin); + if(ol==0) { + sprintf(xorriso->info_text, "May not rename root directory"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } else if(strcmp(eff_origin, eff_dest)==0) { + sprintf(xorriso->info_text, "Ignored attempt to rename "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + strcat(xorriso->info_text, " to itself"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + {ret= 0; goto ex;} + } else if(strncmp(eff_origin, eff_dest, ol)==0 && + (eff_dest[ol]==0 || eff_dest[ol]=='/')) { + sprintf(xorriso->info_text, "May not rename "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + strcat(xorriso->info_text, " to its own sub address "); + Text_shellsafe(eff_dest, xorriso->info_text, 1 | 2); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + /* Check whether destination exists and may be not overwriteable */ + ret= Xorriso_overwrite_dest(xorriso, boss_iter, + eff_dest, dest_ret, "Renaming", 0); + if(ret <= 0) + goto ex; + + /* Ensure existence of destination directory */ + strcpy(dir_adr, eff_dest); + cpt= strrchr(dir_adr, '/'); + if(cpt==NULL) + cpt= dir_adr+strlen(dir_adr); + *cpt= 0; + if(dir_adr[0]!=0) { + ret= Xorriso_graft_in(xorriso, boss_iter, NULL, dir_adr, + (off_t) 0, (off_t) 0, 1); + if(ret<=0) + goto ex; + } + + /* Move node */ + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + Xorriso_node_from_path(xorriso, volume, dir_adr, &iso_node, 0); + dest_dir= (IsoDir *) iso_node; + strcpy(dir_adr, eff_origin); + cpt= strrchr(dir_adr, '/'); + if(cpt==NULL) + cpt= dir_adr+strlen(dir_adr); + *cpt= 0; + Xorriso_node_from_path(xorriso, volume, dir_adr, &iso_node, 0); + origin_dir= (IsoDir *) iso_node; + Xorriso_node_from_path(xorriso, volume, eff_origin, &node, 0); + if(dest_dir==NULL || origin_dir==NULL || node==NULL) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Internal error on rename: confirmed node turns out as NULL"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + ret= iso_node_take(node); + if(ret<0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, eff_dest, 0, "Cannot take", 0, "FATAL",1); + sprintf(xorriso->info_text, + "Internal error on rename: failed to take node"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + leafname= strrchr(eff_dest, '/'); + if(leafname==NULL) + leafname= eff_dest; + else + leafname++; + + old_leafname= (char *) iso_node_get_name(node); + if(strcmp(leafname, old_leafname)!=0) + ret= iso_node_set_name(node, leafname); + else + ret= 1; + if(ret<0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, eff_dest, 0, "Cannot set name", 0, + "FAILURE", 1); + {ret= -1; goto ex;} + } + Xorriso_process_msg_queues(xorriso,0); + ret= iso_dir_add_node(dest_dir, node, 0); + if(ret<0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, eff_dest, 0, "Cannot add", 0, "FATAL", 1); + sprintf(xorriso->info_text, + "Internal error on rename: failed to insert node"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + ret= 1; +ex:; + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(dir_adr); + Xorriso_free_meM(eff_origin); + return(ret); +} + + +int Xorriso_cannot_clone(struct XorrisO *xorriso, char *eff_origin, + char *eff_dest, int iso_error, int flag) +{ + Xorriso_report_iso_error(xorriso, eff_dest, iso_error, "Cannot clone", + 0, "FAILURE", 1); + sprintf(xorriso->info_text, "Failed to clone "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); +} + + +/* @param flag bit0= for iso_tree_clone() : merge directories + bit1= do not issue NOTE message +*/ +int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter, + char *origin, char *dest, int flag) +{ + int ret, dest_ret, l; + char *eff_dest= NULL, *eff_origin= NULL, *dir_adr= NULL; + char *leafname; + IsoImage *volume; + IsoDir *new_parent; + IsoNode *origin_node, *dir_node, *new_node; + + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(dir_adr, char, SfileadrL); + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret <= 0) + goto ex; + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, origin, eff_origin, 0); + if(ret<=0) + goto ex; + ret= Xorriso_node_from_path(xorriso, volume, eff_origin, &origin_node, 0); + if(ret <= 0) + goto ex; + + dest_ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest,1); + if(dest_ret<0) + {ret= dest_ret; goto ex;} + if(dest_ret > 0) { + if(eff_dest[0] == 0) + strcpy(eff_dest, "/"); + sprintf(xorriso->info_text, + "Cloning: Copy address already exists: "); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } else { + /* obtain eff_dest address despite it does not exist */ + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest, 2); + if(ret<=0) + goto ex; + } + + /* Obtain parent path and leaf name */ + strcpy(dir_adr, eff_dest); + for(l= strlen(dir_adr); l > 0; ) { + if(dir_adr[l - 1] == '/') + dir_adr[--l]= 0; + else + break; + } + leafname= strrchr(dir_adr, '/'); + if(leafname == NULL) { + leafname= dir_adr; + if (leafname[0] == 0) { + Xorriso_msgs_submit(xorriso, 0, "Empty file name as clone destination", + 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } else { + *leafname= 0; + leafname++; + if(dir_adr[0] != 0) { + /* Ensure existence of destination directory */ + ret= Xorriso_graft_in(xorriso, boss_iter, NULL, dir_adr, + (off_t) 0, (off_t) 0, 1); + if(ret <= 0) + goto ex; + } + } + + ret= Xorriso_node_from_path(xorriso, volume, dir_adr, &dir_node, 0); + if(ret <= 0) + goto ex; + new_parent= (IsoDir *) dir_node; + + ret = iso_tree_clone(origin_node, new_parent, leafname, &new_node, flag & 1); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) { + Xorriso_cannot_clone(xorriso, eff_origin, eff_dest, ret, 0); + {ret= 0; goto ex;} + } + Xorriso_set_change_pending(xorriso, 0); + if(!(flag & 2)) { + strcpy(xorriso->info_text, "Cloned in ISO image: "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + strcat(xorriso->info_text, " to "); + Text_shellsafe(eff_dest, xorriso->info_text, 1 | 2); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso, 0); + } + ret= 1; +ex:; + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(dir_adr); + return(ret); +} + + +int Xorriso_clone_under(struct XorrisO *xorriso, char *origin, char *dest, + int flag) +{ + int ret, pass; + char *eff_dest= NULL, *eff_origin= NULL, *namept; + IsoDir *origin_dir, *dest_dir; + IsoDirIter *iter= NULL; + IsoNode *origin_node, *new_node; + IsoImage *volume; + + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_dir_from_path(xorriso, "Copy source", origin, &origin_dir, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_dir_from_path(xorriso, "Copy destination", dest, &dest_dir, 0); + if(ret <= 0) + goto ex; + + for(pass= 0; pass < 2; pass++) { + ret= iso_dir_get_children(origin_dir, &iter); + if(ret < 0) { + Xorriso_cannot_create_iter(xorriso, ret, 0); + {ret= -1; goto ex;} + } + Xorriso_process_msg_queues(xorriso,0); + + while(iso_dir_iter_next(iter, &origin_node) == 1) { + namept= (char *) iso_node_get_name(origin_node); + sprintf(eff_origin, "%s/%s", origin, namept); + sprintf(eff_dest, "%s/%s", dest, namept); + if(pass == 0) { + ret= Xorriso_node_from_path(xorriso, volume, eff_dest, &new_node, 1); + if(ret < 0) + goto ex; + if(ret > 0) { + sprintf(xorriso->info_text, "Cloning: Copy address already exists: "); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } else { + ret = iso_tree_clone(origin_node, dest_dir, namept, &new_node, 1); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) { + Xorriso_cannot_clone(xorriso, eff_origin, eff_dest, ret, 0); + ret= 0; goto ex; + } + } + } + iso_dir_iter_free(iter); + iter= NULL; + } + Xorriso_set_change_pending(xorriso, 0); + ret= 1; +ex:; + if(iter != NULL) + iso_dir_iter_free(iter); + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(eff_origin); + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +int Xorriso_set_st_mode(struct XorrisO *xorriso, char *in_path, + mode_t mode_and, mode_t mode_or, int flag) +{ + mode_t mode= 0; + int ret; + IsoNode *node; + char *path= NULL; + + Xorriso_alloc_meM(path, char, SfileadrL); + ret= Xorriso_get_node_by_path(xorriso, in_path, path, &node, 0); + if(ret<=0) + goto ex; + mode= iso_node_get_permissions(node); + mode= (mode & mode_and) | mode_or; + iso_node_set_permissions(node, mode); + iso_node_set_ctime(node, time(NULL)); + sprintf(xorriso->info_text,"Permissions now: %-5.5o ", + (unsigned int) (mode & 0xffff)); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + Xorriso_set_change_pending(xorriso, 0); + Xorriso_process_msg_queues(xorriso,0); + ret= 1; +ex:; + Xorriso_free_meM(path); + return(ret); +} + + +int Xorriso_set_uid(struct XorrisO *xorriso, char *in_path, uid_t uid, + int flag) +{ + int ret; + IsoNode *node; + + ret= Xorriso_get_node_by_path(xorriso, in_path, NULL, &node, 0); + if(ret<=0) + return(ret); + iso_node_set_uid(node, uid); + iso_node_set_ctime(node, time(NULL)); + Xorriso_set_change_pending(xorriso, 0); + Xorriso_process_msg_queues(xorriso,0); + return(1); +} + + +int Xorriso_set_gid(struct XorrisO *xorriso, char *in_path, gid_t gid, + int flag) +{ + int ret; + IsoNode *node; + + ret= Xorriso_get_node_by_path(xorriso, in_path, NULL, &node, 0); + if(ret<=0) + return(ret); + iso_node_set_gid(node, gid); + iso_node_set_ctime(node, time(NULL)); + Xorriso_set_change_pending(xorriso, 0); + Xorriso_process_msg_queues(xorriso,0); + return(1); +} + + +/* @parm flag bit0= atime, bit1= ctime, bit2= mtime, bit8=no auto ctime */ +int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t, + int flag) +{ + int ret; + IsoNode *node; + + ret= Xorriso_get_node_by_path(xorriso, in_path, NULL, &node, 0); + if(ret<=0) + return(ret); + if(flag&1) + iso_node_set_atime(node, t); + if(flag&2) + iso_node_set_ctime(node, t); + if(flag&4) + iso_node_set_mtime(node, t); + if(!(flag&(2|256))) + iso_node_set_ctime(node, time(NULL)); + Xorriso_set_change_pending(xorriso, 0); + Xorriso_process_msg_queues(xorriso,0); + return(1); +} + + +/* + Apply the effect of mkisofs -r to a single node +*/ +int Xorriso_mkisofs_lower_r(struct XorrisO *xorriso, IsoNode *node, int flag) +{ + mode_t perms; + + perms= iso_node_get_permissions(node); + iso_node_set_uid(node, (uid_t) 0); + iso_node_set_gid(node, (gid_t) 0); + perms|= S_IRUSR | S_IRGRP | S_IROTH; + perms&= ~(S_IWUSR | S_IWGRP | S_IWOTH); + if(perms & (S_IXUSR | S_IXGRP | S_IXOTH)) + perms|= (S_IXUSR | S_IXGRP | S_IXOTH); + perms&= ~(S_ISUID | S_ISGID | S_ISVTX); + iso_node_set_permissions(node, perms); + return(1); +} + + +/* @param node Opaque handle to IsoNode which is to be manipulated + instead of path if it is not NULL. + @param path is used as address if node is NULL. + @param access_text "access" ACL in long text form + @param default_text "default" ACL in long text form + @param flag bit0= do not warn of root directory if not capable of AAIP + @return >0 success , <=0 failure +*/ +int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path, + char *access_text, char *default_text, int flag) +{ + int ret; + IsoNode *node; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + goto ex; + } + ret= iso_node_set_acl_text(node, access_text, default_text, 0); + if(ret <= 0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when setting ACL to image node", + 0, "FAILURE", 1); + if(path != NULL && path[0] != 0) { + strcpy(xorriso->info_text, "Error with setting ACL of "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + ret= 0; goto ex; + } + Xorriso_set_change_pending(xorriso, 0); + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* @param in_node Opaque handle to IsoNode which is to be manipulated + instead of path if it is not NULL. + @param path is used as address if node is NULL. + @param num_attrs Number of attributes + @param names Array of pointers to 0 terminated name strings + @param value_lengths Array of byte lengths for each attribute payload + @param values Array of pointers to the attribute payload bytes + @param flag bit0= Do not maintain eventual existing ACL of the node + bit1= Do not clear the existing attribute list + bit2= Delete the attributes with the given names + bit3= Allow non-user attributes. + bit4= do not warn of root if incapable of AAIP + @return >0 success , <=0 failure +*/ +int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path, + size_t num_attrs, char **names, + size_t *value_lengths, char **values, int flag) +{ + int ret; + IsoNode *node; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + goto ex; + } + ret= iso_node_set_attrs(node, num_attrs, names, value_lengths, values, + flag & (1 | 2 | 4 | 8)); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when setting ACL and xattr to image node", + 0, "FAILURE", 1); + if(path != NULL && path[0] != 0) { + strcpy(xorriso->info_text, "Error with setting xattr of "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + ret= 0; goto ex; + } + Xorriso_set_change_pending(xorriso, 0); + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* + @param flag bit0= use parameters dev,ino rather than disk_path + bit1= compare attribute rather than setting it + return: 0=dev,ino match, 1=mismatch, 2=no node attribute + -1=error + bit5= if not bit0: + transfer dev,inode from eventual link target + bit7= omit dev check mit bit1 +*/ +int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path, + dev_t dev, ino_t ino, + void *in_node, char *iso_path, int flag) +{ + size_t l, di_l= 0; + int i, ret; + dev_t hdev; + ino_t hino; + char buf[66], *bufpt, *wpt, *di= NULL; + static char *name= "isofs.di"; + struct stat stbuf; + + if(!(flag & 1)) { + if(flag & 32) { + if(stat(disk_path, &stbuf) == -1) + return(-1); + } else { + if(lstat(disk_path, &stbuf) == -1) + return(-1); + } + dev= stbuf.st_dev; + ino= stbuf.st_ino; + } + + wpt= buf; + hdev= dev; + for(i= 0; hdev != 0; i++) + hdev= hdev >> 8; + l= i; + *(wpt++)= l; + for(i= 0; i < (int) l; i++) + *(wpt++)= dev >> (8 * (l - i - 1)); + hino= ino; + for(i= 0; hino != 0; i++) + hino= hino >> 8; + l= i; + *(wpt++)= l; + for(i= 0; i < (int) l; i++) + *(wpt++)= ino >> (8 * (l - i - 1)); + l= wpt - buf; + bufpt= buf; + + if(flag & 2) { + /* Compare node attribute with bufpt,l */ + ret= Xorriso_get_attr_value(xorriso, in_node, iso_path, + "isofs.di", &di_l, &di, 0); + if(ret < 0) + goto ex; + if(ret == 0) + {ret= 2; goto ex;} + if(flag & 128) { + if(di_l <= 0) + {ret= 1; goto ex;} + hino= 0; + for(i= di[0] + 2; i < (int) di_l && i - di[0] - 2 < di[(int) di[0] + 1]; + i++) + hino= (hino << 8) | ((unsigned char *) di)[i]; + if(hino != ino) + {ret= 1; goto ex;} + } else { + if(l != di_l) + {ret= 1; goto ex;} + for(i= 0; i < (int) l; i++) + if(di[i] != buf[i]) + {ret= 1; goto ex;} + } + ret= 0; + } else { + ret= Xorriso_setfattr(xorriso, in_node, iso_path, + (size_t) 1, &name, &l, &bufpt, 2 | 8); + } +ex:; + if(di != NULL) + free(di); + return(ret); +} + + +/* @return see Xorriso_update_interpreter() +*/ +int Xorriso_widen_hardlink(struct XorrisO *xorriso, void * boss_iter, + IsoNode *node, + char *abs_path, char *iso_prefix, char *disk_prefix, + int flag) +{ + int ret= 0, idx, low, high, i, do_widen= 0, compare_result= 0; + char *disk_path; + + Xorriso_alloc_meM(disk_path, char, SfileadrL); + + /* Lookup all di_array instances of node */ + if(LIBISO_ISDIR(node)) + {ret= 3; goto ex;} + ret= Xorriso_search_di_range(xorriso, node, &idx, &low, &high, 2); + if(ret <= 0) + {ret= 3; goto ex;} + /* Check and reset di_do_widen bits */ + for(i= low; i <= high; i++) { + if(node != xorriso->di_array[i]) /* might be NULL */ + continue; + if(xorriso->di_do_widen[i / 8] & (1 << (i % 8))) + do_widen= 1; + xorriso->di_do_widen[i / 8]&= ~(1 << (i % 8)); + } + if(idx < 0 || !do_widen) + {ret= 3; goto ex;} + + ret= Xorriso_pfx_disk_path(xorriso, abs_path, iso_prefix, disk_prefix, + disk_path, 0); + if(ret <= 0) + goto ex; + ret= Sfile_type(disk_path, 1); + if(ret < 0) + {ret= 3; goto ex;} /* does not exist on disk */ + + /* >>> compare_result bit17 = is_split */; + + ret= Xorriso_update_interpreter(xorriso, boss_iter, NULL, + compare_result, disk_path, abs_path, 1); + if(ret <= 0) + goto ex; +ex:; + Xorriso_free_meM(disk_path); + return(ret); +} + + +int Xorriso_set_hidden(struct XorrisO *xorriso, void *in_node, char *path, + int hide_state, int flag) +{ + int ret, hide_attrs= 0; + IsoNode *node; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + return(ret); + } + if(hide_state) { + hide_attrs|= LIBISO_HIDE_BUT_WRITE; + if(hide_state & 1) + hide_attrs|= LIBISO_HIDE_ON_RR; + if(hide_state & 2) + hide_attrs|= LIBISO_HIDE_ON_JOLIET; + } + iso_node_set_hidden(node, hide_attrs); + return(1); +} + + +/* @param flag bit0= increase only upper estimation +*/ +int Xorriso_estimate_file_size(struct XorrisO *xorriso, struct FindjoB *job, + char *basename, mode_t st_mode, off_t st_size, int flag) +{ + off_t upper, lower, size; + + lower = 3 * strlen(basename) + 34; /* >>> + minimum RR ? */ + upper = 3 * strlen(basename) + 2048; + if(S_ISREG(st_mode)) { + size= ((st_size + (off_t) 2047) / (off_t) 2048) * (off_t) 2048; + lower+= size; + upper+= size; + } else if(S_ISDIR(st_mode)) { + upper+= 4096; + } + job->estim_upper_size+= upper; + if(!(flag & 1)) + job->estim_lower_size+= lower; + return(1); +} + + +int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error,int flag) +{ + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", iso_error, "Cannot create iter", 0, + "FATAL", 1); + sprintf(xorriso->info_text, "Cannot create IsoDirIter object"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(1); +} + + +/* The caller shall make no assumptions about the meaning of iter, node_array, + node_count, node_idx ! They are just opaque handles for which the caller + provides the memory of proper type. + @param flag bit0= initialize iteration + bit1= action needs full freedom of object manipulation + bit2= action needs LBA sorted iteration + bit31= end iteration (mandatory !) +*/ +int Xorriso_findi_iter(struct XorrisO *xorriso, IsoDir *dir_node, off_t *mem, + IsoDirIter **iter, + IsoNode ***node_array, int *node_count, int *node_idx, + IsoNode **iterated_node, int flag) +{ + int ret, i; + IsoNode *node; + off_t new_mem= 0; + char mem_text[80], limit_text[80]; + + if(flag&1) { + *node_array= NULL; + *node_count= -1; + *node_idx= 0; + *iter= NULL; + ret= iso_dir_get_children(dir_node, iter); + if(ret<0) { +cannot_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + return(-1); + } + if((flag&2)|(flag&4)) { + /* copy list of nodes and prepare soft iterator */ + *node_count= 0; + while(iso_dir_iter_next(*iter, &node) == 1) + (*node_count)++; + iso_dir_iter_free(*iter); + *iter= NULL; + + new_mem= ((*node_count)+1) * sizeof(IsoNode *); + if(new_mem > xorriso->temp_mem_limit) { + Sfile_scale((double) new_mem, mem_text, 5,1e4, 0); + Sfile_scale((double) xorriso->temp_mem_limit, limit_text, 5,1e4, 0); + sprintf(xorriso->info_text, + "Stacked directory snapshots exceed -temp_mem_limit (%s > %s)", + mem_text, limit_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + *node_count= -1; + return(-1); + } + (*node_array)= (IsoNode **) calloc((*node_count)+1, sizeof(IsoNode *)); + if(*node_array == NULL) { + sprintf(xorriso->info_text, + "Could not allocate inode list of %.f bytes", + ((double) (*node_count)+1) * (double) sizeof(IsoNode *)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + *node_count= -1; + return(-1); + } + *mem= new_mem; + ret= iso_dir_get_children(dir_node, iter); + if(ret<0) + goto cannot_iter; + while(iso_dir_iter_next(*iter, &node) == 1 && *node_idx < *node_count) { + (*node_array)[*node_idx]= node; + iso_node_ref(node); + (*node_idx)++; + } + iso_dir_iter_free(*iter); + *iter= NULL; + *node_count= *node_idx; + *node_idx= 0; + if((flag&4) && *node_count>1) + qsort(*node_array, *node_count, sizeof(IsoNode *), + Xorriso__node_lba_cmp); + } + } + + if(flag&(1<<31)) { + if(*node_count>=0 && *node_array!=NULL) { + for(i= 0; i<*node_count; i++) + iso_node_unref((*node_array)[i]); + free(*node_array); + *node_array= NULL; + *node_count= -1; + *node_idx= 0; + } else { + if(*iter!=NULL) + iso_dir_iter_free(*iter); + *iter= NULL; + } + } + + if(flag&(1|(1<<31))) + return(1); + if(*node_count>=0) { + /* return next node_array element */ + if(*node_idx>=*node_count) + return(0); + *iterated_node= (*node_array)[*node_idx]; + (*node_idx)++; + } else { + ret= iso_dir_iter_next(*iter, iterated_node); + return(ret == 1); + } + return(1); +} + + +/* @param flag bit0= not a command parameter (directory iteration or recursion) + bit1= do not count deleted files with rm and rm_r + @return <=0 error, + 1=ok + 2=ok, node has been deleted, + 3=ok, do not dive into directory (e.g. because it is a split file) +*/ +int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, + IsoDirIter *boss_iter, off_t boss_mem, + char *abs_path, char *show_path, + IsoNode *node, int depth, int flag) +{ + int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0; + uid_t user= 0; + gid_t group= 0; + time_t date= 0; + mode_t mode_or= 0, mode_and= ~1; + char *target, *text_2, *iso_prefix, md5[16], *basename; + struct FindjoB *subjob; + struct stat dir_stbuf, stbuf; + + action= Findjob_get_action_parms(job, &target, &text_2, &user, &group, + &mode_and, &mode_or, &type, &date, &subjob, 0); + if(action<0) + action= 0; + + hflag= 16*!(flag&2); + ret= 1; + if(action==1) { /* rm (including rmdir) */ + ret= Xorriso_fake_stbuf(xorriso, abs_path, &dir_stbuf, &node, 1); + if(ret>0) { + if(S_ISDIR(dir_stbuf.st_mode)) + hflag= 2; + ret= Xorriso_rmi(xorriso, boss_iter, boss_mem, abs_path, hflag); + deleted= 1; + } + } else if(action==2) { /* rm_r */ + ret= Xorriso_rmi(xorriso, boss_iter, boss_mem, abs_path, 1|hflag); + deleted= 1; + } else if(action==3) { + + /* >>> mv target */; + + } else if(action==4) { /* chown */ + ret= Xorriso_set_uid(xorriso, abs_path, user, 0); + } else if(action==5) { /* chgrp */ + ret= Xorriso_set_gid(xorriso, abs_path, group, 0); + } else if(action==6) { /* chmod */ + ret= Xorriso_set_st_mode(xorriso, abs_path, mode_and, mode_or, 0); + } else if(action==7) { /* alter_date */ + ret= Xorriso_set_time(xorriso, abs_path, date, type&7); + } else if(action==8) { /* lsdl */ + ret= Xorriso_ls_filev(xorriso, "", 1, &abs_path, (off_t) 0, 1|2|8); + } else if(action>=9 && action<=13) { /* actions which have own findjobs */ + Findjob_set_start_path(subjob, abs_path, 0); + ret= Xorriso_findi(xorriso, subjob, boss_iter, boss_mem, NULL, + abs_path, &dir_stbuf, depth, 1); + } else if(action==14 || action==17 || action == 41) { + /* compare , update , update_merge */ + Findjob_get_start_path(job, &iso_prefix, 0); + ret= Xorriso_find_compare(xorriso, (void *) boss_iter, (void *) node, + abs_path, iso_prefix, target, + (action == 17 || action == 41) + | ((flag&1)<<1) | ((action == 41) << 2)); + if(ret==2) + deleted= 1; + if(ret==3) + no_dive= 1; + if(ret>=0) + ret= 1; + } else if(action==16 || action==18) { /* not_in_iso , add_missing */ + ; + } else if(action == 21) { /* report_damage */ + ret= Xorriso_report_damage(xorriso, show_path, node, 0); + } else if(action == 22) { + ret= Xorriso_report_lba(xorriso, show_path, node, 0); + } else if(action == 23) { /* internal: memorize path of last matching node */ + ret= Findjob_set_found_path(job, show_path, 0); + } else if(action == 24) { + ret= Xorriso_getfacl(xorriso, (void *) node, show_path, NULL, 0); + } else if(action == 25) { + if(target == NULL || target[0] || text_2 == NULL || text_2[0]) + ret= Xorriso_setfacl(xorriso, (void *) node, show_path, target, text_2,0); + } else if(action == 26) { + ret= Xorriso_getfattr(xorriso, (void *) node, show_path, NULL, 0); + } else if(action == 27) { + ret= Xorriso_path_setfattr(xorriso, (void *) node, show_path, + target, strlen(text_2), text_2, 0); + } else if(action == 28) { /* set_filter */ + ret= Xorriso_set_filter(xorriso, (void *) node, show_path, target, 1 | 2); + } else if(action == 29) { /* show_stream */ + ret= Xorriso_show_stream(xorriso, (void *) node, show_path, 1 | 2); + } else if(action == 30) { /* internal: count */ + xorriso->node_counter++; + } else if(action == 31) { /* internal: register */ + if(xorriso->node_counter < xorriso->node_array_size) { + xorriso->node_array[xorriso->node_counter++]= (void *) node; + iso_node_ref(node); /* In case node gets deleted from tree during + the lifetime of xorriso->node_array */ + } + } else if(action == 32) { /* internal: widen_hardlinks disk_equiv */ + Findjob_get_start_path(job, &iso_prefix, 0); + ret= Xorriso_widen_hardlink(xorriso, (void *) boss_iter, node, abs_path, + iso_prefix, target, 0); + if(ret==2) + deleted= 1; + } else if(action == 33) { /* get_any_xattr */ + ret= Xorriso_getfattr(xorriso, (void *) node, show_path, NULL, 8); + } else if(action == 34) { /* get_md5 */ + ret= Xorriso_get_md5(xorriso, (void *) node, show_path, md5, 0); + if(ret >= 0) + ret= 1; + } else if(action == 35) { /* check_md5 */ + ret= Xorriso_check_md5(xorriso, (void *) node, show_path, 2); + if(ret == 0) + xorriso->find_check_md5_result|= 1; + else if(ret < 0) + xorriso->find_check_md5_result|= 2; + else if(ret == 1) + xorriso->find_check_md5_result|= 8; + else if(ret == 2) + xorriso->find_check_md5_result|= 4; + if(ret >= 0) + ret= 1; + } else if(action == 36) { /* make_md5 */ + ret= Xorriso_make_md5(xorriso, (void *) node, show_path, 0); + if(ret >= 0) + ret= 1; + } else if(action == 37) { /* mkisofs_r */ + ret= Xorriso_mkisofs_lower_r(xorriso, node, 0); + } else if(action == 38) { /* sort_weight */ + iso_node_set_sort_weight(node, type); + } else if(action == 39) { /* hide */ + Xorriso_set_hidden(xorriso, node, NULL, type, 0); + } else if(action == 40) { /* estimate_size */ + basename= strrchr(abs_path, '/'); + if(basename != NULL) + basename++; + else + basename= abs_path; + ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1); + if(ret > 0) + ret= Xorriso_estimate_file_size(xorriso, job, basename, stbuf.st_mode, + stbuf.st_size, 0); + } else if(action == 42) { /* rm_merge */ + ret= Xorriso_mark_update_merge(xorriso, show_path, node, 2 | 4); + if(ret == 2) { + ret= Xorriso_rmi(xorriso, boss_iter, boss_mem, abs_path, 1|hflag); + sprintf(xorriso->info_text, "Deleted "); + Text_shellsafe(show_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + deleted= 1; + } + } else if(action == 43) { /* clear_merge */ + ret= Xorriso_mark_update_merge(xorriso, show_path, node, 2 | 4); + } else if(action == 44) { /* list_extattr */ + ret= Xorriso_list_extattr(xorriso, (void *) node, show_path, show_path, + target, 0); + } else { /* includes : 15 in_iso */ + Text_shellsafe(show_path, xorriso->result_line, 0); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + ret= 1; + } + if(ret<=0) + return(ret); + if(deleted) + return(2); + if(no_dive) + return(3); + return(1); +} + + +int Exprtest_match_disk_name(struct XorrisO *xorriso, struct ExprtesT *ftest, + IsoNode *node, int flag) + +{ + int ret; + char *disk_path= NULL, *npt; + regmatch_t name_match; + void *arg2; + + Xorriso_alloc_meM(disk_path, char, SfileadrL); + + ret= Xorriso_retrieve_disk_path(xorriso, node, disk_path, 0); + if(ret <= 0) + {ret= 0; goto ex;} + arg2= ftest->arg2; + npt= strrchr(disk_path, '/'); + if(npt != NULL) + npt++; + else + npt= disk_path; + ret= regexec(arg2, npt, 1, &name_match, 0); +ex:; + Xorriso_free_meM(disk_path); + return(!ret); +} + + +int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest, + void *node_pt, char *name, char *path, + struct stat *boss_stbuf, struct stat *stbuf, int flag) +/* +return: + <0 = error + 0 = does not match + 1 = does match + 2 = immediate decision : does not match + 3 = immediate decision : does match +*/ +{ + int value=0, ret, start_lba, end_lba; + int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i, mask; + void *arg1, *arg2; + char ft, *decision, md5[16]; + regmatch_t name_match; + off_t damage_start, damage_end, size; + void *xinfo_dummy; + IsoNode *node; + IsoStream *stream; + + if(ftest == NULL) + return(1); + + node= (IsoNode *) node_pt; + arg1= ftest->arg1; + arg2= ftest->arg2; + + if(node == NULL) { + if(ftest->test_type > 2 && ftest->test_type != 4) { + value= 0; + goto ex; + } + } + + switch(ftest->test_type) { + case 0: /* -false */ + value= 0; + + break; case 1: /* -name *arg1 (regex in *arg2) */ + ret= regexec(arg2, name, 1, &name_match, 0); + value= !ret; + + break; case 2: /* -type *arg1 */ + value= 1; + ft= *((char *) arg1); + if(ft!=0) { + if(S_ISBLK(stbuf->st_mode)) { + if(ft!='b') + value= 0; + } else if(S_ISCHR(stbuf->st_mode)) { + if(ft!='c') + value= 0; + } else if(S_ISDIR(stbuf->st_mode)) { + if(ft=='m') { + if(node != NULL) + value= 0; + else if(boss_stbuf==NULL) + value= 0; + else if(boss_stbuf->st_dev == stbuf->st_dev) + value= 0; + } else if(ft!='d') + value= 0; + } else if(S_ISFIFO(stbuf->st_mode)) { + if(ft!='p') + value= 0; + } else if(S_ISREG(stbuf->st_mode)) { + if(ft!='f' && ft!='-') + value= 0; + } else if(((stbuf->st_mode)&S_IFMT)==S_IFLNK) { + if(ft!='l') + value= 0; + } else if(((stbuf->st_mode)&S_IFMT)==S_IFSOCK) { + if(ft!='s') + value= 0; + } else if((flag & 1) && ((stbuf->st_mode) & S_IFMT) == Xorriso_IFBOOT) { + if(ft!='e' || node == NULL) + value= 0; + } else { + if(ft!='X') + value= 0; + } + } + + break; case 3: /* -damaged */; + value= Xorriso_file_eval_damage(xorriso, node, &damage_start, &damage_end, + 0); + if(value > 0) + value= 1; + + break; case 4: /* -lba_range *arg1 *arg2 */ + value= 1; + start_lba= *((int *) ftest->arg1); + end_lba= *((int *) ftest->arg2); + if(node == NULL) { + value= !(start_lba >= 0); + goto ex; + } + ret= Xorriso__start_end_lbas(node, &lba_count, + &file_start_lbas, &file_end_lbas, &size, 0); + if(ret <= 0) { + if(ret < 0) + Xorriso_process_msg_queues(xorriso, 0); + if(start_lba >= 0) + value= 0; + } else { + for(i= 0; i < lba_count; i++) { + if(start_lba >= 0) { + if(file_end_lbas[i] < start_lba || file_start_lbas[i] > end_lba) + value= 0; + } else { + if(file_end_lbas[i] >= -start_lba && file_start_lbas[i] <= -end_lba) + value= 0; + } + } + } + + break; case 5: /* -has_acl */ + ret = Xorriso_getfacl(xorriso, (void *) node, "", NULL, 2); + if(ret <= 0) { + value= -1; + Xorriso_process_msg_queues(xorriso, 0); + goto ex; + } + value= (ret == 1); + + break; case 6: /* -has_xattr */ + case 14: /* -has_any_xattr */ + ret = Xorriso_getfattr(xorriso, (void *) node, "", NULL, + 64 | (8 * (ftest->test_type == 14))); + if(ret < 0) { + value= -1; + Xorriso_process_msg_queues(xorriso, 0); + goto ex; + } + value= (ret > 0); + + break; case 7: /* -has_aaip */ + ret= iso_node_get_xinfo(node, aaip_xinfo_func, &xinfo_dummy); + if(ret < 0) { + value= -1; + Xorriso_process_msg_queues(xorriso, 0); + goto ex; + } + value= (ret > 0); + + break; case 8: /* -has_filter */ + value= 0; + if(LIBISO_ISREG(node)) { + stream= iso_file_get_stream((IsoFile *) node); + if(iso_stream_get_input_stream(stream, 0) != NULL) + value= 1; + } + + break; case 9: /* -wanted_node arg1 (for internal use) */ + value= (((IsoNode *) arg1) == node); + + break; case 10: /* -pending_data */ + value= 1; + if(!LIBISO_ISREG(node)) { + value= 0; + } else { + ret= Xorriso__file_start_lba(node, &start_lba, 0); + if(ret > 0 && start_lba >= 0) + value= 0; + } + + break; case 11: /* -decision */ + value= 2; + decision= (char *) arg1; + if(strcmp(decision, "yes") == 0 || strcmp(decision, "true") == 0) + value= 3; + + break; case 12: /* -prune */ + value= 1; + ftest->boss->prune= 1; + + break; case 13: /* -wholename *arg1 (regex in *arg2) */ + ret= regexec(arg2, path, 1, &name_match, 0); + value= !ret; + + break; case 15: /* -has_md5 */ + ret= Xorriso_get_md5(xorriso, node, path, md5, 1); + value= (ret > 0); + + break; case 16: /* -disk_name *arg1 (regex in *arg2) */ + value= !! Exprtest_match_disk_name(xorriso, ftest, node, 0); + + break; case 17: /* -hidden int *arg1 */ + value= 0; + ret= iso_node_get_hidden(node); + mask= *((int *) arg1) & 3; + if(mask == 0 && !(ret & (LIBISO_HIDE_ON_RR | LIBISO_HIDE_ON_JOLIET))) + value= 1; + else if(mask == 1 && (ret & LIBISO_HIDE_ON_RR)) + value= 1; + else if(mask == 2 && (ret & LIBISO_HIDE_ON_JOLIET)) + value= 1; + else if(mask == 3 && (ret & LIBISO_HIDE_ON_RR) && + (ret & LIBISO_HIDE_ON_JOLIET)) + value= 1; + + break; default: + + /* >>> complain about unknown test type */; + + value= -1; + + } + +ex:; + if(ftest->invert && value<=1 && value>=0) + value= !value; + if(file_start_lbas != NULL) + free((char *) file_start_lbas); + if(file_end_lbas != NULL) + free((char *) file_end_lbas); + return(value); +} + + +/* @return <0 = error , 0 = no match , 1 = match */ +int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job, + IsoNode *node, char *name, char *path, + struct stat *boss_stbuf, struct stat *stbuf, + int depth, int flag) +{ + int ret; + + job->prune= 0; + ret= Findjob_test_2(xorriso, job, node, name, path, boss_stbuf, stbuf, 1); + if(ret <= 0) + return(ret); + return(1); +} + + +int Xorriso_findi_headline(struct XorrisO *xorriso, struct FindjoB *job, + int flag) +{ + int action; + + action= Findjob_get_action(job, 0); + if(action == 21) { /* report_damage */ + sprintf(xorriso->result_line, "Report layout: %8s , %8s , %8s , %s\n", + "at byte", "Range", "Filesize", "ISO image path"); + Xorriso_result(xorriso, 0); + } else if(action == 22) { /* report_lba */ + sprintf(xorriso->result_line, + "Report layout: %2s , %8s , %8s , %8s , %s\n", + "xt", "Startlba", "Blocks", "Filesize", "ISO image path"); + Xorriso_result(xorriso, 0); + } + return(1); +} + + +/* @param flag bit0= recursion + bit1= do not count deleted files with rm and rm_r + bit2= do not dive into split file directories + (implicitly given with actions 14=compare and 17=update) + @return <=0 error, 1= ok , 2= dir node and path has been deleted +*/ +int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, + void *boss_iter, off_t boss_mem, + void *dir_node_generic, char *dir_path, + struct stat *dir_stbuf, int depth, int flag) +{ + int ret, action= 0, hflag, deleted= 0, no_dive= 0; + IsoDirIter *iter= NULL; + IsoDir *dir_node= NULL; + IsoNode *node, *iso_node; + IsoImage *volume= NULL; + struct stat stbuf; + char *name; + off_t mem; + IsoNode **node_array= NULL; + int node_count, node_idx; + char *path= NULL, *abs_path= NULL; + + if(xorriso->request_to_abort) + {ret= 0; goto ex;} + + path= malloc(SfileadrL); + abs_path= malloc(SfileadrL); + if(path==NULL || abs_path==NULL) { + Xorriso_no_malloc_memory(xorriso, &path, 0); + {ret= -1; goto ex;} + } + + action= Findjob_get_action(job, 0); + if(action<0) + action= 0; + if(!(flag & 1)) + Xorriso_findi_headline(xorriso, job, 0); + + dir_node= (IsoDir *) dir_node_generic; + if(dir_node==NULL) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + {ret= -1; goto ex;} + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, dir_path, path, 1|2|4); + if(ret<=0) + goto ex; + ret= Xorriso_node_from_path(xorriso, volume, path, &iso_node, 0); + dir_node= (IsoDir *) iso_node; + if(ret<=0) + {ret= 0; goto ex;} + ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1); + if(ret<=0) + goto ex; + + name= strrchr(dir_path, '/'); + if(name==NULL) + name= dir_path; + else + name++; + + ret= Xorriso_findi_test(xorriso, job, iso_node, name, path, NULL, dir_stbuf, + depth, 0); + if(ret<0) + goto ex; + if(job->prune) + no_dive= 1; + if(ret>0) { + iso_node_ref(iso_node); /* protect from real disposal */ + ret= Xorriso_findi_action(xorriso, job, + (IsoDirIter *) boss_iter, boss_mem, + path, dir_path, iso_node, depth, + flag&(1|2)); + deleted= (iso_node_get_parent(iso_node) == NULL); /* still in tree ? */ + iso_node_unref(iso_node); /* eventually do real disposal */ + if(ret<=0) + goto ex; + if(xorriso->request_to_abort) + {ret= 0; goto ex;} + if(ret==2 || deleted) { + /* re-determine dir_node in case it has a new persona */ + ret= Xorriso_node_from_path(xorriso, volume, path, &iso_node, 1); + if(ret==0) { + deleted= 1; + {ret= 2; goto ex;} + } + if(ret<0) + {ret= 0; goto ex;} + dir_node= (IsoDir *) iso_node; + ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1); + if(ret<=0) + goto ex; + } + if(ret==3) + no_dive= 1; + } + } + if(no_dive || !LIBISO_ISDIR((IsoNode *) dir_node)) + {ret= 1; goto ex;} + if(action == 14 || action == 17 || (flag & 4)) + if(Xorriso_is_split(xorriso, dir_path, (IsoNode *) dir_node, 1)>0) + {ret= 1; goto ex;} + + mem= boss_mem; + hflag= 1; + if(action==1 || action==2 || action==3 || action==17 || action == 28 || + action == 32 || action == 41 || action == 42) + hflag|= 2; /* need freedom to manipulate image */ + if(action==14 || action==17 || action == 28 || action == 35 || action == 36 || + action == 41) + hflag|= 4; /* need LBA sorted iteration for good data reading performance */ + ret= Xorriso_findi_iter(xorriso, dir_node, &mem, + &iter, &node_array, &node_count, &node_idx, + &node, hflag); + if(ret<=0) + goto ex; + while(1) { + ret= Xorriso_findi_iter(xorriso, dir_node, &mem, &iter, + &node_array, &node_count, &node_idx, &node, 0); + if(ret<0) + goto ex; + if(ret==0) + break; + name= (char *) iso_node_get_name(node); + ret= Xorriso_make_abs_adr(xorriso, dir_path, name, path, 4); + if(ret<=0) + goto ex; + ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1); + if(ret<0) + goto ex; + if(ret==0) + continue; + +/* ??? This seems to be redundant with the single test above + ??? Should i dive in unconditionally and leave out test and action here ? + ??? Then do above test unconditionally ? + --- Seems that the current configuration represents the special + handling of the find start path with mount points. Dangerous to change. +*/ + + ret= Xorriso_findi_test(xorriso, job, node, name, path, dir_stbuf, &stbuf, + depth, 0); + if(ret<0) + goto ex; + if(job->prune) + no_dive= 1; + if(ret>0) { + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|2|4); + if(ret<=0) + goto ex; + ret= Xorriso_findi_action(xorriso, job, iter, mem, + abs_path, path, node, depth, 1|(flag&2)); + if(xorriso->request_to_abort) + {ret= 0; goto ex;} + if(ret==2) { /* node has been deleted */ + /* re-determine node in case it has a new persona */ + if(volume==NULL) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + {ret= -1; goto ex;} + } + ret= Xorriso_node_from_path(xorriso, volume, abs_path, &node, 1); + if(ret==0) + continue; + if(ret<0) + {ret= 0; goto ex;} + ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1); + if(ret<0) + goto ex; + if(ret==0) + continue; + } + no_dive= (ret==3); + if(ret<=0) { + if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) + goto ex; + } + } + + if(S_ISDIR(stbuf.st_mode) && !no_dive) { + ret= Xorriso_findi(xorriso, job, (void *) iter, mem, + (void *) node, path, &stbuf, depth+1, flag|1); + if(ret<0) + goto ex; + } + } + + ret= 1; +ex:; + if(path!=NULL) + free(path); + if(abs_path!=NULL) + free(abs_path); + Xorriso_process_msg_queues(xorriso,0); + + Xorriso_findi_iter(xorriso, dir_node, &mem, &iter, &node_array, &node_count, + &node_idx, &node, (1<<31)); + if(ret<=0) + return(ret); + if(deleted) + return(2); + return(1); +} + + +/* @param flag bit0= do not dive into trees + bit1= do not perform job->action on resulting node array + bit2= do not free node_array after all actions are done +*/ +int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job, + off_t boss_mem, int filec, char **filev, int flag) +{ + int i, ret, find_flag= 0; + struct FindjoB array_job, *proxy_job= NULL, *hindmost= NULL, *hmboss= NULL; + struct stat dir_stbuf; + IsoNode *node; + char *abs_path= NULL; + off_t mem_needed= 0; + + Xorriso_alloc_meM(abs_path, char, SfileadrL); + + array_job.start_path= NULL; + + if(job->action == 14 || job->action == 17) + find_flag|= 4; + if(job->action>=9 && job->action<=13) { /* actions which have own findjobs */ + /* array_job replaces the hindmost job in the chain */ + for(hindmost= job; hindmost->subjob != NULL; hindmost= hindmost->subjob) + hmboss= hindmost; + if(hmboss == NULL) + {ret= -1; goto ex;} + memcpy(&array_job, hindmost, sizeof(struct FindjoB)); + hmboss->subjob= &array_job; + proxy_job= job; + } else { + memcpy(&array_job, job, sizeof(struct FindjoB)); + proxy_job= &array_job; + hindmost= job; + } + array_job.start_path= NULL; /* is owned by the original, not by array_job */ + + /* Count matching nodes */ + Xorriso_destroy_node_array(xorriso, 0); + array_job.action= 30; /* internal: count */ + for(i= 0; i < filec; i++) { + if(flag & 1) { + xorriso->node_counter++; + continue; + } + ret= Findjob_set_start_path(proxy_job, filev[i], 0); + if(ret <= 0) + goto ex; + ret= Xorriso_findi(xorriso, proxy_job, NULL, boss_mem, NULL, + filev[i], &dir_stbuf, 0, find_flag); + if(ret <= 0) + goto ex; + } + if(xorriso->node_counter <= 0) + {ret= 1; goto ex;} + + mem_needed= boss_mem + xorriso->node_counter * sizeof(IsoNode *); + if(!(flag &1)) { + ret= Xorriso_check_temp_mem_limit(xorriso, mem_needed, 0); + if(ret <= 0) { + /* Memory curbed : Perform unsorted find jobs */ + if(hmboss != NULL) + hmboss->subjob= hindmost; + for(i= 0; i < filec; i++) { + ret= Findjob_set_start_path(job, filev[i], 0); + if(ret <= 0) + goto ex; + ret= Xorriso_findi(xorriso, job, NULL, boss_mem, NULL, + filev[i], &dir_stbuf, 0, find_flag); + if(ret <= 0) + if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) + goto ex; + } + {ret= 1; goto ex;} + } + } + + /* Copy matching nodes into allocated array */ + ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, 0, 0); + if(ret <= 0) + goto ex; + array_job.action= 31; /* internal: register */ + xorriso->node_counter= 0; + for(i= 0; i < filec; i++) { + if(flag & 1) { + ret= Xorriso_get_node_by_path(xorriso, filev[i], NULL, &node, 0); + if(ret <= 0) + goto ex; + if(xorriso->node_counter < xorriso->node_array_size) { + xorriso->node_array[xorriso->node_counter++]= (void *) node; + iso_node_ref(node); + } + continue; + } + ret= Findjob_set_start_path(proxy_job, filev[i], 0); + if(ret <= 0) + goto ex; + ret= Xorriso_findi(xorriso, proxy_job, NULL, mem_needed, NULL, + filev[i], &dir_stbuf, 0, find_flag); + if(ret <= 0) + goto ex; + } + + Xorriso_sort_node_array(xorriso, 0); + if(flag & 2) + {ret= 1; goto ex;} + + /* Perform job->action on xorriso->node_array */ + + /* Headlines of actions report_damage , report_lba */; + Xorriso_findi_headline(xorriso, job, 0); + + for(i= 0; i < xorriso->node_counter; i++) { + node= xorriso->node_array[i]; + ret= Xorriso_path_from_node(xorriso, node, abs_path, 0); + if(ret < 0) + goto ex; + if(ret == 0) + continue; /* node is deleted from tree meanwhile */ + + ret= Xorriso_findi_action(xorriso, hindmost, NULL, (off_t) 0, + abs_path, abs_path, node, 0, 1); + if(ret <= 0 || xorriso->request_to_abort) + if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) + goto ex; + } + + ret= 1; +ex:; + if(!(flag & (2 | 4))) + Xorriso_destroy_node_array(xorriso, 0); + if(hmboss != NULL) + hmboss->subjob= hindmost; + if(array_job.start_path != NULL) + free(array_job.start_path); + Xorriso_free_meM(abs_path); + return(ret); +} + + +int Xorriso_all_node_array(struct XorrisO *xorriso, int addon_nodes, int flag) +{ + int ret; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Findjob_new(&job, "/", 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "xorriso", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_target(job, 30, NULL, 0); + Xorriso_destroy_node_array(xorriso, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, NULL, "/", + &dir_stbuf, 0, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_new_node_array(xorriso, xorriso->temp_mem_limit, addon_nodes, 0); + if(ret <= 0) + goto ex; + Findjob_set_action_target(job, 31, NULL, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, NULL, "/", + &dir_stbuf, 0, 0); + if(ret <= 0) + goto ex; + ret= 1; +ex:; + Findjob_destroy(&job, 0); + return(ret); +} + + +int Xorriso_perform_acl_from_list(struct XorrisO *xorriso, char *file_path, + char *uid, char *gid, char *acl, int flag) +{ + int ret, zero= 0; + uid_t uid_number; + gid_t gid_number; + + /* Set group and owner */ + if(gid[0]) { + ret= Xorriso_convert_gidstring(xorriso, gid, &gid_number, 0); + if(ret<=0) + return(ret); + ret= Xorriso_set_gid(xorriso, file_path, gid_number, 0); + if(ret<=0) + return(ret); + } + if(uid[0]) { + ret= Xorriso_convert_uidstring(xorriso, uid, &uid_number, 0); + if(ret<=0) + return(ret); + ret= Xorriso_set_uid(xorriso, file_path, uid_number, 0); + if(ret<=0) + return(ret); + } + ret= Xorriso_option_setfacli(xorriso, acl, 1, &file_path, &zero, 0); + if(ret <= 0) + return(ret); + return(1); +} + + +/* + @param flag bit0= do not perform setfattr but only check input +*/ +int Xorriso_path_setfattr(struct XorrisO *xorriso, void *in_node, char *path, + char *name, size_t value_length, char *value, int flag) +{ + int ret, hflag; + size_t num_attrs= 1; + char *name_pt; + + hflag= 2; + name_pt= name; + if(name[0] == 0) { + sprintf(xorriso->info_text, + "-setfattr: Empty attribute name is not allowed"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } else if(strcmp(name, "--remove-all") == 0) { + if(value[0]) { + sprintf(xorriso->info_text, + "-setfattr: Value is not empty with pseudo name --remove-all"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + num_attrs= 0; + hflag= 0; + } else if(name[0] == '-') { + name_pt++; + hflag|= 4; + } else if(name[0] == '=' || name[0] == '+') { + name_pt++; + } + if(flag & 1) + return(1); + ret= Xorriso_setfattr(xorriso, in_node, path, + num_attrs, &name_pt, &value_length, &value, hflag); + return(ret); +} + + +/* Warning: The text content of lst gets mangled by 0s and unescaping. +*/ +int Xorriso_perform_attr_from_list(struct XorrisO *xorriso, char *path, + struct Xorriso_lsT *lst_start, int flag) +{ + int ret, eaten; + char *valuept, *ept, *line, **names= NULL, **values= NULL; + size_t num_attr= 0, *value_lengths= NULL, v_len; + struct Xorriso_lsT *lst; + + for(lst= lst_start; lst != NULL; lst= Xorriso_lst_get_next(lst, 0)) + num_attr++; + if(num_attr == 0) { + ret= Xorriso_setfattr(xorriso, NULL, path, num_attr, NULL, NULL, NULL, 0); + goto ex; + } + + names= calloc(num_attr, sizeof(char *)); + if(names == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + value_lengths= calloc(num_attr, sizeof(size_t)); + if(value_lengths== NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + values= calloc(num_attr, sizeof(char *)); + if(values== NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + + num_attr= 0; + for(lst= lst_start; lst != NULL; lst= Xorriso_lst_get_next(lst, 0)) { + line= Xorriso_lst_get_text(lst, 0); + ept= strchr(line, '='); + if(ept == NULL) + continue; + /* Split into name and content */; + *ept= 0; + valuept= ept + 1; + + /* Strip quotes from value */ + v_len= strlen(valuept); + if(v_len < 2 || *valuept != '"' || *(valuept + v_len - 1) != '"') + continue; + *valuept= 0; + *(valuept + v_len - 1)= 0; + valuept++; + v_len-= 2; + + /* Unescape backslashes , values eventually with 0-bytes */ + ret= Sfile_bsl_interpreter(line, strlen(line), &eaten, 0); + if(ret <= 0) + continue; + ret= Sfile_bsl_interpreter(valuept, (int) v_len, &eaten, 2); + if(ret <= 0) + continue; + + names[num_attr]= line; + values[num_attr]= valuept; + value_lengths[num_attr]= v_len - eaten; + num_attr++; + } + ret= Xorriso_setfattr(xorriso, NULL, path, num_attr, names, + value_lengths, values, 0); +ex:; + if(names != NULL) + free(names); + if(value_lengths != NULL) + free(value_lengths); + if(values != NULL) + free(values); + return(ret); +} + + +int Xorriso__mark_update_xinfo(void *data, int flag) +{ + /* data is an int disguised as pointer. It does not point to memory. */ + return(1); +} + + +int Xorriso__mark_update_cloner(void *old_data, void **new_data, int flag) +{ + *new_data= NULL; + if(flag) + return(ISO_XINFO_NO_CLONE); + if(old_data == NULL) + return(0); + /* data is an int disguised as pointer. It does not point to memory. */ + *new_data= old_data; + return(0); +} + + +/* @param flag bit0= found on disk + bit1= inquire visit-found status: + 1=not visited, 2=not found, 3=found + bit2= with bit1: delete xinfo before returning status +*/ +int Xorriso_mark_update_merge(struct XorrisO *xorriso, char *path, + void *in_node, int flag) +{ + int ret; + void *xipt= NULL; + IsoNode *node; + + if(in_node == NULL) { + ret= Xorriso_node_from_path(xorriso, NULL, path, &node, 0); + if(ret <= 0) + return(ret); + } else + node= (IsoNode *) in_node; + ret= iso_node_get_xinfo(node, Xorriso__mark_update_xinfo, &xipt); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when looking for update_merge xinfo", + 0, "FAILURE", 1); + return(0); + } + if(flag & 2) { /* Inquire status and optionally delete xinfo */ + if(ret == 0) + return(1); + if(flag & 4) { + ret= iso_node_remove_xinfo(node, Xorriso__mark_update_xinfo); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when removing update_merge xinfo", + 0, "FAILURE", 1); + return(0); + } + } + if(((char *) &xipt)[0]) + return(3); + return(2); + } + /* xipt is a byte value disguised as void pointer */ + if(ret == 1) { + if(((char *) &xipt)[0]) + return(1); + if(!(flag & 1)) + return(1); + } else + ((char *) &xipt)[0]= 0; + if(flag & 1) + ((char *) &xipt)[0]= 1; + ret= iso_node_remove_xinfo(node, Xorriso__mark_update_xinfo); + if(ret < 0) + goto set_error; + ret= iso_node_add_xinfo(node, Xorriso__mark_update_xinfo, xipt); + if(ret <= 0) { +set_error:; + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when trying to set update_merge xinfo", + 0, "FAILURE", 1); + return(0); + } + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/iso_manip.h b/libisoburn/branches/1.1.8/xorriso/iso_manip.h new file mode 100644 index 00000000..30780f3b --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/iso_manip.h @@ -0,0 +1,74 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which manipulate the + libisofs tree model. +*/ + + +#ifndef Xorriso_pvt_iso_manip_includeD +#define Xorriso_pvt_iso_manip_includeD yes + + +int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf, + char *disk_path, IsoNode *node, int flag); + +int Xorriso_graft_split(struct XorrisO *xorriso, IsoImage *volume, + IsoDir *dir, char *disk_path, char *img_name, + char *nominal_source, char *nominal_target, + off_t size, IsoNode **node, int flag); + +int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, + IsoDir *dir, char *disk_path, char *img_name, + char *nominal_source, char *nominal_target, + off_t offset, off_t cut_size, + IsoNode **node, int flag); + +int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir, + char *img_dir_path, char *disk_dir_path, + struct LinkiteM *link_stack, int flag); + +int Xorriso_copy_implicit_properties(struct XorrisO *xorriso, IsoDir *dir, + char *full_img_path, char *img_path, char *full_disk_path, int flag); + +int Xorriso_mkisofs_lower_r(struct XorrisO *xorriso, IsoNode *node, int flag); + +int Xorriso_widen_hardlink(struct XorrisO *xorriso, void * boss_iter, + IsoNode *node, + char *abs_path, char *iso_prefix, char *disk_prefix, + int flag); + + +int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error, + int flag); + +int Xorriso_findi_iter(struct XorrisO *xorriso, IsoDir *dir_node, off_t *mem, + IsoDirIter **iter, + IsoNode ***node_array, int *node_count, int *node_idx, + IsoNode **iterated_node, int flag); + +int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, + IsoDirIter *boss_iter, off_t boss_mem, + char *abs_path, char *show_path, + IsoNode *node, int depth, int flag); + +int Xorriso_findi_headline(struct XorrisO *xorriso, struct FindjoB *job, + int flag); + +int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job, + off_t boss_mem, int filec, char **filev, int flag); + +int Xorriso_all_node_array(struct XorrisO *xorriso, int addon_nodes, int flag); + + +int Xorriso__file_start_lba(IsoNode *node, int *lba, int flag); + +int Xorriso__mark_update_xinfo(void *data, int flag); +int Xorriso__mark_update_cloner(void *old_data, void **new_data, int flag); + +#endif /* ! Xorriso_pvt_iso_manip_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/iso_tree.c b/libisoburn/branches/1.1.8/xorriso/iso_tree.c new file mode 100644 index 00000000..7f8eb89d --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/iso_tree.c @@ -0,0 +1,2442 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which access nodes of the + libisofs tree model. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + +#include "lib_mgt.h" +#include "iso_img.h" +#include "iso_tree.h" +#include "iso_manip.h" +#include "sort_cmp.h" + + +/* @param eff_path returns resulting effective path. + Must provide at least SfileadrL bytes of storage. + @param flag bit0= do not produce problem events (unless faulty path format) + bit1= work purely literally, do not use libisofs + bit2= (with bit1) this is an address in the disk world + bit3= return root directory as "/" and not as "" + bit4= (with bit2) determine type of disk file eff_path + and return 0 if not existing + bit5= (with bit3) this is not a parameter + bit6= insist in having an ISO image, even with bits1+2 + @return -1 = faulty path format, 0 = not found , + 1 = found simple node , 2 = found directory +*/ +int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd, + char *img_path, char eff_path[], int flag) +{ + int ret, is_dir= 0, done= 0; + IsoImage *volume; + IsoDir *dir= NULL; + IsoNode *node= NULL; + char *path= NULL, *apt, *npt, *cpt; + + Xorriso_alloc_meM(path, char, SfileadrL); + + if((flag&64) || !(flag&2)) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + } + + eff_path[0]= 0; + if(img_path[0]==0) { + if(flag&8) + strcpy(eff_path, "/"); + {ret= 2; goto ex;} /* root directory */ + } + + apt= npt= path; + if(img_path[0]!='/') { + strcpy(path, wd); + ret= Sfile_add_to_path(path, img_path, 0); + if(ret<=0) + goto much_too_long; + } else + if(Sfile_str(path, img_path, 0)<=0) + {ret= -1; goto ex;} + + if(path[0]!='/') { + sprintf(xorriso->info_text, + "Internal error: Unresolvable relative addressing in iso_rr_path '%s'", + img_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FATAL", 0); + {ret= -1; goto ex;} + } else if(path[1]==0) { + if(flag&8) + strcpy(eff_path, "/"); + {ret= 2; goto ex;} /* root directory */ + } + + for(npt= apt; !done; apt= npt+1) { + npt= strchr(apt, '/'); + if(npt==NULL) { + npt= apt+strlen(apt); + done= 1; + } else + *npt= 0; + if(*apt==0) { + *apt= '/'; + apt++; + if(done) + break; + continue; + } + if(strcmp(apt,".")==0) { + is_dir= 1; + continue; + } + if(strcmp(apt,"..")==0) { + if(!(flag&2)) { + node= (IsoNode *) dir; + if(node==NULL) { +bonked_root:; + sprintf(xorriso->info_text, + "Relative addressing in path exceeds root directory: "); + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= -1; goto ex;} + } + dir= iso_node_get_parent(node); + } + /* truncate eff_path */; + cpt= strrchr(eff_path, '/'); + if(cpt==NULL) /* ??? if not flag&2 then this is a bug */ + goto bonked_root; + *cpt= 0; + is_dir= 1; + continue; + } + ret= Sfile_add_to_path(eff_path, apt, 0); + if(ret<=0) { +much_too_long:; + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", + (int) (strlen(eff_path)+strlen(apt)+1)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= -1; goto ex;} + } + if(!(flag&2)) { + dir= (IsoDir *) node; + ret= Xorriso_node_from_path(xorriso, volume, eff_path, &node, flag&1); + if(ret<=0) + {ret= 0; goto ex;} + if(dir==NULL) /* could be false with "/dir/.." */ + dir= iso_node_get_parent(node); + is_dir= LIBISO_ISDIR(node); + } + } + if(flag&16) { + ret= Sfile_type(eff_path, + 1|(4*(xorriso->do_follow_links || (xorriso->do_follow_param && !(flag&32))) + )); + if(ret<0) + {ret= 0; goto ex;} + if(ret==2) + is_dir= 1; + } + ret= 1+!!is_dir; +ex:; + Xorriso_free_meM(path); + return(ret); +} + + +int Xorriso_get_node_by_path(struct XorrisO *xorriso, + char *in_path, char *eff_path, + IsoNode **node, int flag) +{ + int ret; + char *path= NULL; + IsoImage *volume; + + Xorriso_alloc_meM(path, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, in_path, path, 0); + if(ret<=0) + goto ex; + if(eff_path!=NULL) + strcpy(eff_path, path); + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + ret= Xorriso_node_from_path(xorriso, volume, path, node, 0); + if(ret<=0) + {ret= 0; goto ex;} + ret= 1; +ex:; + Xorriso_free_meM(path); + return(ret); +} + + +/* @param flag +*/ +int Xorriso_node_get_dev(struct XorrisO *xorriso, IsoNode *node, + char *path, dev_t *dev, int flag) +{ + *dev= iso_special_get_dev((IsoSpecial *) node); + return(1); +} + + +/* @param flag bit0= *node is already valid + bit1= add extra block for size estimation + bit2= complain loudely if path is missing in image + bit3= stbuf is to be used without eventual ACL + bit4= try to obtain a better st_nlink count if hardlinks + are enabled +*/ +int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf, + IsoNode **node, int flag) +{ + int ret, min_hl, max_hl, node_idx, i; + IsoImage *volume; + IsoBoot *bootcat; + uint32_t lba; + char *catcontent = NULL; + off_t catsize; + + memset((char *) stbuf, 0, sizeof(struct stat)); + if(!(flag&1)) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(-1); + ret= Xorriso_node_from_path(xorriso, volume, path, node, !(flag&4)); + if(ret<=0) + *node= NULL; + } + if(*node==NULL) + return(0); + + /* >>> stbuf->st_dev */ + /* >>> stbuf->st_ino */ + + if(flag & 8) + stbuf->st_mode= iso_node_get_perms_wo_acl(*node) & 07777; + else + stbuf->st_mode= iso_node_get_permissions(*node) & 07777; + if(LIBISO_ISDIR(*node)) + stbuf->st_mode|= S_IFDIR; + else if(LIBISO_ISREG(*node)) + stbuf->st_mode|= S_IFREG; + else if(LIBISO_ISLNK(*node)) + stbuf->st_mode|= S_IFLNK; + else if(LIBISO_ISCHR(*node)) { + stbuf->st_mode|= S_IFCHR; + Xorriso_node_get_dev(xorriso, *node, path, &(stbuf->st_rdev), 0); + } else if(LIBISO_ISBLK(*node)) { + stbuf->st_mode|= S_IFBLK; + Xorriso_node_get_dev(xorriso, *node, path, &(stbuf->st_rdev), 0); + } else if(LIBISO_ISFIFO(*node)) + stbuf->st_mode|= S_IFIFO; + else if(LIBISO_ISSOCK(*node)) + stbuf->st_mode|= S_IFSOCK; + else if(LIBISO_ISBOOT(*node)) + stbuf->st_mode|= Xorriso_IFBOOT; + + /* >>> With directories this should be : number of subdirs + 2 */ + /* >>> ??? How to obtain RR hardlink number for other types ? */ + /* This may get overriden farther down */ + stbuf->st_nlink= 1; + + stbuf->st_uid= iso_node_get_uid(*node); + stbuf->st_gid= iso_node_get_gid(*node); + + if(LIBISO_ISREG(*node)) + stbuf->st_size= iso_file_get_size((IsoFile *) *node)+ (2048 * !!(flag&2)); + else if(LIBISO_ISBOOT(*node)) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret <= 0) + return(-1); + ret= iso_image_get_bootcat(volume, &bootcat, &lba, &catcontent, &catsize); + if(catcontent != NULL) + free(catcontent); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + return(-1); + } + stbuf->st_size= catsize; + } else + stbuf->st_size= 0; + + stbuf->st_blksize= 2048; + stbuf->st_blocks= stbuf->st_size / (off_t) 2048; + if(stbuf->st_blocks * (off_t) 2048 != stbuf->st_size) + stbuf->st_blocks++; + + stbuf->st_atime= iso_node_get_atime(*node); + stbuf->st_mtime= iso_node_get_mtime(*node); + stbuf->st_ctime= iso_node_get_ctime(*node); + + if(LIBISO_ISDIR(*node) || (xorriso->ino_behavior & 1) || (!(flag & 16)) || + xorriso->hln_array == NULL) + return(1); + + /* Try to obtain a better link count */ + ret= Xorriso_search_hardlinks(xorriso, *node, &node_idx, &min_hl, &max_hl, 0); + if(ret < 0) + return(ret); + if(ret > 0 && node_idx >= 0) { + for(i= min_hl; i <= max_hl; i++) { + if(i == node_idx) + continue; + /* Check whether node is still valid */ + if(iso_node_get_parent(xorriso->hln_array[i]) != NULL) + stbuf->st_nlink++; + } + } + return(1); +} + + +/* @param flag >>> bit0= follow links (i.e. stat() rather than lstat() + bit1= do not return -2 on severe errors + bit2= complain loudely if path is missing in image +*/ +int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf, + int flag) +{ + int ret; + IsoNode *node; + + if(flag&1) { + + /* >>> follow link in ISO image */; + + } + + ret= Xorriso_fake_stbuf(xorriso, path, stbuf, &node, flag&4); + if(ret>0) + return(0); + if(ret<0 && !(flag&2)) + return(-2); + return(-1); +} + + +int Xorriso_node_is_valid(struct XorrisO *xorriso, IsoNode *in_node, int flag) +{ + IsoNode *node, *parent; + + for(node= in_node; 1; node= parent) { + parent= (IsoNode *) iso_node_get_parent(node); + if(parent == node) + break; + if(parent == NULL) + return(0); /* Node is not in the tree (any more) */ + } + return(1); +} + + +int Xorriso_path_from_node(struct XorrisO *xorriso, IsoNode *in_node, + char path[SfileadrL], int flag) +{ + int ret, i, comp_count= 0; + IsoNode *node, *parent, **components= NULL; + char *wpt, *npt; + + for(node= in_node; 1; node= parent) { + parent= (IsoNode *) iso_node_get_parent(node); + if(parent == node) + break; + if(parent == NULL) + return(0); /* Node is not in the tree (any more) */ + comp_count++; + } + if(comp_count == 0) { + strcpy(path, "/"); + return(1); + } + components= calloc(comp_count, sizeof(IsoNode *)); + if(components == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + i= comp_count; + for(node= in_node; 1; node= parent) { + parent= (IsoNode *) iso_node_get_parent(node); + if(parent == node) + break; + components[--i]= node; + } + + wpt= path; + for(i= 0; i < comp_count; i++) { + npt= (char *) iso_node_get_name(components[i]); + if((wpt - path) + strlen(npt) + 1 >= SfileadrL) { + + /* >>> path is getting much too long */; + + ret= -1; goto ex; + } + *(wpt++)= '/'; + strcpy(wpt, npt); + wpt+= strlen(npt); + *wpt= 0; + } + ret= 1; +ex:; + if(components != NULL) + free(components); + return(ret); +} + + +/* <<< The lookup from node pointer will be done by Xorriso_path_from_node() + (Currently it runs a full tree traversal) + Parameter node and flag bit0 will vanish then +*/ +/* @param flag bit0= use lba rather than node pointer +*/ +int Xorriso_path_from_lba(struct XorrisO *xorriso, IsoNode *node, int lba, + char path[SfileadrL], int flag) +{ + int ret; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + char *found_path; + + path[0]= 0; + if((flag & 1) && lba <= 0) + return(0); + + ret= Findjob_new(&job, "/", 0); + if(ret <= 0) { + Xorriso_no_findjob(xorriso, "path_from_node", 0); + return(ret); + } + if(flag & 1) + Findjob_set_lba_range(job, lba, 1, 0); + else + Findjob_set_wanted_node(job, (void *) node, 0); + Findjob_set_action_found_path(job, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, "/", &dir_stbuf, 0, 0); + if(ret > 0) { + ret= 1; + Findjob_get_found_path(job, &found_path, 0); + if(found_path == NULL) + ret= 0; + else if(Sfile_str(path, found_path, 0) <= 0) + ret= -1; + } + Findjob_destroy(&job, 0); + return(ret); +} + + +/* @param flag bit0= in_node is valid, do not resolve iso_adr + bit2= recognize and parse split parts despite + xorrio->split_size <= 0 +*/ +int Xorriso_identify_split(struct XorrisO *xorriso, char *iso_adr, + void *in_node, + struct SplitparT **parts, int *count, + struct stat *total_stbuf, int flag) +{ + int ret, i, incomplete= 0, overlapping= 0; + int partno, total_parts, first_total_parts= -1; + off_t offset, bytes, total_bytes, first_total_bytes= -1, first_bytes= -1; + off_t size, covered; + + IsoImage *volume; + IsoDir *dir_node; + IsoDirIter *iter= NULL; + IsoNode *node; + char *name; + struct stat stbuf, first_stbuf; + + *count= 0; + *parts= NULL; + + if(xorriso->split_size <= 0 && !(flag & 4)) + return(0); + + if(flag&1) { + node= (IsoNode *) in_node; + } else { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(-1); + ret= Xorriso_node_from_path(xorriso, volume, iso_adr, &node, 1); + if(ret<=0) + return(-1); + } + if(!LIBISO_ISDIR(node)) + return(0); + dir_node= (IsoDir *) node; + + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) { +cannot_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + return(-1); + } + + for(i= 0; iso_dir_iter_next(iter, &node) == 1; i++) { + name= (char *) iso_node_get_name(node); + ret= Splitpart__parse(name, &partno, &total_parts, + &offset, &bytes, &total_bytes, 0); + if(ret<=0) + {ret= 0; goto ex;} + if(i==0) { + first_total_parts= total_parts; + first_bytes= bytes; + first_total_bytes= total_bytes; + Xorriso_fake_stbuf(xorriso, "", &first_stbuf, &node, 1); + size= first_stbuf.st_size; + } else { + if(first_total_parts!=total_parts || first_total_bytes!=total_bytes || + (first_bytes!=bytes && partno!=total_parts)) + {ret= 0; goto ex;} + Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1); + if(first_stbuf.st_mode != stbuf.st_mode || + first_stbuf.st_uid != stbuf.st_uid || + first_stbuf.st_gid != stbuf.st_gid || + first_stbuf.st_mtime != stbuf.st_mtime || + first_stbuf.st_ctime != stbuf.st_ctime) + {ret= 0; goto ex;} + size= stbuf.st_size; + } + /* check for plausible size */ + if(!((partno != total_parts && size == bytes) || + (partno == total_parts && size <= bytes))) + {ret= 0; goto ex;} + if(offset != first_bytes * (off_t) (partno - 1)) + {ret= 0; goto ex;} + (*count)++; + } + if(*count <= 0 || *count != first_total_parts) + {ret= 0; goto ex;} + + ret= Splitparts_new(parts, (*count)+1, 0); /* (have one end marker item) */ + if(ret<=0) + return(ret); + + iso_dir_iter_free(iter); + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) + goto cannot_iter; + for(i= 0; i<*count; i++) { + ret= iso_dir_iter_next(iter, &node); + if(ret!=1) + break; + name= (char *) iso_node_get_name(node); + ret= Splitpart__parse(name, &partno, &total_parts, + &offset, &bytes, &total_bytes, 0); + if(ret<=0) + {ret= 0; goto ex;} + ret= Splitparts_set(*parts, i, name, partno, total_parts, offset, bytes, + total_bytes, 0); + if(ret<=0) + goto ex; + } + + Splitparts_sort(*parts, *count, 0); + + covered= 0; + for(i= 0; i<*count; i++) { + Splitparts_get(*parts, i, &name, &partno, &total_parts, &offset, &bytes, + &total_bytes, 0); + if(offset>covered) + incomplete= 1; + else if(offset covered) + covered= offset+bytes; + } + if(total_bytes>covered) + incomplete= 1; + memcpy(total_stbuf, &first_stbuf, sizeof(struct stat)); + total_stbuf->st_size= total_bytes; + ret= !(overlapping || incomplete); +ex:; + if(iter!=NULL) + iso_dir_iter_free(iter); + return(ret); +} + + +/* @param flag bit0= node is valid, do not resolve path + bit1= insist in complete collection of part files +*/ +int Xorriso_is_split(struct XorrisO *xorriso, char *path, void *node, + int flag) +{ + struct SplitparT *split_parts= NULL; + int split_count= 0, ret; + struct stat stbuf; + + ret= Xorriso_identify_split(xorriso, path, node, &split_parts, + &split_count, &stbuf, flag & 3); + if(split_parts!=NULL) + Splitparts_destroy(&split_parts, split_count, 0); + return(ret>0); +} + + +/* @param node Opaque handle to IsoNode which is to be inquired instead of path if it is not NULL. + @param path is used as address if node is NULL. + @param acl_text if acl_text is not NULL, then *acl_text will be set to the + ACL text (without comments) of the file object. In this + case it finally has to be freed by the caller. + @param flag bit0= do not report to result but only retrieve ACL text + bit1= check for existence of true ACL (not fabricated), + do not allocate and set acl_text but return 1 or 2 + bit2-3: what ALC to retrieve: + 0= "access" and "default", mark "default:" + 1= "access" only + 2= "default" only, do not mark "default:" + bit4= get "access" ACL only if not trivial + @return 2 ok, no ACL available, eventual *acl_text will be NULL + 1 ok, ACL available, eventual *acl_text stems from malloc() + <=0 error +*/ +int Xorriso_getfacl(struct XorrisO *xorriso, void *in_node, char *path, + char **acl_text, int flag) +{ + int ret, d_ret, result_len= 0, pass, what; + IsoNode *node; + char *text= NULL, *d_text= NULL, *cpt, *npt; + uid_t uid; + gid_t gid; + struct passwd *pwd; + struct group *grp; + + what= (flag >> 2) & 3; + if(acl_text != NULL) + *acl_text= NULL; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + goto ex; + } + ret= iso_node_get_acl_text(node, &text, &d_text, flag & 16); + d_ret= (d_text != NULL); + if(ret < 0 || d_ret < 0) { + if(path != NULL && path[0] != 0) { + strcpy(xorriso->info_text, "Error with obtaining ACL of "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + ret= 0; goto ex; + } + if(flag & 2) { + ret= 1 + (ret != 1 && d_ret == 0); + goto ex; + } + if((ret == 0 || ret == 2) && d_ret == 0) { + if(flag & 1) { + ret= 1 + (ret == 0); + goto ex; + } + strcpy(xorriso->info_text, "No ACL associated with "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + if(ret == 0) + {ret= 2; goto ex;} + } + + if(!(flag & 1)) { + ret= Xorriso_getfname(xorriso, path, 0); + if(ret <= 0) + goto ex; + uid= iso_node_get_uid(node); + pwd= getpwuid(uid); + if(pwd == NULL) + sprintf(xorriso->result_line, "# owner: %.f\n", (double) uid); + else + sprintf(xorriso->result_line, "# owner: %s\n", pwd->pw_name); + Xorriso_result(xorriso, 0); + gid= iso_node_get_gid(node); + grp= getgrgid(gid); + if(grp == NULL) + sprintf(xorriso->result_line, "# group: %.f\n", (double) gid); + else + sprintf(xorriso->result_line, "# group: %s\n", grp->gr_name); + Xorriso_result(xorriso, 0); + } + + for(pass= 0; pass < 1 + (acl_text != NULL && !(flag & 2)); pass++) { + if(pass) { + *acl_text= calloc(result_len + 1, 1); + if(*acl_text == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + } + if(text != NULL && what <= 1) { + for(npt= cpt= text; npt != NULL; cpt= npt + 1) { + npt= strchr(cpt, '\n'); + if(npt != NULL) + *npt= 0; + if(*cpt == 0) { + if(d_text != NULL || pass) { + if(npt != NULL) + *npt= '\n'; + continue; + } + } else + result_len+= strlen(cpt) + 1; + if(pass) { + sprintf(*acl_text + strlen(*acl_text), "%s\n", cpt); + } else if(!(flag & 1)) { + Sfile_str(xorriso->result_line, cpt, 0); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + if(npt != NULL) + *npt= '\n'; + } + } + if(d_text != NULL && (what == 0 || what == 2)) { + for(npt= cpt= d_text; npt != NULL; cpt= npt + 1) { + npt= strchr(cpt, '\n'); + if(npt != NULL) + *npt= 0; + if(*cpt != 0) { + if(pass) { + if(what == 0) + sprintf(*acl_text + strlen(*acl_text), "default:%s\n", cpt); + else + sprintf(*acl_text + strlen(*acl_text), "%s\n", cpt); + } else { + xorriso->result_line[0]= 0; + if(what == 0) + Sfile_str(xorriso->result_line, "default:", 0); + Sfile_str(xorriso->result_line, cpt, 1); + result_len+= strlen(cpt) + 9; + } + } else + xorriso->result_line[0]= 0; + if(pass== 0 && !(flag & 1)) { + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + if(npt != NULL) + *npt= '\n'; + } + } + } + ret= 1; +ex:; + iso_node_get_acl_text(node, &text, &d_text, 1 << 15); + return(ret); +} + + +/* + @param flag bit0= do not report to result but only retrieve attr text + bit1= path is disk_path + bit3= do not ignore eventual non-user attributes. + bit5= in case of symbolic link on disk: inquire link target + bit6= check for existence of xattr, return 0 or 1 + (depends also on bit3) +*/ +int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path, + char **attr_text, int flag) +{ + int ret= 1, i, bsl_mem, result_len= 0, pass; + size_t num_attrs= 0, *value_lengths= NULL; + char **names= NULL, **values= NULL, *bsl; + + if(attr_text != NULL) + *attr_text= NULL; + ret= Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names, + &value_lengths, &values, flag & (2 | 8 | 32)); + if(ret <= 0) + goto ex; + if(flag & 64) { + ret= (num_attrs > 0); + goto ex; + } + if(num_attrs == 0) + {ret= 2; goto ex;} + + if(!(flag & 1)) { + ret= Xorriso_getfname(xorriso, path, 0); + if(ret <= 0) + goto ex; + } + for(pass= 0; pass < 1 + (attr_text != NULL); pass++) { + if(pass) { + *attr_text= calloc(result_len + 1, 1); + if(*attr_text == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + } + for(i= 0; i < (int) num_attrs; i++) { + if(strlen(names[i]) + value_lengths[i] >= SfileadrL) { + sprintf(xorriso->result_line, "# oversized: name %d , value %d bytes\n", + (int) strlen(names[i]), (int) value_lengths[i]); + } else { + ret= Sfile_bsl_encoder(&bsl, names[i], strlen(names[i]), 8); + if(ret <= 0) + {ret= -1; goto ex;} + strcpy(xorriso->result_line, bsl); + free(bsl); + ret= Sfile_bsl_encoder(&bsl, values[i], value_lengths[i], 8); + if(ret <= 0) + {ret= -1; goto ex;} + sprintf(xorriso->result_line + strlen(xorriso->result_line), + "=\"%s\"\n", bsl); + free(bsl); + } + /* temporarily disable -backslash_codes with result output */ + result_len+= strlen(xorriso->result_line); + if(pass) { + strcat(*attr_text, xorriso->result_line); + } else if(!(flag & 1)) { + bsl_mem= xorriso->bsl_interpretation; + xorriso->bsl_interpretation= 0; + Xorriso_result(xorriso, 0); + xorriso->bsl_interpretation= bsl_mem; + } + } + } + if(!(flag & 1)) { + strcpy(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + ret= 1; +ex:; + Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names, + &value_lengths, &values, 1 << 15); + return(ret); +} + + +/* + @param flag bit0= with mode "e" : Use echo -e encoding but + do not put out commands and quotation marks. + Rather apply double backslash. +*/ +int Xorriso_append_extattr_comp(struct XorrisO *xorriso, + char *comp, size_t comp_len, + char *mode, int flag) +{ + int ret; + char *line, *wpt, *bsl = NULL; + unsigned char *upt, *uval; + + line= xorriso->result_line; + uval= (unsigned char *) comp; + + if(*mode == 'q') { + Text_shellsafe(comp, line, 1); + } else if(*mode == 'e' || mode[0] == 0) { + for(upt= uval; (size_t) (upt - uval) < comp_len; upt++) + if(*upt <= 037 || *upt >= 0177) + break; + if((size_t) (upt - uval) < comp_len || (flag & 1)) { + /* Use "$(echo -e '\0xyz')" */; + if(!(flag & 1)) + strcat(line, "\"$(echo -e '"); + wpt= line + strlen(line); + for(upt= uval; (size_t) (upt - uval) < comp_len; upt++) { + if(*upt <= 037 || *upt >= 0177 || *upt == '\\' || *upt == '\'') { + if(flag & 1) + *(wpt++)= '\\'; + sprintf((char *) wpt, "\\0%-3.3o", *upt); + wpt+= strlen(wpt); + } else { + *(wpt++)= *upt; + } + } + *wpt= 0; + if(!(flag & 1)) + strcpy(wpt, "')\""); + } else { + Text_shellsafe(comp, line, 1); + } + } else if(*mode == 'b') { + ret= Sfile_bsl_encoder(&bsl, comp, comp_len, 8); + if(ret <= 0) + {ret= -1; goto ex;} + strcat(line, bsl); + free(bsl); + bsl= NULL; + } else if(*mode == 'r') { + strcat(line, comp); + } + ret= 1; +ex:; + if(bsl != NULL) + free(bsl); + return(ret); +} + + +/* + @param flag bit1= path is disk_path + bit3= do not ignore eventual non-user attributes. + bit5= in case of symbolic link on disk: inquire link target +*/ +int Xorriso_list_extattr(struct XorrisO *xorriso, void *in_node, char *path, + char *show_path, char *mode, int flag) +{ + int ret= 1, i, bsl_mem; + size_t num_attrs= 0, *value_lengths= NULL; + char **names= NULL, **values= NULL, *cpt, *space_pt, *name_pt, *path_pt; + char *line; + unsigned char *upt, *uval; + + line= xorriso->result_line; + ret= Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names, + &value_lengths, &values, flag & (2 | 8 | 32)); + if(ret <= 0) + goto ex; + if(flag & 64) { + ret= (num_attrs > 0); + goto ex; + } + if(num_attrs == 0) + {ret= 2; goto ex;} + + strcpy(line, "n="); + path_pt= show_path + (show_path[0] == '/'); + if(path_pt[0] == 0) + path_pt= "."; + ret= Xorriso_append_extattr_comp(xorriso, path_pt, strlen(path_pt), mode, 0); + if(ret <= 0) + goto ex; + strcat(line, "\n"); + Xorriso_result(xorriso, 0); + for(i= 0; i < (int) num_attrs; i++) { + line[0]= 0; + uval= (unsigned char *) values[i]; + + if(strlen(names[i]) + value_lengths[i] >= SfileadrL) { + sprintf(line, + "echo 'OMITTED: Oversized: name %d bytes, value %d bytes in file '\"$n\" >&2\n", + (int) strlen(names[i]), (int) value_lengths[i]); + Xorriso_result(xorriso, 0); + continue; + } + + /* Form: $c space name value $n */ + + /* Split namespace from name */ + cpt= strchr(names[i], '.'); + if(cpt == NULL) { + space_pt= "user"; + name_pt= names[i]; + } else { + *cpt= 0; + space_pt= names[i]; + name_pt= cpt + 1; + } + + /* FreeBSD setextattr cannot set 0-bytes */ + for(upt= uval; (size_t) (upt - uval) < value_lengths[i]; upt++) + if(*upt == 0 + ) + break; + if((size_t) (upt - uval) < value_lengths[i]) { + strcpy(line, "echo 'OMITTED: Value contains 0-bytes : space \"'\""); + Xorriso_append_extattr_comp(xorriso, space_pt, strlen(space_pt), "e", 1); + if(ret <= 0) + goto ex; + strcat(line, "\"'\" , name \"'\""); + Xorriso_append_extattr_comp(xorriso, name_pt, strlen(name_pt), "e", 1); + if(ret <= 0) + goto ex; + strcat(line, "\"'\" in file '\""); + Xorriso_append_extattr_comp(xorriso, path_pt, strlen(path_pt), "e", 1); + strcat(line, "\" >&2\n"); + + /* temporarily disable -backslash_codes with result output */ + bsl_mem= xorriso->bsl_interpretation; + xorriso->bsl_interpretation= 0; + Xorriso_result(xorriso, 0); + xorriso->bsl_interpretation= bsl_mem; + strcpy(line, "# "); + } + + strcat(line, "$c "); + ret= Xorriso_append_extattr_comp(xorriso, space_pt, strlen(space_pt), + mode, 0); + if(ret <= 0) + goto ex; + strcat(line, " "); + ret= Xorriso_append_extattr_comp(xorriso,name_pt, strlen(name_pt), mode, 0); + if(ret <= 0) + goto ex; + strcat(line, " "); + ret= Xorriso_append_extattr_comp(xorriso, values[i], value_lengths[i], + mode, 0); + if(ret <= 0) + goto ex; + strcat(line, " \"$n\"\n"); + + /* temporarily disable -backslash_codes with result output */ + bsl_mem= xorriso->bsl_interpretation; + xorriso->bsl_interpretation= 0; + Xorriso_result(xorriso, 0); + xorriso->bsl_interpretation= bsl_mem; + } + strcpy(line, "\n"); + Xorriso_result(xorriso, 0); + ret= 1; +ex:; + Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names, + &value_lengths, &values, 1 << 15); + return(ret); +} + + +/* + @param flag + Bitfield for control purposes + bit0= get default ACL rather than access ACL + bit4= set *text = NULL and return 2 + if the ACL matches st_mode permissions. + bit5= in case of symbolic link: inquire link target + bit15= free text and return 1 + @return + 1 ok + 2 ok, trivial ACL found while bit4 is set, *text is NULL + 0 no ACL manipulation adapter available / ACL not supported by fs + -1 failure of system ACL service (see errno) + -2 attempt to inquire ACL of a symbolic link without bit4 or bit5 + resp. with no suitable link target +*/ +int Xorriso_local_getfacl(struct XorrisO *xorriso, char *disk_path, + char **text, int flag) +{ + int ret, skip= 0, colons= 0, countdown= 0; + char *acl= NULL, *cpt, *wpt; + + if(flag & (1 << 15)) { + if(*text != NULL) + free(*text); + *text= NULL; + return(1); + } + *text= NULL; + ret= iso_local_get_acl_text(disk_path, &acl, flag & (1 | 16 | 32)); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0 || ret == 2) + return(ret); + if(acl == NULL) + return(0); + *text= strdup(acl); + iso_local_get_acl_text(disk_path, &acl, 1 << 15); + if(*text == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + + /* Garbage collection about trailing remarks after 3 permission chars */ + wpt= *text; + for(cpt= *text; *cpt; cpt++) { + if(skip) { + if(*cpt == '\n') + skip= 0; + else + continue; + } + if(*cpt == ':' && !countdown) { + colons++; + if(colons == 2) { + countdown= 4; + colons= 0; + } + } + if(countdown > 0) { + countdown--; + if(countdown == 0) + skip= 1; + } + *wpt= *cpt; + wpt++; + } + *wpt= 0; + + return(1); +} + + +/* + @param flag + bit1= path is disk_path + bit3= do not ignore eventual non-user attributes. + bit5= in case of symbolic link on disk: inquire link target + bit15= free memory +*/ +int Xorriso_get_attrs(struct XorrisO *xorriso, void *in_node, char *path, + size_t *num_attrs, char ***names, + size_t **value_lengths, char ***values, int flag) +{ + int ret, i, widx; + IsoNode *node; + + if(flag & (1 << 15)) { + if(flag & 2) { + iso_local_get_attrs(NULL, num_attrs, names, value_lengths, values, + 1 << 15); + } else { + iso_node_get_attrs(NULL, num_attrs, names, value_lengths, values, + 1 << 15); + } + return(1); + } + + *num_attrs= 0; + if(flag & 2) { + ret= iso_local_get_attrs(path, num_attrs, names, value_lengths, values, + flag & (8 | 32)); + if(ret < 0) { + strcpy(xorriso->info_text, "Error with reading xattr of disk file "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + } + } else { + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + goto ex; + } + ret= iso_node_get_attrs(node, num_attrs, names, value_lengths, values, + 0); + if(ret < 0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when obtaining xattr of ISO node", 0, "FAILURE", 1); + goto ex; + } + + if(!(flag & 8)) { + /* Filter away any non-userspace xattr */; + widx= 0; + for(i= 0; i < (int) *num_attrs; i++) { + if(strncmp((*names)[i], "user.", 5) != 0) { + free((*names)[i]); + (*names)[i]= NULL; + if((*values)[i] != NULL) { + free((*values)[i]); + (*values)[i]= NULL; + } + } else { + if(widx != i) { + (*names)[widx]= (*names)[i]; + (*value_lengths)[widx]= (*value_lengths)[i]; + (*values)[widx]= (*values)[i]; + (*names)[i]= NULL; + (*value_lengths)[i]= 0; + (*values)[i]= NULL; + } + widx++; + } + } + *num_attrs= widx; + } + } + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +int Xorriso_get_attr_value(struct XorrisO *xorriso, void *in_node, char *path, + char *name, size_t *value_length, char **value, int flag) +{ + int ret; + size_t num_attrs= 0, *value_lengths= NULL, i; + char **names = NULL, **values= NULL; + + *value= NULL; + *value_length= 0; + ret= Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names, + &value_lengths, &values, 8); + if(ret <= 0) + goto ex; + + for(i= 0; i < num_attrs; i++) { + if(strcmp(name, names[i]) != 0) + continue; + *value= calloc(value_lengths[i] + 1, 1); + if(*value == NULL) + {ret= -1; goto ex;} + memcpy(*value, values[i], value_lengths[i]); + (*value)[value_lengths[i]]= 0; + *value_length= value_lengths[i]; + ret= 1; goto ex; + } + ret= 0; +ex: + Xorriso_get_attrs(xorriso, in_node, path, &num_attrs, &names, + &value_lengths, &values, 1 << 15); + return(ret); +} + + +int Xorriso_stream_type(struct XorrisO *xorriso, IsoNode *node, + IsoStream *stream, char type_text[], int flag) +{ + int ret, lba; + char text[5]; + + strncpy(text, stream->class->type, 4); + text[4]= 0; + if(strcmp(text, "fsrc") == 0) { + ret= Xorriso__file_start_lba(node, &lba, 0); + if(ret > 0 && lba > 0) + strcpy(type_text, "image"); + else + strcpy(type_text, "disk"); + } else if(strcmp(text, "ziso") == 0) { + strcpy(type_text, "--zisofs"); + } else if(strcmp(text, "osiz") == 0) { + strcpy(type_text, "--zisofs-decode"); + } else if(strcmp(text, "gzip") == 0) { + strcpy(type_text, "--gzip"); + } else if(strcmp(text, "pizg") == 0) { + strcpy(type_text, "--gunzip"); + } else if(strcmp(text, "cout") == 0 || strcmp(text, "boot") == 0 || + strcmp(text, "user") == 0 || strcmp(text, "extf") == 0) { + strcpy(type_text, text); + } else { + Text_shellsafe(text, type_text, 0); + } + return(1); +} + + +/* + @param flag bit0= do not report to result but only retrieve md5 text + @return 1= ok, 0= no md5 available, <0= other error +*/ +int Xorriso_get_md5(struct XorrisO *xorriso, void *in_node, char *path, + char md5[16], int flag) +{ + int ret= 1, i; + char *wpt; + IsoImage *image; + IsoNode *node; + + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret <= 0) + goto ex; + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + goto ex; + } + if(!LIBISO_ISREG(node)) + return(0); + ret= iso_file_get_md5(image, (IsoFile *) node, md5, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) + goto ex; + if(flag & 1) + {ret= 1; goto ex;} + + wpt= xorriso->result_line; + for(i= 0; i < 16; i++) { + sprintf(wpt, "%2.2x", ((unsigned char *) md5)[i]); + wpt+= 2; + } + strcpy(wpt, " "); + wpt+= 2; + Xorriso_getfname(xorriso, path, 1 | 2); + ret= 1; +ex:; + return(ret); +} + + +int Xorriso_make_md5(struct XorrisO *xorriso, void *in_node, char *path, + int flag) +{ + int ret; + off_t size; + IsoNode *node; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret <= 0) + return(ret); + } + if(!LIBISO_ISREG(node)) + return(0); + ret= iso_file_make_md5((IsoFile *) node, 0); + size= iso_file_get_size((IsoFile *) node); + xorriso->pacifier_count+= size; + xorriso->pacifier_byte_count+= size; + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 0); + Xorriso_process_msg_queues(xorriso, 0); + if(ret < 0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when computing MD5", 0, "FAILURE", 1); + return(0); + } + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* @param flag bit0= do not only sum up sizes but also print subdirs +*/ +int Xorriso_show_du_subs(struct XorrisO *xorriso, IsoDir *dir_node, + char *abs_path, char *rel_path, off_t *size, + off_t boss_mem, int flag) +{ + int i, ret, no_sort= 0, filec= 0, l; + IsoDirIter *iter= NULL; + IsoNode *node, **node_array= NULL; + char *name; + off_t sub_size, report_size, mem= 0; + char *path= NULL, *show_path= NULL, *sfe= NULL; + + sfe= malloc(5*SfileadrL); + path= malloc(SfileadrL); + show_path= malloc(SfileadrL); + if(path==NULL || show_path==NULL || sfe==NULL) { + Xorriso_no_malloc_memory(xorriso, &sfe, 0); + {ret= -1; goto ex;} + } + + *size= 0; + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) { +cannot_create_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + {ret= -1; goto ex;} + } + for(i= 0; iso_dir_iter_next(iter, &node) == 1; ) { + sub_size= 0; + name= (char *) iso_node_get_name(node); + strcpy(show_path, rel_path); + if(Sfile_add_to_path(show_path, name, 0)<=0) + goto much_too_long; + if(LIBISO_ISDIR(node)) { + strcpy(path, abs_path); + if(Sfile_add_to_path(path, name, 0)<=0) { +much_too_long:; + Xorriso_much_too_long(xorriso, strlen(path)+strlen(name)+1, 2); + {ret= -1; goto ex;} + } + filec++; + l= strlen(rel_path)+1; + mem+= l; + if(l % sizeof(char *)) + mem+= sizeof(char *)-(l % sizeof(char *)); + if(flag&1) /* diving and counting is done further below */ + continue; + ret= Xorriso_show_du_subs(xorriso, (IsoDir *) node, + path, show_path, &sub_size, boss_mem, 0); + if(ret<0) + goto ex; + if(ret==0) + continue; + } + + if(LIBISO_ISREG(node)) { + sub_size+= iso_file_get_size((IsoFile *) node)+2048; +/* + sub_size+= iso_file_get_size((IsoFile *) node)+strlen(name)+1; +*/ + } + + if(sub_size>0) + (*size)+= sub_size; + Xorriso_process_msg_queues(xorriso,0); + } + + if(filec<=0 || !(flag&1)) + {ret= 1; goto ex;} + + /* Reset iteration */ + iso_dir_iter_free(iter); + iter= NULL; + Xorriso_process_msg_queues(xorriso,0); + + ret= Xorriso_sorted_node_array(xorriso, dir_node, &filec, &node_array, + boss_mem, 1|2|4); + if(ret<0) + goto ex; + if(ret==0) { + no_sort= 1; + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) + goto cannot_create_iter; + } + + for(i= 0; (no_sort || irequest_to_abort); i++) { + if(no_sort) { + ret= iso_dir_iter_next(iter, &node); + if(ret!=1) + break; + if(!LIBISO_ISDIR(node)) + continue; + } else + node= node_array[i]; + + sub_size= 0; + name= (char *) iso_node_get_name(node); + strcpy(show_path, rel_path); + if(Sfile_add_to_path(show_path, name, 0)<=0) + goto much_too_long; + strcpy(path, abs_path); + if(Sfile_add_to_path(path, name, 0)<=0) + goto much_too_long; + ret= Xorriso_show_du_subs(xorriso, (IsoDir *) node, + path, show_path, &sub_size, boss_mem+mem, flag&1); + if(ret<0) + goto ex; + + if(LIBISO_ISREG(node)) { + sub_size+= iso_file_get_size((IsoFile *) node)+2048; +/* + sub_size+= iso_tree_node_get_size((IsoFile *) node)+strlen(name)+1; +*/ + } + if(sub_size>0) + (*size)+= sub_size; + report_size= sub_size/1024; + if(report_size*1024result_line, "%7.f ",(double) (report_size)); + sprintf(xorriso->result_line+strlen(xorriso->result_line), "%s\n", + Text_shellsafe(show_path, sfe, 0)); + Xorriso_result(xorriso, 0); + } + ret= 1; +ex:; + if(sfe!=NULL) + free(sfe); + if(path!=NULL) + free(path); + if(show_path!=NULL) + free(show_path); + if(iter!=NULL) + iso_dir_iter_free(iter); + if(node_array!=NULL) + free((char *) node_array); + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +int Xorriso_sorted_dir_i(struct XorrisO *xorriso, IsoDir *dir_node, + int *filec, char ***filev, off_t boss_mem, int flag) +{ + int i,j,ret; + IsoDirIter *iter= NULL; + IsoNode *node; + char *name; + off_t mem; + + (*filec)= 0; + (*filev)= NULL; + + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) { +cannot_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + {ret= -1; goto ex;} + } + mem= 0; + for(i= 0; iso_dir_iter_next(iter, &node) == 1; ) { + name= (char *) iso_node_get_name(node); + mem+= sizeof(char *)+strlen(name)+8; + (*filec)++; + } + iso_dir_iter_free(iter); + iter= NULL; + if(*filec==0) + {ret= 1; goto ex;} + + ret= Xorriso_check_temp_mem_limit(xorriso, mem+boss_mem, 2); + if(ret<=0) + goto ex; + (*filev)= (char **) calloc(*filec, sizeof(char *)); + if(*filev==NULL) + {ret= -1; goto ex; } + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) + goto cannot_iter; + for(i= 0; i<*filec; i++) { + ret= iso_dir_iter_next(iter, &node); + if(ret!=1) + break; + name= (char *) iso_node_get_name(node); + (*filev)[i]= strdup(name); + if((*filev)[i]==NULL) { + for(j= 0; jresult_line; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + Sort_argv(filec, filev, 0); + + /* Count valid nodes, warn of invalid ones */ + for(i= 0; iinfo_text, "Not found in ISO image: "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + was_error++; + continue; + } + } + + if((flag&8) && !(flag&(2|4))) { + sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec-was_error); + Xorriso_info(xorriso,1); + if(filec-was_error<=0) + {ret= !was_error; goto ex;} + } + + passes= 1+!(flag&(4|8)); + for(pass= 0; passrequest_to_abort); i++) { + rpt[0]= 0; + ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4); + if(ret<=0) + continue; + ret= Xorriso_fake_stbuf(xorriso, path, &stbuf, &node, ((flag&4) >> 1) | 16); + if(ret<=0) + continue; + if(LIBISO_ISDIR(node) && !(flag&(4|8))) { + if(pass==0) + continue; + if(filec>1) { + strcpy(xorriso->result_line, "\n"); + Xorriso_result(xorriso,0); + Text_shellsafe(filev[i], xorriso->result_line, 0); + strcat(xorriso->result_line, ":\n"); + Xorriso_result(xorriso,0); + } + ret= Xorriso_sorted_dir_i(xorriso, + (IsoDir *) node, &dfilec, &dfilev, boss_mem, 0); + if(ret<=0) { + + /* >>> libisofs iterator loop and single item Xorriso_lsx_filev() */; + + } else { + if(flag&1) { + sprintf(xorriso->result_line, "total %d\n", dfilec); + Xorriso_result(xorriso,0); + } + Xorriso_ls_filev(xorriso, path, + dfilec, dfilev, boss_mem, (flag&1)|2|8); + } + if(dfilec>0) + Sfile_destroy_argv(&dfilec, &dfilev, 0); + continue; + } else + if(pass>0) + continue; + link_target[0]= 0; + if((flag&5)==1) { /* -ls_l */ + iso_node_get_acl_text(node, &a_text, &d_text, 16); + hidden_state= Xorriso_node_eff_hidden(xorriso, node, 0); + ret= Xorriso_format_ls_l(xorriso, &stbuf, + 1 | ((a_text != NULL || d_text != NULL) << 1) | + (hidden_state << 2)); + iso_node_get_acl_text(node, &a_text, &d_text, 1 << 15); + if(ret<=0) + continue; + if(LIBISO_ISLNK(node)) { + if(Sfile_str(link_target, (char *) iso_symlink_get_dest( + (IsoSymlink *) node), 0)<=0) + link_target[0]= 0; + } + } else if(flag&4) { /* -du or -dus */ + size= stbuf.st_size; + if(S_ISDIR(stbuf.st_mode)) { + ret= Xorriso_show_du_subs(xorriso, (IsoDir *) node, + path, filev[i], &size, boss_mem, flag&1); + if(ret<0) + {ret= -1; goto ex;} + if(ret==0) + continue; + } + sprintf(rpt, "%7.f ",(double) (size/1024)); + } + if(link_target[0] && (flag&5)==1) { + Text_shellsafe(filev[i], xorriso->result_line, 1), + strcat(xorriso->result_line, " -> "); + Text_shellsafe(link_target, xorriso->result_line, 1 | 2); + } else { + Text_shellsafe(filev[i], xorriso->result_line, 1); + } + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + ret= !was_error; +ex:; + Xorriso_free_meM(path); + Xorriso_free_meM(link_target); + return(ret); +} + + +/* This function needs less buffer memory than Xorriso_ls_filev() but cannot + perform structured pattern matching as done by Xorriso_expand_pattern() + for subsequent Xorriso_ls_filev(). + @param flag bit0= long format + bit1= only check for directory existence + bit2= do not apply search pattern but accept any file + bit3= just count nodes and return number +*/ +int Xorriso_ls(struct XorrisO *xorriso, int flag) +{ + int ret, i, filec= 0, failed_at, no_sort= 0; + IsoNode *node, **node_array= NULL; + IsoDir *dir_node; + IsoDirIter *iter= NULL; + char *link_target= NULL, *npt, *rpt; + struct stat stbuf; + + Xorriso_alloc_meM(link_target, char, SfileadrL); + + rpt= xorriso->result_line; + + ret= Xorriso_dir_from_path(xorriso, "Working directory", xorriso->wdi, + &dir_node, 0); + if(ret <= 0) + goto ex; + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) { +cannot_create_iter:; + Xorriso_cannot_create_iter(xorriso, ret, 0); + {ret= -1; goto ex;} + } + Xorriso_process_msg_queues(xorriso,0); + + for(i= 0; iso_dir_iter_next(iter, &node) == 1; ) { + npt= (char *) iso_node_get_name(node); + if(!(flag&4)) { + ret= Xorriso_regexec(xorriso, npt, &failed_at, 0); + if(ret) + continue; /* no match */ + } + filec++; + } + /* Reset iteration */ + iso_dir_iter_free(iter); + iter= NULL; + Xorriso_process_msg_queues(xorriso,0); + if(flag&8) + {ret= filec; goto ex;} + sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec); + Xorriso_info(xorriso,1); + + ret= Xorriso_sorted_node_array(xorriso, dir_node, &filec, &node_array, 0, + flag&4); + if(ret<0) + goto ex; + if(ret==0) { + no_sort= 1; + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) + goto cannot_create_iter; + } + + for(i= 0; irequest_to_abort); i++) { + if(no_sort) { + ret= iso_dir_iter_next(iter, &node); + if(ret!=1) + break; + npt= (char *) iso_node_get_name(node); + if(!(flag&4)) { + ret= Xorriso_regexec(xorriso, npt, &failed_at, 0); + if(ret) + continue; /* no match */ + } + } else + node= node_array[i]; + + npt= (char *) iso_node_get_name(node); + link_target[0]= 0; + if(LIBISO_ISLNK(node)) { + if(Sfile_str(link_target, (char *) iso_symlink_get_dest( + (IsoSymlink *) node), 0)<=0) + link_target[0]= 0; + } + rpt[0]= 0; + if(flag&1) { + ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1); + if(ret<=0) + continue; + ret= Xorriso_format_ls_l(xorriso, &stbuf, 1); + if(ret<=0) + continue; + } + if(link_target[0] && (flag&1)) { + Text_shellsafe(npt, xorriso->result_line, 1); + strcat(xorriso->result_line, " -> "); + Text_shellsafe(link_target, xorriso->result_line, 1 | 2); + } else { + Text_shellsafe(npt, xorriso->result_line, 1); + } + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + + ret= 1; +ex:; + if(iter!=NULL) + iso_dir_iter_free(iter); + Xorriso_process_msg_queues(xorriso,0); + if(node_array!=NULL) + free((char *) node_array); + Xorriso_free_meM(link_target); + return(ret); +} + + +/* @param flag bit0= count results rather than storing them + bit1= this is a recursion + bit2= prepend wd (automatically done if wd[0]!=0) +*/ +int Xorriso_obtain_pattern_files_i( + struct XorrisO *xorriso, char *wd, IsoDir *dir, + int *filec, char **filev, int count_limit, off_t *mem, + int *dive_count, int flag) +{ + int ret, failed_at; + IsoDirIter *iter= NULL; + IsoNode *node; + char *name; + char *adr= NULL; + + adr= malloc(SfileadrL); + if(adr==NULL) { + Xorriso_no_malloc_memory(xorriso, &adr, 0); + {ret= -1; goto ex;} + } + + if(!(flag&2)) + *dive_count= 0; + else + (*dive_count)++; + ret= Xorriso_check_for_root_pattern(xorriso, filec, filev, count_limit, + mem, (flag&1)|2); + if(ret!=2) + goto ex; + + ret= iso_dir_get_children(dir, &iter); + if(ret<0) { + Xorriso_cannot_create_iter(xorriso, ret, 0); + {ret= -1; goto ex;} + } + while(iso_dir_iter_next(iter, &node) == 1) { + name= (char *) iso_node_get_name(node); + ret= Xorriso_make_abs_adr(xorriso, wd, name, adr, flag&4); + if(ret<=0) + goto ex; + ret= Xorriso_regexec(xorriso, adr, &failed_at, 1); + if(ret) { /* no match */ + if(failed_at <= *dive_count) /* no hope for a match */ + continue; + + if(!LIBISO_ISDIR(node)) { + + /* >>> How to deal with softlinks ? */ + + continue; + } + /* dive deeper */ + ret= Xorriso_obtain_pattern_files_i( + xorriso, adr, (IsoDir *) node, + filec, filev, count_limit, mem, dive_count, flag|2); + if(ret<=0) + goto ex; + } else { + ret= Xorriso_register_matched_adr(xorriso, adr, count_limit, + filec, filev, mem, (flag&1)|2); + if(ret<=0) + goto ex; + } + } + ret= 1; +ex:; + if(adr!=NULL) + free(adr); + if(flag&2) + (*dive_count)--; + if(iter != NULL) + iso_dir_iter_free(iter); + return(ret); +} + + +/* @param flag bit0= a match count !=1 is a FAILURE event + bit1= with bit0 tolerate 0 matches if pattern is a constant +*/ +int Xorriso_expand_pattern(struct XorrisO *xorriso, + int num_patterns, char **patterns, int extra_filec, + int *filec, char ***filev, off_t *mem, int flag) +{ + int ret, count= 0, abs_adr= 0, i, was_count, was_filec; + int nonconst_mismatches= 0, dive_count= 0; + IsoImage *volume; + IsoDir *dir= NULL, *root_dir; + IsoNode *iso_node; + + *filec= 0; + *filev= NULL; + + xorriso->search_mode= 3; + xorriso->structured_search= 1; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(ret); + root_dir= iso_image_get_root(volume); + if(root_dir==NULL) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "While expanding pattern : Cannot obtain root node of ISO image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= -1; goto ex; + } + + for(i= 0; iwdi does not exist yet, but one may + not use it as base for relative address searches. + */ + ret= Xorriso_node_from_path(xorriso, volume, xorriso->wdi, &iso_node, 1); + dir= (IsoDir *) iso_node; + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, "While expanding pattern "); + Text_shellsafe(patterns[i], xorriso->info_text, 1); + strcat(xorriso->info_text, + " : Working directory does not exist in ISO image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(!LIBISO_ISDIR((IsoNode *) dir)) { + sprintf(xorriso->info_text, + "Working directory path does not lead to a directory in ISO image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + + /* count the matches */ + was_count= count; + ret= Xorriso_obtain_pattern_files_i(xorriso, "", dir, &count, NULL, 0, + mem, &dive_count, 1 | abs_adr); + if(ret<=0) + goto ex; + if(was_count==count && strcmp(patterns[i],"*")!=0 && (flag&3)!=1) { + count++; + Xorriso_eval_nonmatch(xorriso, patterns[i], &nonconst_mismatches, mem, 0); + } + } + + ret= Xorriso_check_matchcount(xorriso, count, nonconst_mismatches, + num_patterns, patterns, (flag&1)|2); + if(ret<=0) + goto ex; + count+= extra_filec; + mem+= extra_filec*sizeof(char *); + if(count<=0) + {ret= 0; goto ex;} + ret= Xorriso_alloc_pattern_mem(xorriso, *mem, count, filev, 0); + if(ret<=0) + goto ex; + /* now store addresses */ + for(i= 0; i= SfileadrL) { + free(source_path); + return(0); + } + strcpy(disk_path, source_path); + free(source_path); + return(1); +} + + +int Xorriso_show_stream(struct XorrisO *xorriso, void *in_node, + char *path, int flag) +{ + int ret; + IsoNode *node; + IsoFile *file; + IsoStream *stream= NULL, *input_stream; + IsoExternalFilterCommand *cmd; + char type_text[16], *source_path= NULL; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret <= 0) + goto ex; + } + if(!LIBISO_ISREG(node)) + {ret= 2; goto ex;} + file= (IsoFile *) node; + input_stream= iso_file_get_stream(file); + Text_shellsafe(path, xorriso->result_line, 0); + while(1) { + stream= input_stream; + input_stream= iso_stream_get_input_stream(stream, 0); + if(input_stream == NULL) + break; + strcat(xorriso->result_line, " < "); + Xorriso_stream_type(xorriso, node, stream, type_text, 0); + strcat(xorriso->result_line, type_text); + ret= iso_stream_get_external_filter(stream, &cmd, 0); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when inquiring filter command of node", 0, "FAILURE", 1); + ret= 0; goto ex; + } + if(ret > 0) { + strcat(xorriso->result_line, ":"); + Text_shellsafe(cmd->name, xorriso->result_line, 1); + } + if(strlen(xorriso->result_line) > SfileadrL) { + Xorriso_result(xorriso, 0); + xorriso->result_line[0]= 0; + } + } + strcat(xorriso->result_line, " < "); + Xorriso_stream_type(xorriso, node, stream, type_text, 0); + strcat(xorriso->result_line, type_text); + + source_path= iso_stream_get_source_path(stream, 0); + if(source_path != NULL) { + strcat(xorriso->result_line, ":"); + Text_shellsafe(source_path, xorriso->result_line, 1); + } + + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + ret= 1; +ex:; + if(source_path != NULL) + free(source_path); + return(ret); +} + + +/* @param damage_start Returns first damaged byte address + @param damage_end Returns first byte address after last damaged byte + @return <0 error, 0=undamaged , 1=damaged +*/ +int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node, + off_t *damage_start, off_t *damage_end, + int flag) +{ + int *start_lbas= NULL, *end_lbas= NULL, lba_count= 0, sect; + int i, sectors, sector_size, ret; + off_t sect_base= 0, size= 0, byte; + struct SectorbitmaP *map; + + *damage_start= *damage_end= -1; + map= xorriso->in_sector_map; + if(map == NULL) + return(0); + Sectorbitmap_get_layout(map, §ors, §or_size, 0); + sector_size/= 2048; + + ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas, + &size, 0); + if(ret <= 0) { + Xorriso_process_msg_queues(xorriso, 0); + return(ret); + } + for(sect= 0; sect < lba_count; sect++) { + for(i= start_lbas[sect]; i <= end_lbas[sect]; i+= sector_size) { + if(Sectorbitmap_is_set(map, i / sector_size, 0) == 0) { + byte= ((off_t) 2048) * ((off_t) (i - start_lbas[sect])) + sect_base; + if(*damage_start < 0 || byte < *damage_start) + *damage_start= byte; + if(byte + (off_t) 2048 > *damage_end) + *damage_end= byte + (off_t) 2048; + } + } + sect_base+= ((off_t) 2048) * + ((off_t) (end_lbas[sect] - start_lbas[sect] + 1)); + } + if(*damage_end > size) + *damage_end= size; + if(start_lbas != NULL) + free((char *) start_lbas); + if(end_lbas != NULL) + free((char *) end_lbas); + if(*damage_start < 0) + return(0); + return(1); +} + + +int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path, + IsoNode *node, int flag) +{ + int ret, *start_lbas= NULL, *end_lbas= NULL, lba_count, i; + off_t size; + + ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas, + &size, 0); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso, 0); + {ret= -1; goto ex;} + } + if(ret == 0) + {ret= 1; goto ex;} /* it is ok to ignore other types */ + for(i= 0; i < lba_count; i++) { + sprintf(xorriso->result_line, + "File data lba: %2d , %8d , %8d , %8.f , ", + i, start_lbas[i], end_lbas[i] + 1 - start_lbas[i], (double) size); + Text_shellsafe(show_path, xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + } + ret= 1; +ex:; + if(start_lbas != NULL) + free((char *) start_lbas); + if(end_lbas != NULL) + free((char *) end_lbas); + return(ret); +} + + +int Xorriso_report_damage(struct XorrisO *xorriso, char *show_path, + IsoNode *node, int flag) +{ + int ret; + off_t size= 0, damage_start, damage_end; + + ret= Xorriso_file_eval_damage(xorriso, node, &damage_start, &damage_end, 0); + if(ret < 0) + return(0); + + if(LIBISO_ISREG(node)) + size= iso_file_get_size((IsoFile *) node); + if(ret > 0) { + sprintf(xorriso->result_line, "File damaged : %8.f , %8.f , %8.f , ", + (double) damage_start, (double) (damage_end - damage_start) , + (double) size); + } else { + sprintf(xorriso->result_line, "File seems ok: %8.f , %8.f , %8.f , ", + -1.0, -1.0, (double) size); + } + Text_shellsafe(show_path, xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + return(1); +} + + +/* @param flag bit0= do not accept hln_targets[i] != NULL as *node_idx + bit1= use *node_idx as found index rather than searching it + bit2= with bit1: use xorriso->node_array rather than hln_array +*/ +int Xorriso_search_hardlinks(struct XorrisO *xorriso, IsoNode *node, + int *node_idx, int *min_hl, int *max_hl, int flag) +{ + int idx, ret, i, node_count; + void *np, **node_array; + + node_array= xorriso->hln_array; + node_count= xorriso->hln_count; + *min_hl= *max_hl= -1; + np= node; + if(flag & 2) { + idx= *node_idx; + if(flag & 4) { + node_array= xorriso->node_array; + node_count= xorriso->node_counter; + } + } else { + *node_idx= -1; + ret= Xorriso_search_in_hln_array(xorriso, np, &idx, 0); + if(ret <= 0) + return(ret); + } + for(i= idx - 1; i >= 0 ; i--) + if(Xorriso__findi_sorted_ino_cmp(&(node_array[i]), &np) != 0) + break; + *min_hl= i + 1; + for(i= idx + 1; i < node_count; i++) + if(Xorriso__findi_sorted_ino_cmp(&(node_array[i]), &np) != 0) + break; + *max_hl= i - 1; + + /* Search for *node_idx */ + if(flag & 2) + return(1); + for(i= *min_hl; i <= *max_hl; i++) + if(node_array[i] == np) { + if((flag & 1) && xorriso->hln_targets != NULL && !(flag & 4)) + if(xorriso->hln_targets[i] != NULL) + continue; + *node_idx= i; + break; + } + return(1); +} + + +/* @param flag bit0=do not complain about non existent node */ +int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume, + char *path, IsoNode **node, int flag) +{ + int ret; + char *path_pt; + + path_pt= path; + if(path[0]==0) + path_pt= "/"; + if(volume == NULL) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret <= 0) + return(ret); + } + *node= NULL; + ret= iso_tree_path_to_node(volume, path_pt, node); + Xorriso_process_msg_queues(xorriso,0); + if(ret<=0 || (*node)==NULL) { + if(!(flag&1)) { + sprintf(xorriso->info_text, "Cannot find path "); + Text_shellsafe(path_pt, xorriso->info_text, 1); + strcat(xorriso->info_text, " in loaded ISO image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + return(0); + } + return(1); +} + + +int Xorriso_dir_from_path(struct XorrisO *xorriso, char *purpose, + char *path, IsoDir **dir_node, int flag) +{ + IsoImage *volume; + IsoNode *node; + int ret, is_dir= 0; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(ret); + + ret= Xorriso_node_from_path(xorriso, volume, path, &node, 0); + if(ret<=0) + goto wdi_is_not_a_dir; + if(LIBISO_ISDIR(node)) + is_dir= 1; + if(!is_dir) { +wdi_is_not_a_dir:; + sprintf(xorriso->info_text, + "%s path does not lead to a directory in ISO image", purpose); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + *dir_node= (IsoDir *) node; + return(1); +} + + +/* + @param flag bit0= do not remove leading slash + bit1= append flatly to result_line and put out +*/ +int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag) +{ + int ret, path_offset= 0, bsl_mem; + char *bsl_path= NULL; + + if(path[0] == '/' && !(flag & 1)) + path_offset= 1; + + /* backslash escaped path rather than shellsafe path */ + ret= Sfile_bsl_encoder(&bsl_path, path + path_offset, + strlen(path + path_offset), 8); + if(ret <= 0) + return(-1); + if(flag & 2) { + sprintf(xorriso->result_line + strlen(xorriso->result_line), + "%s\n", bsl_path[0] ? bsl_path : "."); + } else { + sprintf(xorriso->result_line, "# file: %s\n", bsl_path[0] ? bsl_path : "."); + } + free(bsl_path); + bsl_path= NULL; + /* temporarily disable -backslash_codes with result output */ + bsl_mem= xorriso->bsl_interpretation; + xorriso->bsl_interpretation= 0; + Xorriso_result(xorriso, 0); + xorriso->bsl_interpretation= bsl_mem; + return(1); +} + + +int Xorriso_is_plain_image_file(struct XorrisO *xorriso, void *in_node, + char *path, int flag) +{ + int ret, lba; + IsoStream *stream; + IsoNode *node; + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + return(ret); + } + + ret= Xorriso__file_start_lba(node, &lba, 0); + if(ret > 0) { /* Stream source is from loaded image */ + stream= iso_file_get_stream((IsoFile *) node); + if(stream != NULL) + if(iso_stream_get_input_stream(stream, 0) == NULL) + return(1); + } + return(0); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/iso_tree.h b/libisoburn/branches/1.1.8/xorriso/iso_tree.h new file mode 100644 index 00000000..85224582 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/iso_tree.h @@ -0,0 +1,97 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which access nodes of the + libisofs tree model. +*/ + + +#ifndef Xorriso_pvt_iso_tree_includeD +#define Xorriso_pvt_iso_tree_includeD yes + + +#define LIBISO_ISDIR(node) (iso_node_get_type(node) == LIBISO_DIR) +#define LIBISO_ISREG(node) (iso_node_get_type(node) == LIBISO_FILE) +#define LIBISO_ISLNK(node) (iso_node_get_type(node) == LIBISO_SYMLINK) +#define LIBISO_ISCHR(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ + S_ISCHR(iso_node_get_mode(node))) +#define LIBISO_ISBLK(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ + S_ISBLK(iso_node_get_mode(node))) +#define LIBISO_ISFIFO(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ + S_ISFIFO(iso_node_get_mode(node))) +#define LIBISO_ISSOCK(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ + S_ISSOCK(iso_node_get_mode(node))) +#define LIBISO_ISBOOT(node) (iso_node_get_type(node) == LIBISO_BOOT) + + +int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume, + char *path, IsoNode **node, int flag); + +int Xorriso_get_node_by_path(struct XorrisO *xorriso, + char *in_path, char *eff_path, + IsoNode **node, int flag); + +int Xorriso_dir_from_path(struct XorrisO *xorriso, char *purpose, + char *path, IsoDir **dir_node, int flag); + +int Xorriso_node_get_dev(struct XorrisO *xorriso, IsoNode *node, + char *path, dev_t *dev, int flag); + +int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf, + IsoNode **node, int flag); + +int Xorriso_node_is_valid(struct XorrisO *xorriso, IsoNode *in_node, int flag); + +int Xorriso_path_from_node(struct XorrisO *xorriso, IsoNode *in_node, + char path[SfileadrL], int flag); + +int Xorriso_path_from_lba(struct XorrisO *xorriso, IsoNode *node, int lba, + char path[SfileadrL], int flag); + +int Xorriso_get_attr_value(struct XorrisO *xorriso, void *in_node, char *path, + char *name, size_t *value_length, char **value, int flag); + +int Xorriso_stream_type(struct XorrisO *xorriso, IsoNode *node, + IsoStream *stream, char type_text[], int flag); + + +int Xorriso_show_du_subs(struct XorrisO *xorriso, IsoDir *dir_node, + char *abs_path, char *rel_path, off_t *size, + off_t boss_mem, int flag); + +int Xorriso_sorted_dir_i(struct XorrisO *xorriso, IsoDir *dir_node, + int *filec, char ***filev, off_t boss_mem, int flag); + +int Xorriso_obtain_pattern_files_i( + struct XorrisO *xorriso, char *wd, IsoDir *dir, + int *filec, char **filev, int count_limit, off_t *mem, + int *dive_count, int flag); + +int Xorriso__start_end_lbas(IsoNode *node, + int *lba_count, int **start_lbas, int **end_lbas, + off_t *size, int flag); + +int Xorriso__file_start_lba(IsoNode *node, + int *lba, int flag); + +int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node, + off_t *damage_start, off_t *damage_end, + int flag); + +int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path, + IsoNode *node, int flag); + +int Xorriso_report_damage(struct XorrisO *xorriso, char *show_path, + IsoNode *node, int flag); + +int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag); + +int Xorriso_retrieve_disk_path(struct XorrisO *xorriso, IsoNode *node, + char disk_path[SfileadrL], int flag); + +#endif /* ! Xorriso_pvt_iso_tree_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/lib_mgt.c b/libisoburn/branches/1.1.8/xorriso/lib_mgt.c new file mode 100644 index 00000000..f959f237 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/lib_mgt.c @@ -0,0 +1,865 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains functions which manage the relation between xorriso + and the libraries: libburn, libisofs, libisoburn. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STDINT_H +#include +#else +#ifdef HAVE_INTTYPES_H +#include +#endif +#endif + +/* for -charset */ +#include +#include + +#ifdef Xorriso_standalonE + +#ifdef Xorriso_with_libjtE +#include "../libjte/libjte.h" +#endif + +#else + +#ifdef Xorriso_with_libjtE +#include +#endif + +#endif /* ! Xorriso_standalonE */ + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + +#include "lib_mgt.h" +#include "iso_manip.h" + + +int Xorriso_abort(struct XorrisO *xorriso, int flag) +{ + int ret; + + ret= burn_abort(4440, burn_abort_pacifier, "xorriso : "); + if(ret<=0) { + fprintf(stderr, + "\nxorriso : ABORT : Cannot cancel burn session and release drive.\n"); + return(0); + } + fprintf(stderr, + "xorriso : ABORT : Drive is released and library is shut down now.\n"); + fprintf(stderr, + "xorriso : ABORT : Program done. Even if you do not see a shell prompt.\n"); + fprintf(stderr, "\n"); + exit(1); +} + + +/* @param flag bit0= asynchronous handling (else catch thread, wait, and exit) + bit1= dealing with MMC drive in critical state + behavior 2 -> behavior 1 +*/ +int Xorriso_set_signal_handling(struct XorrisO *xorriso, int flag) +{ + char *handler_prefix= NULL; + int behavior, mode; + + behavior= Xorriso__get_signal_behavior(0); + if(behavior == 0) + return(2); + if(behavior == 2 && !(flag & 2)) + mode= 1; + else if(behavior == 3) + mode= 2; + else + mode= (flag & 1) * 0x30; + handler_prefix= calloc(strlen(xorriso->progname)+3+1, 1); + if(handler_prefix==NULL) { + sprintf(xorriso->info_text, + "Cannot allocate memory for setting signal handler"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(-1); + } + + /* <<< */ + sprintf(xorriso->info_text, "burn_set_signal_handling(%d)", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + sprintf(handler_prefix, "%s : ", xorriso->progname); + burn_set_signal_handling(handler_prefix, NULL, mode); + free(handler_prefix); + return(1); +} + + +int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag) +{ + int ret, major, minor, micro; + char *queue_sev, *print_sev, reason[1024]; + struct iso_zisofs_ctrl zisofs_ctrl= {0, 6, 15}; + + +/* First an ugly compile time check for header version compatibility. + If everthing matches, then no C code is produced. In case of mismatch, + intentionally faulty C code will be inserted. +*/ + +/* The minimum requirement of xorriso towards the libisoburn header + at compile time is defined in xorriso/xorrisoburn.h + xorriso_libisoburn_req_major + xorriso_libisoburn_req_minor + xorriso_libisoburn_req_micro + It gets compared against the version macros in libburn/libburn.h : + isoburn_header_version_major + isoburn_header_version_minor + isoburn_header_version_micro + If the header is too old then the following code shall cause failure of + cdrskin compilation rather than to allow production of a program with + unpredictable bugs or memory corruption. + The compiler messages supposed to appear in this case are: + error: 'LIBISOBURN_MISCONFIGURATION' undeclared (first use in this function) + error: 'INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisoburn_dot_h_TOO_OLD__SEE_xorrisoburn_dot_c' undeclared (first use in this function) + error: 'LIBISOBURN_MISCONFIGURATION_' undeclared (first use in this function) +*/ +/* The indendation is an advise of man gcc to help old compilers ignoring */ + #if xorriso_libisoburn_req_major > isoburn_header_version_major + #define Isoburn_libisoburn_dot_h_too_olD 1 + #endif + #if xorriso_libisoburn_req_major == isoburn_header_version_major && xorriso_libisoburn_req_minor > isoburn_header_version_minor + #define Isoburn_libisoburn_dot_h_too_olD 1 + #endif + #if xorriso_libisoburn_req_minor == isoburn_header_version_minor && xorriso_libisoburn_req_micro > isoburn_header_version_micro + #define Isoburn_libisoburn_dot_h_too_olD 1 + #endif + +#ifdef Isoburn_libisoburn_dot_h_too_olD +LIBISOBURN_MISCONFIGURATION = 0; +INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_libisoburn_dot_h_TOO_OLD__SEE_xorrisoburn_dot_c = 0; +LIBISOBURN_MISCONFIGURATION_ = 0; +#endif + +/* End of ugly compile time test (scroll up for explanation) */ + + reason[0]= 0; + ret= isoburn_initialize(reason, 0); + if(ret==0) { + sprintf(xorriso->info_text, "Cannot initialize libraries"); + if(reason[0]) + sprintf(xorriso->info_text+strlen(xorriso->info_text), + ". Reason given:\n%s", reason); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(0); + } + ret= isoburn_is_compatible(isoburn_header_version_major, + isoburn_header_version_minor, + isoburn_header_version_micro, 0); + if(ret<=0) { + isoburn_version(&major, &minor, µ); + sprintf(xorriso->info_text, + "libisoburn version too old: %d.%d.%d . Need at least: %d.%d.%d .\n", + major, minor, micro, + isoburn_header_version_major, isoburn_header_version_minor, + isoburn_header_version_micro); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(-1); + } + + xorriso->libs_are_started= 1; + + queue_sev= "ALL"; + if(xorriso->library_msg_direct_print) { + + /* >>> need option for controlling this in XorrisO. + See also Xorriso_msgs_submit */; + + print_sev= xorriso->report_about_text; + } else + print_sev= "NEVER"; + + iso_set_msgs_severities(queue_sev, print_sev, "libsofs : "); + burn_msgs_set_severities(queue_sev, print_sev, "libburn : "); + + /* ??? >>> do we want united queues ? */ + /* burn_set_messenger(iso_get_messenger()); */ + + isoburn_set_msgs_submit(Xorriso_msgs_submit_void, (void *) xorriso, + (3<<2) | 128 , 0); + + ret= Xorriso_set_signal_handling(xorriso, 0); + if(ret <= 0) + return(ret); + + ret = iso_zisofs_get_params(&zisofs_ctrl, 0); + if (ret == 1) { + xorriso->zisofs_block_size= xorriso->zisofs_block_size_default= + (1 << zisofs_ctrl.block_size_log2); + xorriso->zlib_level= xorriso->zlib_level_default= + zisofs_ctrl.compression_level; + } + + iso_node_xinfo_make_clonable(Xorriso__mark_update_xinfo, + Xorriso__mark_update_cloner, 0); + + /* Second initialization. This time with libs. */ + Xorriso_preparer_string(xorriso, xorriso->preparer_id, 0); + + Xorriso_process_msg_queues(xorriso,0); + if(reason[0]) { + sprintf(xorriso->info_text, "%s", reason); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + strcpy(xorriso->info_text, "Using "); + strncat(xorriso->info_text, burn_scsi_transport_id(0), 1024); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + return(1); +} + + +/* @param flag bit0= global shutdown of libraries */ +int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag) +{ + Xorriso_give_up_drive(xorriso, 3); + if(xorriso->in_volset_handle!=NULL) { /* standalone image */ + iso_image_unref((IsoImage *) xorriso->in_volset_handle); + xorriso->in_volset_handle= NULL; + Sectorbitmap_destroy(&(xorriso->in_sector_map), 0); + Xorriso_destroy_di_array(xorriso, 0); + Xorriso_destroy_hln_array(xorriso, 0); + xorriso->boot_count= 0; + } + if(flag&1) { + if(xorriso->libs_are_started==0) + return(0); + isoburn_finish(); + } + return(1); +} + + +/* @param flag bit0= suppress messages below UPDATE + bit1= suppress messages below FAILURE +*/ +int Xorriso_set_image_severities(struct XorrisO *xorriso, int flag) +{ + char *queue_sev, *print_sev; + + if(flag&2) + queue_sev= "FAILURE"; + else if(flag&1) + queue_sev= "UPDATE"; + else + queue_sev= "ALL"; + if(xorriso->library_msg_direct_print) + print_sev= xorriso->report_about_text; + else + print_sev= "NEVER"; + iso_set_msgs_severities(queue_sev, print_sev, "libisofs : "); + return(1); +} + + +/* @param flag bit0=prepare for a burn run */ +int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag) +{ + int ret, abort_on_number; + char *sev_text; + static int note_number= -1, failure_number= -1; + + if(note_number==-1) + Xorriso__text_to_sev("NOTE", ¬e_number, 0); + if(failure_number==-1) + Xorriso__text_to_sev("FAILURE", &failure_number, 0); + sev_text= xorriso->abort_on_text; + ret= Xorriso__text_to_sev(xorriso->abort_on_text, &abort_on_number, 0); + if(ret<=0) + return(ret); + if(abort_on_numberfailure_number) + sev_text= "FAILURE"; + ret= iso_set_abort_severity(sev_text); + return(ret>=0); +} + + +int Xorriso_report_lib_versions(struct XorrisO *xorriso, int flag) +{ + int major, minor, micro; + int req_major, req_minor, req_micro; + + iso_lib_version(&major, &minor, µ); + isoburn_libisofs_req(&req_major, &req_minor, &req_micro); + sprintf(xorriso->result_line, + "libisofs in use : %d.%d.%d (min. %d.%d.%d)\n", + major, minor, micro, req_major, req_minor, req_micro); + Xorriso_result(xorriso, 0); + +#ifdef Xorriso_with_libjtE + libjte__version(&major, &minor, µ); + isoburn_libjte_req(&req_major, &req_minor, &req_micro); + sprintf(xorriso->result_line, + "libjte in use : %d.%d.%d (min. %d.%d.%d)\n", + major, minor, micro, req_major, req_minor, req_micro); + Xorriso_result(xorriso, 0); +#endif + + burn_version(&major, &minor, µ); + isoburn_libburn_req(&req_major, &req_minor, &req_micro); + sprintf(xorriso->result_line, + "libburn in use : %d.%d.%d (min. %d.%d.%d)\n", + major, minor, micro, req_major, req_minor, req_micro); + Xorriso_result(xorriso, 0); + strcpy(xorriso->result_line, "libburn OS adapter: "); + strncat(xorriso->result_line, burn_scsi_transport_id(0), 1024); + strcat(xorriso->result_line, "\n"); + Xorriso_result(xorriso, 0); + isoburn_version(&major, &minor, µ); + sprintf(xorriso->result_line, + "libisoburn in use : %d.%d.%d (min. %d.%d.%d)\n", + major, minor, micro, + isoburn_header_version_major, isoburn_header_version_minor, + isoburn_header_version_micro); + Xorriso_result(xorriso, 0); + return(1); +} + + +int Xorriso__sev_to_text(int severity, char **severity_name, + int flag) +{ + int ret; + + ret= iso_sev_to_text(severity, severity_name); + if(ret>0) + return(ret); + ret= burn_sev_to_text(severity, severity_name, 0); + if(ret>0) + return(ret); + *severity_name= ""; + return(0); +} + + +int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag) +{ + int ret= 1; + char severity[20]; + + Xorriso__to_upper(severity_name, severity, (int) sizeof(severity), 0); + ret= iso_text_to_sev(severity, severity_number); + if(ret>0) + return(ret); + ret= burn_text_to_sev(severity, severity_number, 0); + return(ret); +} + + +/* @param flag bit0= report libisofs error text + bit1= victim is disk_path + bit2= do not inquire libisofs, report msg_text and min_severity +*/ +int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim, + int iso_error_code, char msg_text[], int os_errno, + char min_severity[], int flag) +{ + int error_code, iso_sev, min_sev, ret; + char *sev_text_pt, *msg_text_pt= NULL; + char *sfe= NULL; + static int sorry_sev= -1; + + Xorriso_alloc_meM(sfe, char, 6 * SfileadrL); + + if(sorry_sev<0) + Xorriso__text_to_sev("SORRY", &sorry_sev, 0); + + if(flag&4) { + error_code= 0x00050000; + Xorriso__text_to_sev(min_severity, &iso_sev, 0); + } else { + error_code= iso_error_get_code(iso_error_code); + if(error_code < 0x00030000 || error_code >= 0x00040000) + error_code= (error_code & 0xffff) | 0x00050000; + if(flag&1) + msg_text_pt= (char *) iso_error_to_msg(iso_error_code); + iso_sev= iso_error_get_severity(iso_error_code); + } + if(msg_text_pt==NULL) + msg_text_pt= msg_text; + + if(iso_sev >= sorry_sev && (flag & 2) && victim[0]) + Xorriso_msgs_submit(xorriso, 0, victim, 0, "ERRFILE", 0); + sev_text_pt= min_severity; + Xorriso__text_to_sev(min_severity, &min_sev, 0); + if(min_sev < iso_sev && !(flag&4)) + Xorriso__sev_to_text(iso_sev, &sev_text_pt, 0); + strcpy(sfe, msg_text_pt); + if(victim[0]) { + strcat(sfe, ": "); + Text_shellsafe(victim, sfe+strlen(sfe), 0); + } + ret= Xorriso_msgs_submit(xorriso, error_code, sfe, os_errno, sev_text_pt, 4); +ex:; + Xorriso_free_meM(sfe); + return(ret); +} + + +int Xorriso_get_local_charset(struct XorrisO *xorriso, char **name, int flag) +{ + (*name)= iso_get_local_charset(0); + return(1); +} + + +int Xorriso_set_local_charset(struct XorrisO *xorriso, char *name, int flag) +{ + int ret; + char *nl_charset; + iconv_t iconv_ret= (iconv_t) -1; + + nl_charset= nl_langinfo(CODESET); + if(name == NULL) + name= nl_charset; + + if(name != NULL) { + iconv_ret= iconv_open(nl_charset, name); + if(iconv_ret == (iconv_t) -1) + goto cannot; + else + iconv_close(iconv_ret); + } + ret= iso_set_local_charset(name, 0); + if(ret <= 0) { +cannot:; + sprintf(xorriso->info_text, + "-local_charset: Cannot assume as local character set: "); + Text_shellsafe(name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(0); + } + sprintf(xorriso->info_text, "Local character set is now assumed as: "); + Text_shellsafe(name, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); +} + + +int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag) +{ + int ret, error_code= 0, os_errno= 0, count= 0, pass, imgid, tunneled; + int name_prefix_code; + char severity[80]; + +#ifdef Xorriso_with_libjtE + char *msg; +#endif + + if(!xorriso->libs_are_started) + return(1); + for(pass= 0; pass< 3; pass++) { + while(1) { + tunneled= 0; + if(pass==0) { + + ret= 0; +#ifdef Xorriso_with_libjtE + if(xorriso->libjte_handle != NULL) { + msg= libjte_get_next_message(xorriso->libjte_handle); + if(msg != NULL) { + sprintf(xorriso->info_text, "%1.4095s", msg); + free(msg); + strcpy(severity, "NOTE"); + error_code= 0; + os_errno= 0; + ret= 1; + } + } +#endif /* Xorriso_with_libjtE */ + + } else if(pass==1) + ret= iso_obtain_msgs("ALL", &error_code, &imgid, + xorriso->info_text, severity); + else { + ret= burn_msgs_obtain("ALL", &error_code, xorriso->info_text, &os_errno, + severity); + if((error_code>=0x00030000 && error_code<0x00040000) || + (error_code>=0x00050000 && error_code<0x00060000)) + tunneled= -1; /* "libisofs:" */ + else if(error_code>=0x00060000 && error_code<0x00070000) + tunneled= 1; /* "libisoburn:" */ + } + if(ret<=0) + break; + + /* <<< tunneled MISHAP from libisoburn through libburn + or well known error codes of MISHAP events + With libburn-0.4.4 this is not necessary */ + if(error_code==0x5ff73 || error_code==0x3ff73 || + error_code==0x3feb9 || error_code==0x3feb2) + strcpy(severity, "MISHAP"); + else if(error_code==0x51001) + strcpy(severity, "ERRFILE"); + + if(pass == 0) + name_prefix_code= 0; + else + name_prefix_code= pass + tunneled; + Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno, + severity, name_prefix_code << 2); + count++; + } + } + if(xorriso->library_msg_direct_print && count>0) { + sprintf(xorriso->info_text," (%d library messages repeated by xorriso)\n", + count); + Xorriso_info(xorriso, 0); + } + return(1); +} + + +int Xorriso_md5_start(struct XorrisO *xorriso, void **ctx, int flag) +{ + int ret; + + ret= iso_md5_start(ctx); + if(ret == 1) + return(1); + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); +} + + +int Xorriso_md5_compute(struct XorrisO *xorriso, void *ctx, + char *data, int datalen, int flag) +{ + iso_md5_compute(ctx, data, datalen); + return(1); +} + + +int Xorriso_md5_end(struct XorrisO *xorriso, void **ctx, char md5[16], + int flag) +{ + int ret; + + ret= iso_md5_end(ctx, md5); + Xorriso_process_msg_queues(xorriso,0); + if(ret <= 0) + return(0); + return(1); +} + + +/* @param flag bit0= avoid library calls + */ +int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129], + int flag) +{ + int major, minor, micro; + + xorriso_id[0]= 0; + sprintf(xorriso_id, "XORRISO-%d.%d.%d ", + Xorriso_header_version_majoR, Xorriso_header_version_minoR, + Xorriso_header_version_micrO); + if(strlen(xorriso_id) + strlen(Xorriso_timestamP) < 128) + strcat(xorriso_id, Xorriso_timestamP); + if(flag & 1) + return(1); + isoburn_version(&major, &minor, µ); + if(strlen(xorriso_id) < 100) + sprintf(xorriso_id + strlen(xorriso_id), + ", LIBISOBURN-%d.%d.%d", major, minor, micro); + iso_lib_version(&major, &minor, µ); + if(strlen(xorriso_id) < 100) + sprintf(xorriso_id + strlen(xorriso_id), + ", LIBISOFS-%d.%d.%d", major, minor, micro); + burn_version(&major, &minor, µ); + if(strlen(xorriso_id) < 100) + sprintf(xorriso_id + strlen(xorriso_id), + ", LIBBURN-%d.%d.%d", major, minor, micro); + return(1); +} + + +#ifdef Xorriso_with_libjtE + +int Xorriso_assert_jte_handle(struct XorrisO *xorriso, int flag) +{ + int ret; + + if(xorriso->libjte_handle == NULL) { + ret= libjte_new(&(xorriso->libjte_handle), 0); + if(ret <= 0 || xorriso->libjte_handle == NULL) { + sprintf(xorriso->info_text, + "-jigdo: Failed to create libjte environment object"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(-1); + } + /* no stderr, no exit() */ + libjte_set_error_behavior(xorriso->libjte_handle, 0, 0); + } + return(1); +} + +#endif /* Xorriso_with_libjtE */ + + +int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg, + int flag) +{ + +#ifdef Xorriso_with_libjtE + + int ret, num; + struct libjte_env *jte; + char *msg = NULL; + + if(strcmp(aspect, "clear") == 0) { + if(xorriso->libjte_handle != NULL) + libjte_destroy(&(xorriso->libjte_handle)); + Xorriso_lst_destroy_all(&(xorriso->jigdo_params), 0); + Xorriso_lst_destroy_all(&(xorriso->jigdo_values), 0); + xorriso->libjte_params_given= 0; + return(1); + } + ret= Xorriso_assert_jte_handle(xorriso, 0); + if(ret <= 0) + return(ret); + jte= xorriso->libjte_handle; + + if(strcmp(aspect, "verbose") == 0) { + if(strcmp(arg, "on") == 0) { + libjte_set_verbose(jte, 1); + /* Direct libjte messages to stderr, rather than message list */ + libjte_set_error_behavior(xorriso->libjte_handle, 1, 0); + xorriso->libjte_params_given|= 2; + } else if(strcmp(arg, "off") == 0) { + libjte_set_verbose(jte, 0); + libjte_set_error_behavior(xorriso->libjte_handle, 0, 0); + xorriso->libjte_params_given&= ~2; + } else + goto bad_arg; + } else if(strcmp(aspect, "template_path") == 0 || + strcmp(aspect, "-jigdo-template") == 0) { + ret= libjte_set_template_path(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 4; + } else if(strcmp(aspect, "jigdo_path") == 0 || + strcmp(aspect, "-jigdo-jigdo") == 0) { + ret= libjte_set_jigdo_path(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 8; + } else if(strcmp(aspect, "md5_path") == 0 || + strcmp(aspect, "-md5-list") == 0) { + ret= libjte_set_md5_path(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 16; + } else if(strcmp(aspect, "min_size") == 0 || + strcmp(aspect, "-jigdo-min-file-size") == 0) { + num= Scanf_io_size(arg, 0); + ret= libjte_set_min_size(jte, num); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 32; + } else if(strcmp(aspect, "checksum_iso") == 0 || + strcmp(aspect, "-checksum_algorithm_iso") == 0) { + ret= libjte_set_checksum_iso(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 64; + } else if(strcmp(aspect, "checksum_template") == 0 || + strcmp(aspect, "-checksum_algorithm_template") == 0) { + ret= libjte_set_checksum_template(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 128; + } else if(strcmp(aspect, "compression") == 0 || + strcmp(aspect, "-jigdo-template-compress") == 0) { + ret= libjte_set_compression(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 256; + } else if(strcmp(aspect, "exclude") == 0 || + strcmp(aspect, "-jigdo-exclude") == 0) { + ret= libjte_add_exclude(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 512; + } else if(strcmp(aspect, "demand_md5") == 0 || + strcmp(aspect, "-jigdo-force-md5") == 0) { + ret= libjte_add_md5_demand(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 1024; + } else if(strcmp(aspect, "mapping") == 0 || + strcmp(aspect, "-jigdo-map") == 0) { + ret= libjte_add_mapping(jte, arg); + if(ret <= 0) + goto jte_failed; + xorriso->libjte_params_given|= 2048; + } else { + sprintf(xorriso->info_text, "-jigdo: unknown aspect '%s'", aspect); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + + ret= Xorriso_lst_new(&(xorriso->jigdo_params), aspect, xorriso->jigdo_params, + 1); + if(ret > 0) + ret= Xorriso_lst_new(&(xorriso->jigdo_values), arg, xorriso->jigdo_values, + 1); + if(ret <= 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + Xorriso_process_msg_queues(xorriso, 0); + return(1); + +bad_arg: + sprintf(xorriso->info_text, "-jigdo %s : unknown argument '%s'", aspect, arg); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + +jte_failed: + while(1) { + msg= libjte_get_next_message(xorriso->libjte_handle); + if(msg == NULL) + break; + sprintf(xorriso->info_text, "%1.4095s", msg); + free(msg); + msg= NULL; + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + sprintf(xorriso->info_text, "Experienced libjte failure with: -jigdo %s %s", + aspect, arg); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + +#else /* Xorriso_with_libjtE */ + + sprintf(xorriso->info_text, + "Jigdo Template Extraction was not enabled at compile time"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + +#endif /* ! Xorriso_with_libjtE */ + +} + + +int Xorriso_list_extras_result(struct XorrisO *xorriso, char *mode, + char *what, int flag) +{ + if(mode[0] != 0 && strcmp(mode, "all") != 0) { + if(strcmp(mode, what) != 0 && + (mode[0] != '-' || strcmp(mode + 1, what) != 0)) + return(2); + } + Xorriso_result(xorriso, 0); + return(1); +} + + +int Xorriso_list_extras(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret; + + if(strcmp(mode, "codes") == 0) { + sprintf(xorriso->result_line, + "List of xorriso extra feature codes. Usable with or without dash.\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Local ACL : -acl\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Local xattr : -xattr\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Jigdo files : -jigdo\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "zisofs : -zisofs\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Ext. filters : -external_filter\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "DVD obs 64 kB: -dvd_obs\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Readline : -use_readline\n"); + Xorriso_result(xorriso, 0); + return(1); + } + sprintf(xorriso->result_line, + "List of xorriso extra features. yes = enabled , no = disabled\n"); + Xorriso_list_extras_result(xorriso, mode, "list_extras", 0); + + ret= iso_local_attr_support(3); + sprintf(xorriso->result_line, "Local ACL : %s\n", ret & 1 ? "yes" : "no"); + Xorriso_list_extras_result(xorriso, mode, "acl", 0); + sprintf(xorriso->result_line, "Local xattr : %s\n", ret & 2 ? "yes" : "no"); + Xorriso_list_extras_result(xorriso, mode, "xattr", 0); + + sprintf(xorriso->result_line, "Jigdo files : %s\n", +#ifdef Xorriso_with_libjtE + "yes"); +#else + "no"); +#endif + Xorriso_list_extras_result(xorriso, mode, "jigdo", 0); + + ret= iso_file_add_zisofs_filter(NULL, 4); + sprintf(xorriso->result_line, "zisofs : %s\n", ret == 2 ? "yes" : "no"); + Xorriso_list_extras_result(xorriso, mode, "zisofs", 0); + + sprintf(xorriso->result_line, "Ext. filters : %s\n", +#ifdef Xorriso_allow_external_filterS +#ifdef Xorriso_allow_extf_suiD + "yes , setuid allowed"); +#else + "yes , setuid banned"); +#endif +#else + "no"); +#endif + Xorriso_list_extras_result(xorriso, mode, "external_filter", 0); + + sprintf(xorriso->result_line, "DVD obs 64 kB: %s\n", +#ifdef Xorriso_dvd_obs_default_64K + "yes"); +#else + "no"); +#endif + Xorriso_list_extras_result(xorriso, mode, "dvd_obs", 0); + + sprintf(xorriso->result_line, "Readline : %s\n", +#ifdef Xorriso_with_readlinE + "yes"); +#else + "no"); +#endif + Xorriso_list_extras_result(xorriso, mode, "use_readline", 0); + + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/lib_mgt.h b/libisoburn/branches/1.1.8/xorriso/lib_mgt.h new file mode 100644 index 00000000..1912df00 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/lib_mgt.h @@ -0,0 +1,73 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains declarations of functions which manage the relation + between xorriso and the libraries: libburn, libisofs, and libisoburn. +*/ + + +#ifndef Xorriso_pvt_x_includeD +#define Xorriso_pvt_x_includeD yes + + +#ifndef Xorriso_standalonE + +/* The library which does the ISO 9660 / RockRidge manipulations */ +#include + +/* The library which does MMC optical drive operations */ +#include + +/* The library which enhances overwriteable media with ISO 9660 multi-session + capabilities via the method invented by Andy Polyakov for growisofs */ +#include + +/* The official xorriso options API. "No shortcuts" */ +#include "xorriso.h" + +/* The inner description of XorrisO */ +#include "xorriso_private.h" + +/* The inner isofs- and burn-library interface */ +#include "xorrisoburn.h" + +#else /* ! Xorriso_standalonE */ + +#include "../libisofs/libisofs.h" +#include "../libburn/libburn.h" +#include "../libisoburn/libisoburn.h" +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + +#endif /* Xorriso_standalonE */ + + +int Xorriso_abort(struct XorrisO *xorriso, int flag); + + +/* @param flag bit0= suppress messages below UPDATE + bit1= suppress messages below FAILURE +*/ +int Xorriso_set_image_severities(struct XorrisO *xorriso, int flag); + +int Xorriso__sev_to_text(int severity, char **severity_name, + int flag); + +/* @param flag bit0= report libisofs error text + bit1= victim is disk_path + bit2= do not inquire libisofs, report msg_text and min_severity +*/ +int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim, + int iso_error_code, char msg_text[], int os_errno, + char min_severity[], int flag); + +int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag); + + +#endif /* ! Xorriso_pvt_x_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/make_docs.sh b/libisoburn/branches/1.1.8/xorriso/make_docs.sh new file mode 100755 index 00000000..0a97ee90 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/make_docs.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Produce man page xorriso/xorriso.1 and info file xorriso/xorriso.info +# from base file xorriso/xorriso.texi. +# Same for xorriso/xorrisofs.texi and xorriso/xorrecord.texi. + +( cd xorriso ; makeinfo ./xorriso.texi ) +( cd xorriso ; makeinfo ./xorrisofs.texi ) +( cd xorriso ; makeinfo ./xorrecord.texi ) + +xorriso/make_xorriso_1 -auto +xorriso/make_xorriso_1 -auto -xorrisofs +xorriso/make_xorriso_1 -auto -xorrecord + + diff --git a/libisoburn/branches/1.1.8/xorriso/make_timestamp.sh b/libisoburn/branches/1.1.8/xorriso/make_timestamp.sh new file mode 100755 index 00000000..d6cfcb57 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/make_timestamp.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# Create version timestamp xorriso/xorriso_timestamp.h +# to be executed within ./libisoburn-develop + +timestamp="$(date -u '+%Y.%m.%d.%H%M%S')" +echo "Version timestamp : $timestamp" +echo '#define Xorriso_timestamP "'"$timestamp"'"' >xorriso/xorriso_timestamp.h + diff --git a/libisoburn/branches/1.1.8/xorriso/make_xorriso_1.c b/libisoburn/branches/1.1.8/xorriso/make_xorriso_1.c new file mode 100644 index 00000000..788fd6ab --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/make_xorriso_1.c @@ -0,0 +1,526 @@ + +/* + ( cd xorriso ; cc -g -Wall -o make_xorriso_1 make_xorriso_1.c ) +*/ +/* + Specialized converter from xorriso/xorriso.texi to xorriso/xorriso.1 + resp. from xorriso/xorrisofs.texi to xorriso/xorrisofs.1 + + The conversion rules are described at the beginning of xorriso/xorriso.texi + + Copyright 2010 - 2011 Thomas Schmitt, + + Provided under GPL version 2 or later. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include + + +/* The conversion state +*/ +struct Mx1 { + + char prog[4096]; + + int count_in; + int count_out; + + int skipping; /* <0 stacked skipping , 0= no , >0 counting down */ + +}; + +int Mx1_substitute(struct Mx1 *m, char line_in[256], char line_out[256], + int raw, int upto, int flag); + + + +int Mx1_init(struct Mx1 *m, char *prog, int flag) +{ + strncpy(m->prog, prog, sizeof(m->prog) - 1); + m->prog[sizeof(m->prog) - 1]= 0; + m->count_in= 0; + m->count_out= 0; + m->skipping= 0; + return(1); +} + + +int Mx1_report_error(struct Mx1 *m, char *text, int flag) +{ + fprintf(stderr, "%s : line %d : %s\n", m->prog, m->count_in, text); + return(1); +} + + +int Mx1__get_word(char *line, char word[256], char **remainder, int flag) +{ + char *cpt, *start; + int l; + + word[0]= 0; + *remainder= NULL; + for(cpt= line; *cpt != 0 && isspace(*cpt); cpt++); + if(*cpt == 0) + return(0); + start= cpt; + for(cpt= line; *cpt != 0 && ! isspace(*cpt); cpt++); + l= cpt - start; + if(l > 0) + strncpy(word, start, l); + word[l]= 0; + *remainder= cpt; + return(1); +} + + +int Mx1_is_wrap(struct Mx1 *m, char wraps[][20], char *start, char **found, + int flag) +{ + int i; + + for(i= 0; wraps[i][0] != 0; i++) + if(strncmp(start, wraps[i], strlen(wraps[i])) == 0) + break; + if(wraps[i][0] != 0) { + if(found != NULL) + *found= wraps[i]; + return(1); + } + return(0); +} + + +int Mx1_is_bold_wrap(struct Mx1 *m, char *start, char **found, int flag) +{ + int ret; + static char bold_wraps[][20]= { + "@b{", "@dfn{", "@emph{", "@strong{", "@command{", + "" }; + + ret= Mx1_is_wrap(m, bold_wraps, start, found, 0); + return(ret); +} + + +int Mx1_is_normal_wrap(struct Mx1 *m, char *start, char **found, int flag) +{ + int ret; + static char normal_wraps[][20]= { + "@var{", "@code{", "@i{", "@abbr{", "@file{", "@option{", "@samp{", "@r{", + "" }; + + ret= Mx1_is_wrap(m, normal_wraps, start, found, 0); + return(ret); +} + + +int Mx1_is_ignored_wrap(struct Mx1 *m, char *start, char **found, int flag) +{ + int ret; + static char ignored_wraps[][20]= { + "@ref{", "@xref{", + "" }; + + ret= Mx1_is_wrap(m, ignored_wraps, start, found, 0); + return(ret); +} + + +int Mx1_is_any_wrap(struct Mx1 *m, char *start, char **found, int flag) +{ + int ret; + + ret= Mx1_is_bold_wrap(m, start, found, 0); + if(ret > 0) + return(1); + ret= Mx1_is_normal_wrap(m, start, found, 0); + if(ret > 0) + return(2); + ret= Mx1_is_ignored_wrap(m, start, found, 0); + if(ret > 0) + return(3); + return(0); +} + + +/* @param flag bit0= recursion + bit1= drop content of brackets +*/ +int Mx1_rewrap(struct Mx1 *m, char **read_pt, char **write_pt, + char *write_base, char *envelope, + char *front, char *back, int flag) +{ + char *rpt, *wpt, *ept, content[256], msg[256]; + int l, ret; + + rpt= *read_pt; + wpt= *write_pt; + + ept= strchr(rpt, '}'); + if(ept == NULL) { + sprintf(msg, "No closing bracket found for '%s'", envelope); + Mx1_report_error(m, msg, 0); + return(-1); + } + /* Mapped {...} content is subject to the rules except {...} mapping. */ + l= ept - rpt; + if(flag & 2) + l= 0; + if(l > 0) { + ret= Mx1_substitute(m, rpt, content, 0, l, 1); + if(ret <= 0) + return(ret); + l= strlen(content); + } + if((wpt - write_base) + l + strlen(front) + strlen(back) > 255) { + Mx1_report_error(m, "Line length overflow while text substitution", 0); + return(-1); + } + strcpy(wpt, front); + wpt+= strlen(front); + if(l > 0) + strncpy(wpt, content, l); + wpt+= l; + strcpy(wpt, back); + wpt+= strlen(back); + + (*read_pt)+= ept - rpt; + (*write_pt)= wpt; + return(1); +} + + +/* @param flag bit0= recursion +*/ +int Mx1_substitute(struct Mx1 *m, char line_in[256], char line_out[256], + int raw, int upto, int flag) +{ + char *rpt, *wpt, *found; + int ret, typ= 0; + + wpt= line_out; + for(rpt= line_in; rpt - line_in < upto && *rpt != 0; rpt++) { + if(rpt - line_in < raw) { + *(wpt++)= *rpt; + continue; + } + if(*rpt == '@') { + typ= 0; + if(!(flag & 1)) + typ= Mx1_is_any_wrap(m, rpt, &found, 0); + if(typ == 1) { + /* @b{...}, @command{...}, @dfn{...}, @emph{...}, @strong{...} + get mapped to \fB...\fR . + */ + rpt+= strlen(found); + ret= Mx1_rewrap(m, &rpt, &wpt, line_out, + found , "\\fB", "\\fR", flag & 1); + if(ret <= 0) + return(ret); + + } else if(typ == 2) { + /* @abbr{...}, @code{...}, @file{...}, @i{...}, @option{...}, @r{...}, + @ref{...}, @samp{...},@var{...}, get mapped to ... . + */ + rpt+= strlen(found); + ret= Mx1_rewrap(m, &rpt, &wpt, line_out, found, "", "", flag & 1); + if(ret <= 0) + return(ret); + + } else if(typ == 3) { + /* @ref{...}, @xref{...} get mapped to empty text. + */ + rpt+= strlen(found); + ret= Mx1_rewrap(m, &rpt, &wpt, line_out, found , "", "", + (flag & 1) | 2); + if(ret <= 0) + return(ret); + + } else if(strncmp(rpt, "@email{", 7) == 0 && !(flag & 1)) { + /* @email{...} gets mapped to <...> . */ + rpt+= 7; + ret= Mx1_rewrap(m, &rpt, &wpt, line_out, "@email{", "<", ">", 0); + if(ret <= 0) + return(ret); + + } else if(strncmp(rpt, "@minus{}", 8) == 0) { + /* @minus{} will become "-". */ + if((wpt - line_out) + 1 > 255) + goto overflow; + *(wpt++)= '-'; + rpt+= 7; + + } else if(strncmp(rpt, "@@", 2) == 0 || + strncmp(rpt, "@{", 2) == 0 || + strncmp(rpt, "@}", 2) == 0) { + /* @@ , @{, @} will get stripped of their first @. */ + if((wpt - line_out) + 1 > 255) + goto overflow; + *(wpt++)= *(rpt + 1); + rpt++; + + } else { + if((wpt - line_out) + 1 > 255) + goto overflow; + *(wpt++)= *(rpt); + + } + + } else if(*rpt == '\\') { + /* "\" becomes "\\" */ + if((wpt - line_out) + 2 > 255) + goto overflow; + *(wpt++)= '\\'; + *(wpt++)= '\\'; + + } else if((wpt - line_out) + 1 > 255) { +overflow:; + Mx1_report_error(m, "Line length overflow while text substitution", 0); + return(-1); + } else + *(wpt++)= *rpt; + + } + *wpt= 0; + return(1); +} + + +/* + @return 1= line_out is valid, 0= do not put out line_out, -1 = error +*/ +int Mx1_convert(struct Mx1 *m, char line_in[256], char line_out[256], int flag) +{ + int l, num, keep= 0, ret, raw, i, backslash_count; + char word[256], buf[256], *remainder, *wpt; + + m->count_in++; + l= strlen(line_in); + + if(m->skipping > 0) { + m->skipping--; + return(0); + } + + /* The first line gets discarded. */ + if(m->count_in == 1) + return(0); + + /* Line start "@c man " will become "", the remainder is put out unaltered. */ + if(strncmp(line_in, "@c man ", 7) == 0) { + strcpy(line_out, line_in + 7); + m->count_out++; + return(1); + } + + /* Lines "@*" will be converted to ".br" */ + if(strcmp(line_in, "@*") == 0) { + strcpy(line_out, ".br"); + m->count_out++; + return(1); + } + + /* @c man-ignore-lines N will discard N following lines. + "@c man-ignore-lines begin" discards all following lines + up to "@c man-ignore-lines end". + */ + if(strncmp(line_in, "@c man-ignore-lines ", 20) == 0) { + if(strcmp(line_in + 20, "begin") == 0) { + m->skipping--; + return(0); + } else if(strcmp(line_in + 20, "end") == 0) { + if(m->skipping < 0) + m->skipping++; + return(0); + } else if(m->skipping == 0) { + num= 0; + sscanf(line_in + 20, "%d", &num); + if(num > 0) { + m->skipping= num; + return(0); + } + } + Mx1_report_error(m, "Inappropriate use of '@c man-ignore-lines'", 0); + return(-1); + } + + /* Line blocks of "@menu" "@end menu" will be discarded. */ + if(strcmp(line_in, "@menu") == 0) { + m->skipping--; + return(0); + } + if(strcmp(line_in, "@end menu") == 0) { + if(m->skipping < 0) + m->skipping++; + return(0); + } + if(m->skipping) + return(0); + + /* "@item -word words" becomes "\fB\-word\fR words". */ + /* "@item word words" becomes "\fBword\fR words". */ + if(strncmp(line_in, "@item ", 6) == 0) { + ret= Mx1__get_word(line_in + 6, word, &remainder, 0); + if(ret <= 0) { + Mx1_report_error(m, "Found no word after @item", 0); + return(0); + } + strcpy(buf, "\\fB"); + if(word[0] == '-') { + if(l >= 255) { + Mx1_report_error(m, "Line length overflow while converting @item", 0); + return(-1); + } + strcat(buf, "\\"); + } + + /* Substitute option text */ + raw= strlen(buf); + strcat(buf, word); + ret= Mx1_substitute(m, buf, line_out, raw, strlen(buf), 0); + if(ret <= 0) + return(-1); + strcpy(buf, line_out); + + strcat(buf, "\\fR"); + raw= strlen(buf); + strcat(buf, remainder); + + /* Substitute arguments text */ + ret= Mx1_substitute(m, buf, line_out, raw, strlen(buf), 0); + if(ret <= 0) + return(-1); + m->count_out++; + return(1); + } + + /* @strong{... } gets mapped to \fB...\fR . */ + /* @command{... } gets mapped to \fB...\fR . */ + /* @minus{} will become "-". */ + /* Mapped {...} content is subject to the rules except {...} mapping. */ + /* @@ , @{, @} will get stripped of their first @. */ + /* "\" becomes "\\" */ + + if(line_in[0] != '@' || + Mx1_is_any_wrap(m, line_in, NULL, 0) > 0 || + strncmp(line_in, "@minus{}", 8) == 0 || + strncmp(line_in, "@@", 2) == 0 || + strncmp(line_in, "@{", 2) == 0 || + strncmp(line_in, "@}", 2) == 0 ) { + keep= 1; + ret= Mx1_substitute(m, line_in, line_out, 0, strlen(line_in), 0); + if(ret <= 0) + return(-1); + } + + /* Other lines which begin by "@" will be discarded. */ + if(! keep) { + if(line_in[0] == '@') + return(0); + strcpy(line_out, line_in); + } + + /* "-" which are not preceded by an uneven number of "\" will get + prepended one "\". + */ + l= strlen(line_out); + backslash_count= 0; + wpt= buf; + for(i= 0; i < l; i++) { + if(line_out[i] == '\\') + backslash_count++; + else if(line_out[i] == '-') { + if(backslash_count % 2 == 0) + *(wpt++)= '\\'; + backslash_count= 0; + } else + backslash_count= 0; + *(wpt++)= line_out[i]; + } + *wpt= 0; + strcpy(line_out, buf); + m->count_out++; + return(1); +} + + +int main(int argc, char **argv) +{ + int ret, l, as_filter= 0, i; + char line_in[256], line_out[256], *got; + static char name_in[1024]= {"xorriso/xorriso.texi"}; + static char name_out[1024]= {"xorriso/xorriso.1"}; + struct Mx1 m; + FILE *fp_in= stdin, *fp_out= stdout; + + Mx1_init(&m, argv[0], 0); + + if(argc < 2) { +usage:; + fprintf(stderr, "usage: %s -auto|-filter [-xorrisofs]\n", argv[0]); + fprintf(stderr, " -auto xorriso/xorriso.texi -> xorriso/xorriso.1\n"); + fprintf(stderr, " -filter stdin -> stdout\n"); + fprintf(stderr, " -xorrisofs process xorriso/xorrisofs.texi\n"); + exit(2); + } + for(i= 1; i < argc; i++) { + if(strcmp(argv[i], "-filter") == 0) { + as_filter= 1; + } else if(strcmp(argv[i], "-auto") == 0) { + as_filter= 0; + } else if(strcmp(argv[i], "-xorrisofs") == 0) { + strcpy(name_in, "xorriso/xorrisofs.texi"); + strcpy(name_out, "xorriso/xorrisofs.1"); + } else if(strcmp(argv[i], "-xorrecord") == 0) { + strcpy(name_in, "xorriso/xorrecord.texi"); + strcpy(name_out, "xorriso/xorrecord.1"); + } else { + fprintf(stderr, "%s : unknown option %s\n", argv[0], argv[i]); + goto usage; + } + } + + if(!as_filter) { + fp_in= fopen(name_in, "r"); + if(fp_in == NULL) { + fprintf(stderr, "%s : failed to fopen( %s ,r) : %d %s\n", + argv[0], name_in, errno, strerror(errno)); + exit(3); + } + fp_out= fopen(name_out, "w"); + if(fp_out == NULL) { + fprintf(stderr, "%s : failed to fopen( %s ,w) : %d %s\n", + argv[0], name_out, errno, strerror(errno)); + exit(4); + } + } + while(1) { + got= fgets(line_in, sizeof(line_in), fp_in); + if(got == NULL) + break; + l= strlen(line_in); + while(l > 0) { + if(line_in[l - 1] == '\r' || line_in[l - 1] == '\n') { + line_in[l - 1] = 0; + l--; + } else + break; + } + ret= Mx1_convert(&m, line_in, line_out, 0); + if(ret < 0) + exit(1); + if(ret == 0) + continue; + fprintf(fp_out, "%s\n", line_out); + } + exit(0); +} diff --git a/libisoburn/branches/1.1.8/xorriso/make_xorriso_standalone.sh b/libisoburn/branches/1.1.8/xorriso/make_xorriso_standalone.sh new file mode 100755 index 00000000..3cd2e45d --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/make_xorriso_standalone.sh @@ -0,0 +1,344 @@ +#!/bin/sh + +# make_xorriso_standalone.sh +# Copyright 2008 - 2011 Thomas Schmitt, scdbackup@gmx.net, GPLv2+ +# +# Not intended for general use in production installations ! +# +# This is a development tool which expects a special setup of directories. +# It is to be executed in a common parent of the directories +# nglibisofs-develop jte-develop libburn-develop libisoburn-develop +# where tarballs or repository copies have been installed of +# libisofs jte libburn libisoburn +# obtained according to instructions on http://libburnia-project.org. +# +# It creates a new directory tree +# xorriso-standalone +# for building GNU xorriso. +# +# The ./bootstrap script gets applied and a source tarball +# is made. +# +# From that tree can be build a binary xorriso/xorriso which at runtime +# does not depend on installed libburnia libraries. +# Execute in xorriso-standalone : +# +# ./configure && make +# + +# By the variable setting create_gnu_xorriso="yes" +# the result will become a GNU xorriso tarball under GPLv3+. +# Without this setting, the result is technically equivalent but +# stays under GPLv2+. In that case the files xorriso/*_gnu_xorriso +# are merely informative. +# Note that it is not permissible to revert the transition from +# GPLv2+ to GPLv3+. (Rather derive a new GPLv2+ from libburnia.) + +create_gnu_xorriso="yes" + + +current_dir=$(pwd) +lone_dir="$current_dir"/"xorriso-standalone" + +xorriso_rev=1.1.7 +# For unstable uploads and patch level 0 of stable releases: +xorriso_pl="" +# For higher patch levels of stable releases: +## xorriso_pl=".pl01" + +with_bootstrap_tarball=1 + +create_dir() { + if mkdir "$1" + then + dummy=dummy + else + echo "Failed to create : $1" >&2 + exit 1 + fi +} + +goto_dir() { + if cd "$1" + then + dummy=dummy + else + echo "Failed to cd $1" >&2 + exit 1 + fi +} + +copy_files() { + if cp "$@" + then + dummy=dummy + else + echo "Failed to : cp " "$@" >&2 + exit 1 + fi +} + +if test -e "$lone_dir" +then + echo "Already existing : $lone_dir" >&2 + exit 1 +fi + + +# Top level directory + +goto_dir "$current_dir"/libisoburn-develop + +create_dir "$lone_dir" + +copy_files \ + AUTHORS \ + CONTRIBUTORS \ + COPYRIGHT \ + COPYING \ + INSTALL \ + acinclude.m4 \ + aclocal.m4 \ + bootstrap \ + compile \ + config.guess \ + config.status \ + config.sub \ + depcomp \ + install-sh \ + libtool \ + ltmain.sh \ + missing \ + mkinstalldirs \ + version.h.in \ + \ + "$lone_dir" + +copy_files xorriso/xorriso_bootstrap.txt "$lone_dir"/bootstrap + +copy_files xorriso/configure_ac.txt "$lone_dir"/configure.ac + +copy_files xorriso/xorriso_makefile_am.txt "$lone_dir"/Makefile.am + + +# libisoburn + +create_dir "$lone_dir"/libisoburn +copy_files \ + libisoburn/*.[ch] \ + "$lone_dir"/libisoburn +copy_files COPYRIGHT "$lone_dir"/libisoburn + +xorriso/convert_man_to_html.sh + +create_dir "$lone_dir"/xorriso +copy_files \ + xorriso/xorriso.h \ + xorriso/xorriso_private.h \ + xorriso/sfile.h \ + xorriso/sfile.c \ + xorriso/aux_objects.h \ + xorriso/aux_objects.c \ + xorriso/findjob.h \ + xorriso/findjob.c \ + xorriso/check_media.h \ + xorriso/check_media.c \ + xorriso/misc_funct.h \ + xorriso/misc_funct.c \ + xorriso/text_io.h \ + xorriso/text_io.c \ + xorriso/match.h \ + xorriso/match.c \ + xorriso/emulators.h \ + xorriso/emulators.c \ + xorriso/disk_ops.h \ + xorriso/disk_ops.c \ + xorriso/cmp_update.h \ + xorriso/cmp_update.c \ + xorriso/parse_exec.h \ + xorriso/parse_exec.c \ + xorriso/opts_a_c.c \ + xorriso/opts_d_h.c \ + xorriso/opts_i_o.c \ + xorriso/opts_p_z.c \ + \ + xorriso/xorrisoburn.h \ + xorriso/base_obj.h \ + xorriso/base_obj.c \ + xorriso/lib_mgt.h \ + xorriso/lib_mgt.c \ + xorriso/sort_cmp.h \ + xorriso/sort_cmp.c \ + xorriso/drive_mgt.h \ + xorriso/drive_mgt.c \ + xorriso/iso_img.h \ + xorriso/iso_img.c \ + xorriso/iso_tree.h \ + xorriso/iso_tree.c \ + xorriso/iso_manip.h \ + xorriso/iso_manip.c \ + xorriso/write_run.h \ + xorriso/write_run.c \ + xorriso/read_run.h \ + xorriso/read_run.c \ + xorriso/filters.h \ + xorriso/filters.c \ + \ + xorriso/xorriso_main.c \ + xorriso/xorriso_timestamp.h \ + \ + xorriso/changelog.txt \ + xorriso/xorriso_eng.html \ + xorriso/make_docs.sh \ + xorriso/xorriso.texi \ + xorriso/xorriso.info \ + xorriso/xorrisofs.texi \ + xorriso/xorrisofs.info \ + xorriso/xorrecord.texi \ + xorriso/xorrecord.info \ + xorriso/make_xorriso_1.c \ + xorriso/xorriso.1 \ + xorriso/xorrisofs.1 \ + xorriso/xorrecord.1 \ + xorriso/man_1_xorriso.html \ + xorriso/man_1_xorrisofs.html \ + xorriso/man_1_xorrecord.html \ + "$lone_dir"/xorriso +copy_files COPYRIGHT "$lone_dir"/xorriso + +copy_files xorriso/xorriso_buildstamp_none.h \ + "$lone_dir"/xorriso/xorriso_buildstamp.h +copy_files xorriso/xorriso_buildstamp_none.h \ + "$lone_dir"/xorriso/xorriso_buildstamp_none.h + +create_dir "$lone_dir"/doc +copy_files doc/partition_offset.wiki \ + doc/startup_file.txt \ + doc/qemu_xorriso.wiki \ + "$lone_dir"/doc + +create_dir "$lone_dir"/test +copy_files \ + test/compare_file.c \ + "$lone_dir"/test/compare_file.c + + +# nglibisofs + +create_dir "$lone_dir"/libisofs +create_dir "$lone_dir"/libisofs/filters +goto_dir "$current_dir"/nglibisofs-develop +copy_files libisofs/*.[ch] "$lone_dir"/libisofs +copy_files libisofs/filters/*.[ch] "$lone_dir"/libisofs/filters +copy_files doc/susp_aaip*.txt "$lone_dir"/doc +copy_files doc/zisofs_format.txt "$lone_dir"/doc +copy_files doc/checksums.txt "$lone_dir"/doc +copy_files doc/boot_sectors.txt "$lone_dir"/doc +copy_files COPYRIGHT "$lone_dir"/libisofs +test -e CONTRIBUTORS && cat CONTRIBUTORS >>"$lone_dir"/CONTRIBUTORS + +# To get a common version.h +cat version.h.in >> "$lone_dir"/version.h.in + + +# libjte + +create_dir "$lone_dir"/libjte +goto_dir "$current_dir"/jte-develop +copy_files *.[ch] "$lone_dir"/libjte +copy_files COPYRIGHT "$lone_dir"/libjte +# +# Now using libisoburn/releng/jigdo-gen-md5-list because in jigit it is +# restricted to Linux and FreeBSD. +goto_dir "$current_dir"/libisoburn-develop/releng +copy_files jigdo-gen-md5-list jigdo-gen-md5-list.1 "$lone_dir"/libjte + + +# libburn + +create_dir "$lone_dir"/libburn +goto_dir "$current_dir"/libburn-develop +copy_files libburn/*.[ch] "$lone_dir"/libburn +copy_files COPYRIGHT "$lone_dir"/libburn +cat CONTRIBUTORS >>"$lone_dir"/CONTRIBUTORS + +# Delete a source module of yet unclear ancestry. +# The build process will avoid to use it. +rm "$lone_dir"/libburn/crc.c + + +# To get a common version.h +cat version.h.in >> "$lone_dir"/version.h.in + +# Decision about legal situation +goto_dir "$current_dir"/libisoburn-develop +if test "$create_gnu_xorriso" = "yes" +then + copy_files xorriso/README_gnu_xorriso "$lone_dir"/README + copy_files xorriso/COPYRIGHT_gnu_xorriso "$lone_dir"/COPYRIGHT + copy_files xorriso/COPYING_gnu_xorriso "$lone_dir"/COPYING + copy_files xorriso/AUTHORS_gnu_xorriso "$lone_dir"/AUTHORS + + # patch xorriso/xorriso.h to be GNU xorriso + sed -e's/define Xorriso_libburnia_xorrisO/define Xorriso_GNU_xorrisO/' \ + -e's/This may be changed to Xorriso_GNU_xorrisO in order to c/C/' \ + "$lone_dir"/xorriso/xorriso.h + +else + + copy_files README "$lone_dir"/README + +fi + + +# tarball + +if test "$with_bootstrap_tarball" = 1 +then + +tarball_dir="$current_dir"/xorriso-"$xorriso_rev""$xorriso_pl" +mv "$lone_dir" "$tarball_dir" + +goto_dir "$tarball_dir" + +./bootstrap + +# Remove unneeded temporary data from ./bootstrap +rm -r ./autom4te.cache + +# Repair non-portable shell code output of ./bootstrap +( + cd "$compile_dir" || exit 1 + sed -e 's/^for ac_header in$/test -z 1 \&\& for ac_header in dummy/' \ + < ./configure > ./configure-repaired + if test "$?" = 0 + then + echo "$0: Empty 'for ac_header in' found in configure." >&2 + fi + mv ./configure-repaired ./configure + chmod a+rx,go-w,u+w ./configure +) + +if test "$create_gnu_xorriso" = "yes" +then + # ftp-upload@gnu.org rejects Makefile.in with a dangerous chmod on make dist + sed -e 's/-perm -777 -exec chmod a+rwx/-perm -755 -exec chmod u+rwx,go+rx/' \ + < Makefile.in > new_Makefile.in + + mv new_Makefile.in Makefile.in +fi + + +cd "$current_dir" +tar czf ./xorriso-"$xorriso_rev""$xorriso_pl".tar.gz $(basename "$tarball_dir") + +ls -l $(pwd)/xorriso-"$xorriso_rev""$xorriso_pl".tar.gz + +mv "$tarball_dir" "$lone_dir" + +fi + +echo "Done" +echo "HINT: Now build xorriso/xorriso by:" +echo " cd '$lone_dir' && ./configure && make" +echo diff --git a/libisoburn/branches/1.1.8/xorriso/man_xorrecord_to_html.sh b/libisoburn/branches/1.1.8/xorriso/man_xorrecord_to_html.sh new file mode 100755 index 00000000..8b85b8bd --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/man_xorrecord_to_html.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# +# man_xorrecord_to_html.sh - ts A80118 , B10309 +# +# Generates a HTML version of man page xorrecord.1 +# +# To be executed in the libisoburn toplevel directory (eg. ./libisoburn-0.1.0) +# + +# set -x + +man_dir=$(pwd)"/xorriso" +export MANPATH="$man_dir" +manpage="xorrecord" +raw_html=$(pwd)/"xorriso/raw_man_1_xorrecord.html" +htmlpage=$(pwd)/"xorriso/man_1_xorrecord.html" + +if test -r "$man_dir"/"$manpage".1 +then + dummy=dummy +else + echo "Cannot find readable man page source $1" >&2 + exit 1 +fi + +if test -e "$man_dir"/man1 +then + dummy=dummy +else + ln -s . "$man_dir"/man1 +fi + +if test "$1" = "-work_as_filter" +then + +# set -x + + sed \ + -e 's///' \ + -e 's///' \ + -e 's/XORRECORD<\/title>/<title>man 1 xorrecord<\/title>/' \ + -e 's/<h1 align=center>XORRECORD<\/h1>/<h1 align=center>man 1 xorrecord<\/h1>/' \ + -e 's/<body>/<body BGCOLOR="#F5DEB3" TEXT=#000000 LINK=#0000A0 VLINK=#800000>/' \ + -e 's/<b>MMC, Session, Track, Media types:<\/b>/\ <BR><b>MMC, Session, Track, Media types:<\/b>/' \ + -e 's/<b>MMC, Session, Track, Media types:<\/b>/\ <BR><b>MMC, Session, Track, Media types:<\/b>/' \ + -e 's/<b>Relation to program xorriso:<\/b>/\ <BR><b>Relation to program xorriso:<\/b>/' \ + -e 's/EXAMPLES):<br>/<A HREF="#EXAMPLES">EXAMPLES<\/A>):<br>/' \ + -e 's/<b>Drive addressing:<\/b>/\ <BR><b>Drive addressing:<\/b><BR>\ <BR>/' \ + -e 's/<b>Inquiring drive and media:<\/b>/\ <BR><b>Inquiring drive and media:<\/b><BR>\ <BR>/' \ + -e 's/<b>Settings for the burn run<\/b>/\ <BR><b>Settings for the burn run:<\/b><BR>\ <BR>/' \ + -e 's/<b>Program version and verbosity:<\/b>/\ <BR><b>Program version and verbosity:<\/b><BR>\ <BR>/' \ + -e 's/<b>Options not compatible to cdrecord:<\/b>/\ <BR><b>Options not compatible to cdrecord:<\/b><BR>\ <BR>/' \ +\ + -e 's/<\/body>/<BR><HR><FONT SIZE=-1><CENTER>(HTML generated from '"$manpage"'.1 on '"$(date)"' by '$(basename "$0")' )<\/CENTER><\/FONT><\/body>/' \ + -e 's/−/-/g' \ + <"$2" >"$htmlpage" + + set +x + + chmod u+rw,go+r,go-w "$htmlpage" + echo "Emerged file:" + ls -lL "$htmlpage" + +else + + export BROWSER='cp "%s" '"$raw_html" + man -H "$manpage" + "$0" -work_as_filter "$raw_html" + rm "$raw_html" + rm "$man_dir"/man1 + +fi diff --git a/libisoburn/branches/1.1.8/xorriso/man_xorriso_to_html.sh b/libisoburn/branches/1.1.8/xorriso/man_xorriso_to_html.sh new file mode 100755 index 00000000..89b1427b --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/man_xorriso_to_html.sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# man_xorriso_to_html.sh - ts A80118 , B10309 +# +# Generates a HTML version of man page xorriso.1 +# +# To be executed in the libisoburn toplevel directory (eg. ./libisoburn-0.1.0) +# + +# set -x + +man_dir=$(pwd)"/xorriso" +export MANPATH="$man_dir" +manpage="xorriso" +raw_html=$(pwd)/"xorriso/raw_man_1_xorriso.html" +htmlpage=$(pwd)/"xorriso/man_1_xorriso.html" + +if test -r "$man_dir"/"$manpage".1 +then + dummy=dummy +else + echo "Cannot find readable man page source $1" >&2 + exit 1 +fi + +if test -e "$man_dir"/man1 +then + dummy=dummy +else + ln -s . "$man_dir"/man1 +fi + +if test "$1" = "-work_as_filter" +then + +# set -x + + sed \ + -e 's/<meta name="generator" content="groff -Thtml, see www.gnu.org">/<meta name="generator" content="groff -Thtml, via man -H, via xorriso\/convert_man_to_html.sh">/' \ + -e 's/<meta name="Content-Style" content="text\/css">/<meta name="Content-Style" content="text\/css"><META NAME="description" CONTENT="man page of xorriso"><META NAME="keywords" CONTENT="man xorriso, manual, xorriso, CD, CD-RW, CD-R, burning, cdrecord, compatible"><META NAME="robots" CONTENT="follow">/' \ + -e 's/<title>XORRISO<\/title>/<title>man 1 xorriso<\/title>/' \ + -e 's/<h1 align=center>XORRISO<\/h1>/<h1 align=center>man 1 xorriso<\/h1>/' \ + -e 's/<body>/<body BGCOLOR="#F5DEB3" TEXT=#000000 LINK=#0000A0 VLINK=#800000>/' \ + -e 's/<b>Overview of features:<\/b>/\ <BR><b>Overview of features:<\/b>/' \ + -e 's/<b>General information paragraphs:<\/b>/\ <BR><b>General information paragraphs:<\/b>/' \ + -e 's/have a look at section EXAMPLES/have a look at section <A HREF="#EXAMPLES">EXAMPLES<\/A>/' \ + -e 's/<b>Session model:<\/b>/\ <BR><b>Session model:<\/b>/' \ + -e 's/<b>Media types and states:<\/b>/\ <BR><b>Media types and states:<\/b>/' \ + -e 's/<b>Creating, Growing, Modifying, Blind/\ <BR><b>Creating, Growing, Modifying, Blind/' \ + -e 's/<b>Libburn drives:<\/b>/\ <BR><b>Libburn drives:<\/b>/' \ + -e 's/^-dev /\ \ -dev /' \ + -e 's/^-devices /\ \ -devices /' \ + -e 's/<b>Rock Ridge, POSIX, X\/Open, El Torito, ACL,/\ <BR><b>Rock Ridge, POSIX, X\/Open, El Torito, ACL,/' \ + -e 's/<b>Command processing:<\/b>/\ <BR><b>Command processing:<\/b>/' \ + -e 's/<b>Dialog, Readline, Result pager:<\/b>/\ <BR><b>Dialog, Readline, Result pager:<\/b>/' \ + -e 's/<b>Aquiring source and target drive:<\/b>/\ <BR><b>Aquiring source and target drive:<\/b><BR>\ <BR>/' \ + -e 's/<b>Influencing the behavior of image/\ <BR><b>Influencing the behavior of image/' \ + -e 's/<b>Inserting files into ISO image:<\/b>/\ <BR><b>Inserting files into ISO image:<\/b><BR>\ <BR>/' \ + -e 's/<b>File manipulations:<\/b>/\ <BR><b>File manipulations:<\/b><BR>\ <BR>/' \ + -e 's/<b>Tree traversal command -find:<\/b>/\ <BR><b>Tree traversal command -find:<\/b><BR>\ <BR>/' \ + -e 's/^<p><b>−iso_rr_pattern/<p>\ <BR><b>\−iso_rr_pattern/' \ + -e 's/EXAMPLES):<br>/<A HREF="#EXAMPLES">EXAMPLES<\/A>):<br>/' \ + -e 's/<b>Filters for data file content:<\/b>/\ <BR><b>Filters for data file content:<\/b><BR>\ <BR>/' \ + -e 's/<b>Writing the result, drive control:<\/b>/\ <BR><b>Writing the result, drive control:<\/b><BR>\ <BR>/' \ + -e 's/^-find \/ /\ \ -find \/ /' \ + -e 's/<b>Settings for file insertion:<\/b>/\ <BR><b>Settings for file insertion:<\/b><BR>\ <BR>/' \ + -e 's/^$<\/b> ln -s/\ \ $<\/b> ln -s/' \ + -e 's/<b>Settings for result writing:<\/b>/\ <BR><b>Settings for result writing:<\/b><BR>\ <BR>/' \ + -e 's/^706k = 706kB/\ \ 706k = 706kB/' \ + -e 's/^5540k = 5540kB/\ \ 5540k = 5540kB/' \ + -e 's/<b>Character sets:<\/b>/\ <BR><b>Character sets:<\/b><BR>\ <BR>/' \ + -e 's/<b>Exception processing:<\/b>/\ <BR><b>Exception processing:<\/b><BR>\ <BR>/' \ + -e 's/<b>El Torito bootable ISO images:<\/b>/\ <BR><b>El Torito bootable ISO images:<\/b><BR>\ <BR>/' \ + -e 's/<b>Jigdo Template Extraction:<\/b>/\ <BR><b>Jigdo Template Extraction:<\/b><BR>\ <BR>/' \ + -e 's/<b>Dialog mode control:<\/b>/\ <BR><b>Dialog mode control:<\/b><BR>\ <BR>/' \ + -e 's/<b>Drive and media related inquiry actions:<\/b>/\ <BR><b>Drive and media related inquiry actions:<\/b><BR>\ <BR>/' \ + -e 's/<b>Navigation in ISO image/\ <BR><b>Navigation in ISO image/' \ + -e 's/^filesystem:<\/b>/filesystem:<\/b><BR>\ <BR>/' \ + -e 's/<b>Evaluation of readability and recovery:<\/b>/\ <BR><b>Evaluation of readability and recovery:<\/b><BR>\ <BR>/' \ + -e 's/<b>osirrox ISO-to-disk restore options:<\/b>/\ <BR><b>osirrox ISO-to-disk restore options:<\/b><BR>\ <BR>/' \ + -e 's/<b>Command compatibility emulations:<\/b>/\ <BR><b>Command compatibility emulations:<\/b><BR>\ <BR>/' \ + -e 's/^<p><b>−as</<p>\ <BR><b>\−as</' \ + -e 's/<b>Scripting, dialog and/\ <BR><b>Scripting, dialog and/' \ + -e 's/^features:<\/b>/features:<\/b><BR>\ <BR>/' \ + -e 's/<b>Support for frontend/\ <BR><b>Support for frontend/' \ + -e 's/^listening at stdout:<\/b>/listening at stdout:<\/b><BR>\ <BR>/' \ + -e 's/xorriso -outdev \/dev\/sr2 \\ -blank fast \\ -pathspecs on/xorriso -outdev \/dev\/sr2 -blank fast -pathspecs on/' \ + -e 's/\\ -add \\ \/sounds=\/home\/me\/sounds \\ \/pictures \\ -- \\ -rm_r \\/ -add \/sounds=\/home\/me\/sounds \/pictures -- -rm_r /' \ + -e 's/\/sounds\/indecent \\ \’\/pictures\/\*private\*\’ \\/\/sounds\/indecent \’\/pictures\/*private*\’ /' \ + -e 's/\/pictures\/confidential \\ -- \\ -add \\/\/pictures\/confidential -- -add/' \ + -e 's/xorriso -dev \/dev\/sr2 \\ -rm_r \/sounds -- \\ -mv \\/xorriso -dev \/dev\/sr2 -rm_r \/sounds -- -mv /' \ + -e 's/\/pictures\/confidential \\ \/pictures\/restricted \\ -- \\ -chmod/\/pictures\/confidential \/pictures\/restricted -- -chmod/' \ + -e 's/go-rwx \/pictures\/restricted -- \\ -pathsspecs on \\ -add \\/go-rwx \/pictures\/restricted -- -pathsspecs on -add /' \ + -e 's/\/sounds=\/home\/me\/prepared_for_dvd\/sounds_dummy /\/sounds=\/home\/me\/prepared_for_dvd\/sounds_dummy/' \ + -e 's/\/movies=\/home\/me\/prepared_for_dvd\/movies \\ -- \\ -commit/\/movies=\/home\/me\/prepared_for_dvd\/movies -- -commit/' \ + -e 's/xorriso -indev \/dev\/sr2 \\ -rm_r \/sounds -- \\/xorriso -indev \/dev\/sr2 -rm_r \/sounds -- /' \ + -e 's/-outdev \/dev\/sr0 -blank fast \\ -commit -eject all/-outdev \/dev\/sr0 -blank fast -commit -eject all/' \ + -e 's/See section FILES/See section <A HREF="#FILES">FILES<\/A>/' \ + -e 's/See section EXAMPLES/See section <A HREF="#EXAMPLES">EXAMPLES<\/A>/' \ + -e 's/<\/body>/<BR><HR><FONT SIZE=-1><CENTER>(HTML generated from '"$manpage"'.1 on '"$(date)"' by '$(basename "$0")' )<\/CENTER><\/FONT><\/body>/' \ + -e 's/−/-/g' \ + <"$2" >"$htmlpage" + + set +x + + chmod u+rw,go+r,go-w "$htmlpage" + echo "Emerged file:" + ls -lL "$htmlpage" + +else + + export BROWSER='cp "%s" '"$raw_html" + man -H "$manpage" + "$0" -work_as_filter "$raw_html" + rm "$raw_html" + rm "$man_dir"/man1 + +fi diff --git a/libisoburn/branches/1.1.8/xorriso/man_xorrisofs_to_html.sh b/libisoburn/branches/1.1.8/xorriso/man_xorrisofs_to_html.sh new file mode 100755 index 00000000..9e813535 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/man_xorrisofs_to_html.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# +# man_xorrisofs_to_html.sh - ts A80118 , B10309 +# +# Generates a HTML version of man page xorrisofs.1 +# +# To be executed in the libisoburn toplevel directory (eg. ./libisoburn-0.1.0) +# + +# set -x + +man_dir=$(pwd)"/xorriso" +export MANPATH="$man_dir" +manpage="xorrisofs" +raw_html=$(pwd)/"xorriso/raw_man_1_xorrisofs.html" +htmlpage=$(pwd)/"xorriso/man_1_xorrisofs.html" + +if test -r "$man_dir"/"$manpage".1 +then + dummy=dummy +else + echo "Cannot find readable man page source $1" >&2 + exit 1 +fi + +if test -e "$man_dir"/man1 +then + dummy=dummy +else + ln -s . "$man_dir"/man1 +fi + +if test "$1" = "-work_as_filter" +then + +# set -x + + sed \ + -e 's/<meta name="generator" content="groff -Thtml, see www.gnu.org">/<meta name="generator" content="groff -Thtml, via man -H, via xorriso\/convert_man_to_html.sh">/' \ + -e 's/<meta name="Content-Style" content="text\/css">/<meta name="Content-Style" content="text\/css"><META NAME="description" CONTENT="man page of xorriso"><META NAME="keywords" CONTENT="man xorrisofs, manual, xorrisofs, ISO 9660, mkisofs, compatible"><META NAME="robots" CONTENT="follow">/' \ + -e 's/<title>XORRISOFS<\/title>/<title>man 1 xorrisofs<\/title>/' \ + -e 's/<h1 align=center>XORRISOFS<\/h1>/<h1 align=center>man 1 xorrisofs<\/h1>/' \ + -e 's/<body>/<body BGCOLOR="#F5DEB3" TEXT=#000000 LINK=#0000A0 VLINK=#800000>/' \ + -e 's/<b>ISO 9660, Rock Ridge, Joliet:<\/b>/\ <BR><b>ISO 9660, Rock Ridge, Joliet:<\/b>/' \ + -e 's/<b>Inserting files into the ISO image:<\/b>/\ <BR><b>Inserting files into the ISO image:<\/b>/' \ + -e 's/<b>Relation to program xorriso:<\/b>/\ <BR><b>Relation to program xorriso:<\/b>/' \ + -e 's/EXAMPLES):<br>/<A HREF="#EXAMPLES">EXAMPLES<\/A>):<br>/' \ + -e 's/<b>Image loading:<\/b>/\ <BR><b>Image loading:<\/b><BR>\ <BR>/' \ + -e 's/<b>Settings for file insertion:<\/b>/\ <BR><b>Settings for file insertion:<\/b><BR>\ <BR>/' \ + -e 's/<b>Settings for image production:<\/b>/\ <BR><b>Settings for image production:<\/b><BR>\ <BR>/' \ + -e 's/<b>Settings for standards compliance:<\/b>/\ <BR><b>Settings for standards compliance:<\/b><BR>\ <BR>/' \ + -e 's/<b>Settings for standards extensions:<\/b>/\ <BR><b>Settings for standards extensions:<\/b><BR>\ <BR>/' \ + -e 's/<b>Settings for file hiding:<\/b>/\ <BR><b>Settings for file hiding:<\/b><BR>\ <BR>/' \ + -e 's/<b>ISO image ID strings:<\/b>/\ <BR><b>ISO image ID strings:<\/b><BR>\ <BR>/' \ + -e 's/<b>El Torito Bootable ISO images:<\/b>/\ <BR><b>El Torito Bootable ISO images:<\/b><BR>\ <BR>/' \ + -e 's/<b>System Area, MBR, other boot blocks:<\/b>/\ <BR><b>System Area, MBR, other boot blocks:<\/b><BR>\ <BR>/' \ + -e 's/<b>Character sets:<\/b>/\ <BR><b>Character sets:<\/b><BR>\ <BR>/' \ + -e 's/<b>Jigdo Template Extraction:<\/b>/\ <BR><b>Jigdo Template Extraction:<\/b><BR>\ <BR>/' \ + -e 's/<b>Miscellaneous options:<\/b>/\ <BR><b>Miscellaneous options:<\/b><BR>\ <BR>/' \ +\ + -e 's/<\/body>/<BR><HR><FONT SIZE=-1><CENTER>(HTML generated from '"$manpage"'.1 on '"$(date)"' by '$(basename "$0")' )<\/CENTER><\/FONT><\/body>/' \ + -e 's/−/-/g' \ + <"$2" >"$htmlpage" + + set +x + + chmod u+rw,go+r,go-w "$htmlpage" + echo "Emerged file:" + ls -lL "$htmlpage" + +else + + export BROWSER='cp "%s" '"$raw_html" + man -H "$manpage" + "$0" -work_as_filter "$raw_html" + rm "$raw_html" + rm "$man_dir"/man1 + +fi diff --git a/libisoburn/branches/1.1.8/xorriso/match.c b/libisoburn/branches/1.1.8/xorriso/match.c new file mode 100644 index 00000000..469a06be --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/match.c @@ -0,0 +1,773 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of functions for pattern matching. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <fcntl.h> +#include <errno.h> + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* @param flag bit0= do not augment relative structured search by xorriso->wdi + bit1= return 2 if bonked at start point by .. + (caller then aborts or retries without bit0) + bit2= eventually prepend wdx rather than wdi + @return <=0 error, 1= ok, 2= with bit1: relative pattern exceeds start point +*/ +int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag) +{ + int l,ret,i,count,bonked= 0,is_constant,is_still_relative= 0, adr_size; + char *cpt,*npt,*adr_part= NULL, *absolute_adr= NULL, *adr_start,*wd; + + adr_size= 2 * SfileadrL; + Xorriso_alloc_meM(adr_part, char, adr_size); + Xorriso_alloc_meM(absolute_adr, char, adr_size); + + if(flag&4) + wd= xorriso->wdx; + else + wd= xorriso->wdi; + + if(xorriso->search_mode>=2 && xorriso->search_mode<=4) { + if(xorriso->search_mode==3 || xorriso->search_mode==4) { + l= strlen(adr)+strlen(wd)+1; + if(l * 2 + 2 > ((int) sizeof(xorriso->reg_expr)) || l * 2 + 2 > adr_size){ + sprintf(xorriso->info_text,"Search pattern too long"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + Xorriso_destroy_re(xorriso,0); + if(xorriso->structured_search && xorriso->search_mode==3) { + if(adr[0]!='/') + is_still_relative= 1; + if(is_still_relative && !(flag&1)) { + /* relative expression : prepend working directory */ + sprintf(absolute_adr,"%s/%s",wd,adr); + adr_start= absolute_adr; + xorriso->prepended_wd= 1; + is_still_relative= 0; + } else + adr_start= adr; + /* count slashes */; + cpt= adr_start; + while(*cpt=='/') + cpt++; + for(i= 0;1;i++) { + cpt= strchr(cpt,'/'); + if(cpt==NULL) + break; + while(*cpt=='/') + cpt++; + } + count= i+1; + xorriso->re= TSOB_FELD(regex_t,count); + if(xorriso->re==NULL) + {ret= -1; goto ex;} + xorriso->re_constants= TSOB_FELD(char *,count); + if(xorriso->re_constants==NULL) + {ret= -1; goto ex;} + for(i= 0;i<count;i++) + xorriso->re_constants[i]= NULL; + xorriso->re_count= count; + xorriso->re_fill= 0; + + /* loop over slash chunks*/; + cpt= adr_start; + xorriso->re_fill= 0; + while(*cpt=='/') + cpt++; + for(i= 0;i<count;i++) { + npt= strchr(cpt,'/'); + if(npt==NULL) { + if((int) strlen(cpt) >= adr_size) + {ret= -1; goto ex;} + strcpy(adr_part,cpt); + } else { + if(npt-cpt >= adr_size) + {ret= -1; goto ex;} + strncpy(adr_part,cpt,npt-cpt); + adr_part[npt-cpt]= 0; + } + + if(adr_part[0]==0) + goto next_adr_part; + if(adr_part[0]=='.' && adr_part[1]==0 && + (xorriso->re_fill>0 || i<count-1)) + goto next_adr_part; + if(adr_part[0]=='.' && adr_part[1]=='.' && adr_part[2]==0) { + /* delete previous part */ + if(xorriso->re_fill <= 0) { + bonked= 1; + goto next_adr_part; + } + if(xorriso->re_constants[xorriso->re_fill-1]!=NULL) { + free(xorriso->re_constants[xorriso->re_fill-1]); + xorriso->re_constants[xorriso->re_fill-1]= NULL; + } else + regfree(&(xorriso->re[xorriso->re_fill-1])); + (xorriso->re_fill)--; + goto next_adr_part; + } + if(strcmp(adr_part,"*")==0) { + adr_part[0]= 0; + ret= 2; + } else + ret= Xorriso__bourne_to_reg(adr_part,xorriso->reg_expr,0); + if(ret==2) { + if(Sregex_string(&(xorriso->re_constants[xorriso->re_fill]),adr_part,0) + <=0) + {ret= -1; goto ex;} + } else { + if(regcomp(&(xorriso->re[xorriso->re_fill]),xorriso->reg_expr,0)!=0) + goto cannot_compile; + } + xorriso->re_fill++; +next_adr_part:; + if(i==count-1) + break; + cpt= npt+1; + while(*cpt=='/') + cpt++; + } + if(bonked) { + if(flag&2) + {ret= 2; goto ex;} + sprintf(xorriso->info_text, "Your '..' bonked at the %s directory.", + is_still_relative ? "working" : "root"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE",0); + {ret= 0; goto ex;} + } + + Xorriso__bourne_to_reg(adr_start,xorriso->reg_expr,0); /* just for show */ + + } else { + is_constant= 0; + if(strcmp(adr,"*")==0 || adr[0]==0) { + is_constant= 1; + } else if(xorriso->search_mode==3 || xorriso->search_mode==4) { + ret= Xorriso__bourne_to_reg(adr,xorriso->reg_expr,0); + is_constant= (ret==2); + } else { + if(strlen(adr)>=sizeof(xorriso->reg_expr)) + {ret= -1; goto ex;} + strcpy(xorriso->reg_expr,adr); + } + xorriso->re_count= 0; /* tells matcher that this is not structured */ + xorriso->re_constants= TSOB_FELD(char *,1); + if(xorriso->re_constants==NULL) + {ret= -1; goto ex;} + xorriso->re_constants[0]= NULL; + if(is_constant) { + if(strcmp(adr,"*")==0) { + if(Sregex_string(&(xorriso->re_constants[0]),"",0)<=0) + {ret= -1; goto ex;} + } else { + if(Sregex_string(&(xorriso->re_constants[0]),adr,0)<=0) + {ret= -1; goto ex;} + } + xorriso->re_fill= 1; + } else { + xorriso->re= TSOB_FELD(regex_t,1); + if(xorriso->re==NULL) + {ret= -1; goto ex;} + if(regcomp(&(xorriso->re[0]),xorriso->reg_expr,0)!=0) { +cannot_compile:; + sprintf(xorriso->info_text, "Cannot compile regular expression : %s", + xorriso->reg_expr); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE",0); + {ret= 0; goto ex;} + } + } + + } + } + ret= 1; +ex:; + Xorriso_free_meM(adr_part); + Xorriso_free_meM(absolute_adr); + return(ret); +} + + +/* @param flag bit0= do not shortcut last component of to_match + bit1= consider match if regex matches parent of path + bit2= retry beginning at failed last component + + @return 0=match , else no match +*/ +int Xorriso_regexec(struct XorrisO *xorriso, char *to_match, int *failed_at, + int flag) +{ + int ret,i,re_start= 0,reg_nomatch= -1; + char *cpt,*npt, *adr_part= NULL, *mpt; + + Xorriso_alloc_meM(adr_part, char, SfileadrL); + + reg_nomatch= REG_NOMATCH; + + *failed_at= 0; + if(!(xorriso->structured_search && xorriso->re_count>0)) { + if(xorriso->re_constants!=NULL) + if(xorriso->re_constants[0]!=NULL) { + if(xorriso->re_constants[0][0]==0) + {ret= 0; goto ex;} + if(strcmp(xorriso->re_constants[0],to_match)!=0) + {ret= reg_nomatch; goto ex;} + {ret= 0; goto ex;} + } + ret= regexec(&(xorriso->re[0]),to_match,1,xorriso->match,0); + goto ex; + } + + cpt= to_match; + while(*cpt=='/') + cpt++; + if(flag&4) + re_start= xorriso->re_failed_at; + if(re_start<0) + re_start= 0; + for(i= re_start;i<xorriso->re_fill;i++) { + *failed_at= i; + npt= strchr(cpt,'/'); + if(npt==NULL) { + if(i<xorriso->re_fill-1 && !(flag&1)) + {ret= reg_nomatch; goto ex;} /* this must be the last expression part */ + mpt= cpt; + } else { + strncpy(adr_part,cpt,npt-cpt); + adr_part[npt-cpt]= 0; + mpt= adr_part; + } + if(xorriso->re_constants[i]!=NULL) { + if(xorriso->re_constants[i][0]!=0) /* empty constant matches anything */ + if(strcmp(xorriso->re_constants[i],mpt)!=0) + {ret= reg_nomatch; goto ex;} + } else { + ret= regexec(&(xorriso->re[i]),mpt,1,xorriso->match,0); + if(ret!=0) + goto ex; + } + if(npt==NULL) { + if(i>=xorriso->re_fill-1) + {ret= 0; goto ex;} /* MATCH */ + *failed_at= i+1; + {ret= reg_nomatch; goto ex;} + } + cpt= npt+1; + while(*cpt=='/') + cpt++; + } + *failed_at= xorriso->re_fill; + if(flag & 2) + {ret= 0; goto ex;} /* MATCH */ + ret= reg_nomatch; +ex:; + Xorriso_free_meM(adr_part); + return(ret); +} + + +int Xorriso_is_in_patternlist(struct XorrisO *xorriso, + struct Xorriso_lsT *patternlist, char *path, + int flag) +{ + int ret, failed_at, i= 0; + struct Xorriso_lsT *s; + + xorriso->search_mode= 3; + xorriso->structured_search= 1; + + for(s= patternlist; s != NULL; s= Xorriso_lst_get_next(s, 0)) { + ret= Xorriso_prepare_regex(xorriso, Xorriso_lst_get_text(s, 0), 0); + if(ret <= 0) + return(-1); + /* Match path or parent of path */ + ret= Xorriso_regexec(xorriso, path, &failed_at, 2); + if(ret == 0) + return(i + 1); + i++; + } + return(0); +} + + +char *Xorriso_get_pattern(struct XorrisO *xorriso, + struct Xorriso_lsT *patternlist, int index, int flag) +{ + int i= 0; + struct Xorriso_lsT *s; + + for(s= patternlist; s != NULL; s= Xorriso_lst_get_next(s, 0)) { + if(i == index) + return(Xorriso_lst_get_text(s, 0)); + i++; + } + return(NULL); +} + + + +/* @param flag bit2= this is a disk_pattern + @return <=0 failure , 1 pattern ok , 2 pattern needed prepended wd */ +int Xorriso_prepare_expansion_pattern(struct XorrisO *xorriso, char *pattern, + int flag) +{ + int ret, prepwd= 0; + + ret= Xorriso_prepare_regex(xorriso, pattern, 1|2|(flag&4)); + if(ret==2) { + ret= Xorriso_prepare_regex(xorriso, pattern, flag&4); + prepwd= 1; + } + if(ret<=0) { + sprintf(xorriso->info_text, + "Cannot compile pattern to regular expression: %s", pattern); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1+prepwd); +} + + +/* @param flag bit0= count results rather than storing them + bit1= unexpected change of number is a FATAL event + @return <=0 error , 1 is root (end processing) , + 2 is not root (go on processing) +*/ +int Xorriso_check_for_root_pattern(struct XorrisO *xorriso, + int *filec, char **filev, int count_limit, off_t *mem, int flag) +{ + if(xorriso->re_fill!=0) + return(2); + /* This is the empty pattern representing root */ + if(flag&1) { + (*filec)++; + (*mem)+= 8; + } else { + if(*filec >= count_limit) { + sprintf(xorriso->info_text, + "Number of matching files changed unexpectedly (> %d)", + count_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (flag&2 ? "FATAL" : "WARNING"), 0); + return(flag&2 ? -1 : 0); + } + filev[*filec]= strdup("/"); + if(filev[*filec]==NULL) { + Xorriso_no_pattern_memory(xorriso, (off_t) 2, 0); + return(-1); + } + (*filec)++; + } + return(1); +} + + +/* @param flag bit0= count result rather than storing it + bit1= unexpected change of number is a FATAL event +*/ +int Xorriso_register_matched_adr(struct XorrisO *xorriso, + char *adr, int count_limit, + int *filec, char **filev, off_t *mem, int flag) +{ + int l; + + if(flag&1) { + (*filec)++; + l= strlen(adr)+1; + (*mem)+= sizeof(char *)+l; + if(l % sizeof(char *)) + (*mem)+= sizeof(char *)-(l % sizeof(char *)); + } else { + if(*filec >= count_limit) { + sprintf(xorriso->info_text, + "Number of matching files changed unexpectedly (> %d)", + count_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (flag&2 ? "FATAL" : "WARNING"), 0); + return(flag&2 ? -1 : 0); + } + filev[*filec]= strdup(adr); + if(filev[*filec]==NULL) { + Xorriso_no_pattern_memory(xorriso, (off_t) (strlen(adr)+1), 0); + return(-1); + } + (*filec)++; + } + return(1); +} + + +/* @param flag bit0= count results rather than storing them + bit1= this is a recursion + bit2= prepend wd (automatically done if wd[0]!=0) + @return <=0 error , 1 ok , 2 could not open directory +*/ +int Xorriso_obtain_pattern_files_x( + struct XorrisO *xorriso, char *wd, char *dir_adr, + int *filec, char **filev, int count_limit, off_t *mem, + int *dive_count, int flag) +{ + int ret, failed_at, follow_mount, follow_links; + struct DirseQ *dirseq= NULL; + struct stat stbuf; + dev_t dir_dev; + char *path; + char *adr= NULL, *name= NULL, *path_data= NULL; + + adr= malloc(SfileadrL); + name= malloc(SfileadrL); + path_data= malloc(SfileadrL); + if(adr==NULL || name==NULL || path_data==NULL) { + Xorriso_no_malloc_memory(xorriso, &adr, 0); + {ret= -1; goto ex;} + } + follow_mount= (xorriso->do_follow_mount || xorriso->do_follow_pattern); + follow_links= (xorriso->do_follow_links || xorriso->do_follow_pattern); + if(!(flag&2)) + *dive_count= 0; + else + (*dive_count)++; + + ret= Xorriso_check_for_root_pattern(xorriso, filec, filev, count_limit, + mem, flag&1); + if(ret!=2) + goto ex; + + if(lstat(dir_adr, &stbuf)==-1) + {ret= 2; goto ex;} + dir_dev= stbuf.st_dev; + if(S_ISLNK(stbuf.st_mode)) { + if(stat(dir_adr, &stbuf)==-1) + {ret= 2; goto ex;} + if(dir_dev != stbuf.st_dev && !follow_mount) + {ret= 2; goto ex;} + } + ret= Dirseq_new(&dirseq, dir_adr, 1); + if(ret<0) { + sprintf(xorriso->info_text, "Cannot obtain disk directory iterator"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + if(ret==0) + {ret= 2; goto ex;} + + while(1) { + ret= Dirseq_next_adr(dirseq,name,0); + if(ret==0) + break; + if(ret<0) { + sprintf(xorriso->info_text,"Failed to obtain next directory entry"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + + ret= Xorriso_make_abs_adr(xorriso, wd, name, adr, flag&4); + if(ret<=0) + goto ex; + + ret= Xorriso_regexec(xorriso, adr, &failed_at, 1); + if(ret>0) { /* no match */ + if(failed_at <= *dive_count) /* no hope for a match */ + continue; + path= adr; + if(adr[0]!='/') { + path= path_data; + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, adr, path, 1|4); + if(ret<=0) + goto ex; + } + + if(follow_links) + ret= stat(path,&stbuf); + else + ret= lstat(path,&stbuf); + if(ret==-1) + continue; + if(!S_ISDIR(stbuf.st_mode)) + continue; + if(dir_dev != stbuf.st_dev && !follow_mount) + continue; + + /* dive deeper */ + ret= Xorriso_obtain_pattern_files_x(xorriso, adr, path, + filec, filev, count_limit, mem, dive_count, flag|2); + if(ret<=0) + goto ex; + } else { + ret= Xorriso_register_matched_adr(xorriso, adr, count_limit, + filec, filev, mem, flag&1); + if(ret<0) + goto ex; + if(ret==0) + break; + } + } + ret= 1; +ex:; + if(adr!=NULL) + free(adr); + if(name!=NULL) + free(name); + if(path_data!=NULL) + free(path_data); + Dirseq_destroy(&dirseq,0); + if(flag&2) + (*dive_count)--; + return(ret); +} + + +int Xorriso_eval_nonmatch(struct XorrisO *xorriso, char *pattern, + int *nonconst_mismatches, off_t *mem, int flag) +{ + int k,l; + + /* Is this a constant pattern ? */ + for(k= 0; k<xorriso->re_fill; k++) { + if(xorriso->re_constants[k]==NULL) + break; + if(xorriso->re_constants[k][0]==0) + break; + } + if(k<xorriso->re_fill) + (*nonconst_mismatches)++; /* it is not */ + + l= strlen(pattern)+1; + (*mem)+= sizeof(char *)+l; + if(l % sizeof(char *)) + (*mem)+= sizeof(char *)-(l % sizeof(char *)); + return(1); +} + + +/* @param flag bit0= a match count !=1 is a SORRY event + bit1= a match count !=1 is a FAILURE event +*/ +int Xorriso_check_matchcount(struct XorrisO *xorriso, + int count, int nonconst_mismatches, int num_patterns, + char **patterns, int flag) +{ + + if((flag&1) && (count!=1 || nonconst_mismatches)){ + if(count-nonconst_mismatches>0) + sprintf(xorriso->info_text, + "Pattern match with more than one file object"); + else + sprintf(xorriso->info_text, "No pattern match with any file object"); + if(num_patterns==1) + sprintf(xorriso->info_text+strlen(xorriso->info_text), ": "); + Text_shellsafe(patterns[0], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (flag&2 ? "FAILURE" : "SORRY"), 0); + return(0); + } + return(1); +} + + +int Xorriso_no_pattern_memory(struct XorrisO *xorriso, off_t mem, int flag) +{ + char mem_text[80]; + + Sfile_scale((double) mem, mem_text,5,1e4,1); + sprintf(xorriso->info_text, + "Cannot allocate enough memory (%s) for pattern expansion", + mem_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(1); +} + + +int Xorriso_alloc_pattern_mem(struct XorrisO *xorriso, off_t mem, + int count, char ***filev, int flag) +{ + char mem_text[80], limit_text[80]; + + Sfile_scale((double) mem, mem_text,5,1e4,0); + sprintf(xorriso->info_text, + "Temporary memory needed for pattern expansion : %s", mem_text); + if(!(flag&1)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + if(mem > xorriso->temp_mem_limit) { + Sfile_scale((double) xorriso->temp_mem_limit, limit_text,5,1e4,1); + sprintf(xorriso->info_text, + "List of matching file addresses exceeds -temp_mem_limit (%s > %s)", + mem_text, limit_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + + (*filev)= (char **) calloc(count, sizeof(char *)); + if(*filev==NULL) { + Xorriso_no_pattern_memory(xorriso, mem, 0); + return(-1); + } + return(1); +} + + +/* @param flag bit0= a match count !=1 is a FAILURE event + bit1= with bit0 tolerate 0 matches if pattern is a constant +*/ +int Xorriso_expand_disk_pattern(struct XorrisO *xorriso, + int num_patterns, char **patterns, int extra_filec, + int *filec, char ***filev, off_t *mem, int flag) +{ + int ret, count= 0, abs_adr= 0, i, was_count, was_filec; + int nonconst_mismatches= 0, dive_count= 0; + char *dir_adr= NULL; + + Xorriso_alloc_meM(dir_adr, char, SfileadrL); + + *filec= 0; + *filev= NULL; + + xorriso->search_mode= 3; + xorriso->structured_search= 1; + + for(i= 0; i<num_patterns; i++) { + + ret= Xorriso_prepare_expansion_pattern(xorriso, patterns[i], 4); + if(ret<=0) + goto ex; + if(ret==2) + abs_adr= 4; + + if(patterns[i][0]=='/' || abs_adr) { + strcpy(dir_adr, "/"); + abs_adr= 4; + } else { + strcpy(dir_adr, xorriso->wdx); + if(dir_adr[0]==0) + strcpy(dir_adr, "/"); + ret= Sfile_type(dir_adr, 1|4); + if(ret!=2) { + Xorriso_msgs_submit(xorriso, 0, dir_adr, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "Address set by -cdx is not a directory: "); + Text_shellsafe(dir_adr, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + + /* count the matches */ + was_count= count; + ret= Xorriso_obtain_pattern_files_x(xorriso, "", dir_adr, &count, NULL, 0, + mem, &dive_count, 1 | abs_adr); + if(ret<=0) + goto ex; + if(was_count==count && strcmp(patterns[i],"*")!=0 && (flag&3)!=1) { + count++; + ret= Xorriso_eval_nonmatch(xorriso, patterns[i], + &nonconst_mismatches, mem, 0); + if(ret<=0) + goto ex; + } + } + + ret= Xorriso_check_matchcount(xorriso, count, nonconst_mismatches, + num_patterns, patterns, (flag&1)|2); + if(ret<=0) + goto ex; + + count+= extra_filec; + mem+= extra_filec*sizeof(char *); + + if(count<=0) + {ret= 0; goto ex;} + + ret= Xorriso_alloc_pattern_mem(xorriso, *mem, count, filev, 0); + if(ret<=0) + goto ex; + + /* now store addresses */ + for(i= 0; i<num_patterns; i++) { + + ret= Xorriso_prepare_expansion_pattern(xorriso, patterns[i], 4); + if(ret<=0) + goto ex; + + if(patterns[i][0]=='/' || abs_adr) { + strcpy(dir_adr, "/"); + abs_adr= 4; + } else { + strcpy(dir_adr, xorriso->wdx); + if(dir_adr[0]==0) + strcpy(dir_adr, "/"); + } + + was_filec= *filec; + ret= Xorriso_obtain_pattern_files_x(xorriso, "", dir_adr, filec, *filev, + count, mem, &dive_count, abs_adr); + if(ret<=0) + goto ex; + + if(was_filec == *filec && strcmp(patterns[i],"*")!=0) { + (*filev)[*filec]= strdup(patterns[i]); + if((*filev)[*filec]==NULL) { + (*mem)= strlen(patterns[i])+1; + Xorriso_no_pattern_memory(xorriso, *mem, 0); + ret= -1; goto ex; + } + (*filec)++; + } + } + + ret= 1; +ex:; + if(ret<=0) { + if(filev!=NULL) + Sfile_destroy_argv(&count, filev, 0); + *filec= 0; + } + Xorriso_free_meM(dir_adr); + return(ret); +} + + +/* @param flag bit0= command without pattern capability + bit1= disk_pattern rather than iso_rr_pattern +*/ +int Xorriso_warn_of_wildcards(struct XorrisO *xorriso, char *path, int flag) +{ + if(strchr(path,'*')!=NULL || strchr(path,'?')!=NULL || + strchr(path,'[')!=NULL) { + if(flag&1) { + sprintf(xorriso->info_text, + "Pattern expansion of wildcards \"*?[\" does not apply to this command"); + } else { + sprintf(xorriso->info_text, + "Pattern expansion of wildcards \"*?[\" is disabled by command %s", + (flag&2) ? "-disk_pattern or -pathspecs" : "-iso_rr_pattern"); + } + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + sprintf(xorriso->info_text,"Pattern seen: %s\n", path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(1); + } + return(0); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/match.h b/libisoburn/branches/1.1.8/xorriso/match.h new file mode 100644 index 00000000..14a457d2 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/match.h @@ -0,0 +1,74 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of functions for pattern matching. +*/ + + +#ifndef Xorriso_pvt_match_includeD +#define Xorriso_pvt_match_includeD yes + + +int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag); + +/* @return 0=match , else no match +*/ +int Xorriso_regexec(struct XorrisO *xorriso, char *to_match, int *failed_at, + int flag); + +int Xorriso_is_in_patternlist(struct XorrisO *xorriso, + struct Xorriso_lsT *patternlist, char *path, int flag); + +char *Xorriso_get_pattern(struct XorrisO *xorriso, + struct Xorriso_lsT *patternlist, int index, int flag); + +int Xorriso_prepare_expansion_pattern(struct XorrisO *xorriso, char *pattern, + int flag); + +/* @param flag bit0= count results rather than storing them + @return <=0 error , 1 is root (end processing) , + 2 is not root (go on processing) +*/ +int Xorriso_check_for_root_pattern(struct XorrisO *xorriso, + int *filec, char **filev, int count_limit, off_t *mem, int flag); + +/* @param flag bit0= count result rather than storing it + bit1= unexpected change of number is a FATAL event +*/ +int Xorriso_register_matched_adr(struct XorrisO *xorriso, + char *adr, int count_limit, + int *filec, char **filev, off_t *mem, int flag); + +int Xorriso_eval_nonmatch(struct XorrisO *xorriso, char *pattern, + int *nonconst_mismatches, off_t *mem, int flag); + +/* @param flag bit0= a match count !=1 is a SORRY event +*/ +int Xorriso_check_matchcount(struct XorrisO *xorriso, + int count, int nonconst_mismatches, int num_patterns, + char **patterns, int flag); + +int Xorriso_no_pattern_memory(struct XorrisO *xorriso, off_t mem, int flag); + +int Xorriso_alloc_pattern_mem(struct XorrisO *xorriso, off_t mem, + int count, char ***filev, int flag); + +/* @param flag bit0= command without pattern capability + bit1= disk_pattern rather than iso_rr_pattern +*/ +int Xorriso_warn_of_wildcards(struct XorrisO *xorriso, char *path, int flag); + +/* @param flag bit0= a match count !=1 is a FAILURE event + bit1= with bit0 tolerate 0 matches if pattern is a constant +*/ +int Xorriso_expand_disk_pattern(struct XorrisO *xorriso, + int num_patterns, char **patterns, int extra_filec, + int *filec, char ***filev, off_t *mem, int flag); + + +#endif /* ! Xorriso_pvt_match_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/misc_funct.c b/libisoburn/branches/1.1.8/xorriso/misc_funct.c new file mode 100644 index 00000000..3abb888b --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/misc_funct.c @@ -0,0 +1,1236 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the miscellaneous helper functions of xorriso. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <sys/utsname.h> + + +#include "sfile.h" +#include "misc_funct.h" + + +/* --------------------------------- misc --------------------------------- */ + + +int Strcmp(const void *pt1, const void *pt2) +{ + return(strcmp(*((char **) pt1), *((char **) pt2))); +} + + +int Sort_argv(int argc, char **argv, int flag) +{ + if(argc<=0) + return(2); + qsort(argv,(size_t) argc,sizeof(char *),Strcmp); + return(1); +} + + +static int Text_to_argv(char *text, int *argc, char ***argv, int flag) +{ + char *npt, *cpt; + int pass; + + *argv= NULL; + *argc= 0; + for(pass= 0; pass < 2; pass++) { + if(pass) { + if(*argc == 0) + return(1); + (*argv)= calloc(*argc, sizeof(char *)); + if(*argv == NULL) { + *argc= 0; + return(-1); + } + *argc= 0; + } + for(npt= cpt= text; npt != NULL; cpt= npt + 1) { + npt= strchr(cpt, '\n'); + if(pass) { + if(npt != NULL) + *npt= 0; + (*argv)[*argc]= cpt; + } + (*argc)++; + } + } + return(1); +} + + +static int Count_diffs(int argc1, char **argv1, int argc2, char **argv2, + int flag) +{ + int count= 0, i1= 0, i2= 0, cmp, end_corr= 0; + + Sort_argv(argc1, argv1, 0); + Sort_argv(argc2, argv2, 0); + + while(1) { + if(i1 >= argc1) { + count+= argc2 - i2 - end_corr; + break; + } + if(i2 >= argc2) { + count+= argc1 - i1 - end_corr; + break; + } + cmp= strcmp(argv1[i1], argv2[i2]); + if(cmp == 0) { + end_corr= 0; + i1++; + i2++; + } else if(cmp > 0) { + count++; + end_corr= 1; + i2++; + if(i2 < argc2 && i1 < argc1 - 1) + if(strcmp(argv1[i1 + 1], argv2[i2]) == 0) { + i1++; + end_corr= 0; + } + } else { + count++; + end_corr= 1; + i1++; + if(i1 < argc1 && i2 < argc2 - 1) + if(strcmp(argv2[i2 + 1], argv1[i1]) == 0) { + i2++; + end_corr= 0; + } + } + } + return(count); +} + + +/* + @flag bit0= do not initialize *diff_count + @return <0 error , 0 = mismatch , 1 = match +*/ +int Compare_text_lines(char *text1, char *text2, int *diff_count, int flag) +{ + int ret, argc1= 0, argc2= 0; + char **argv1= NULL, **argv2= NULL, *copy1= NULL, *copy2= NULL; + + if(!(flag & 1)) + *diff_count= 0; + if(text1 == NULL && text2 == NULL) + return(1); + if(text1 != NULL) { + copy1= strdup(text1); + if(copy1 == NULL) + {ret= -1; goto ex;} + ret= Text_to_argv(copy1, &argc1, &argv1, 0); + if(ret <= 0) + {ret= -1; goto ex;} + } + if(text2 != NULL) { + copy2= strdup(text2); + if(copy2 == NULL) + {ret= -1; goto ex;} + ret= Text_to_argv(copy2, &argc2, &argv2, 0); + if(ret <= 0) + {ret= -1; goto ex;} + } + ret= Count_diffs(argc1, argv1, argc2, argv2, 1); + if(ret < 0) + goto ex; + *diff_count+= ret; + ret= (*diff_count == 0); +ex:; + if(argv1 != NULL) + free(argv1); + if(argv2 != NULL) + free(argv2); + if(copy1 != NULL) + free(copy1); + if(copy2 != NULL) + free(copy2); + return ret; +} + + +/** Convert a text into a number of type double and multiply it by unit code + [kmgtpe] (2^10 to 2^60) or [s] (2048). (Also accepts capital letters.) + @param text Input like "42", "2k", "3.14m" or "-1g" + @param flag Bitfield for control purposes: + bit0= return -1 rathern than 0 on failure + @return The derived double value +*/ +double Scanf_io_size(char *text, int flag) +/* + bit0= default value -1 rather than 0 +*/ +{ + int c; + double ret= 0.0; + + if(flag&1) + ret= -1.0; + if(text[0]==0) + return(ret); + sscanf(text,"%lf",&ret); + c= text[strlen(text)-1]; + if(c=='k' || c=='K') ret*= 1024.0; + if(c=='m' || c=='M') ret*= 1024.0*1024.0; + if(c=='g' || c=='G') ret*= 1024.0*1024.0*1024.0; + if(c=='t' || c=='T') ret*= 1024.0*1024.0*1024.0*1024.0; + if(c=='p' || c=='P') ret*= 1024.0*1024.0*1024.0*1024.0*1024.0; + if(c=='e' || c=='E') ret*= 1024.0*1024.0*1024.0*1024.0*1024.0*1024.0; + if(c=='s' || c=='S') ret*= 2048.0; + return(ret); +} + + +int Decode_date_input_format(struct tm *erg, char *text, int flag) +/* MMDDhhmm[[CC]YY][.ss]] */ +{ + int i,l,year; + time_t current_time; + struct tm *now; + + current_time= time(0); + now= localtime(¤t_time); + for(i= 0; i < (int) sizeof(struct tm); i++) + ((char *) erg)[i]= ((char *) now)[i]; + + l= strlen(text); + for(i=0;i<l;i++) + if(text[i]<'0'||text[i]>'9') + break; + if(i!=8 && i!=10 && i!=12) + return(0); + if(text[i]==0) + goto decode; + if(text[i]!='.' || l!=15) + return(0); + i++; + if(text[i]<'0'||text[i]>'9') + return(0); + i++; + if(text[i]<'0'||text[i]>'9') + return(0); + +decode:; + /* MMDDhhmm[[CC]YY][.ss]] */ + i= 0; + erg->tm_mon= 10*(text[0]-'0')+text[1]-'0'-1; + erg->tm_mday= 10*(text[2]-'0')+text[3]-'0'; + erg->tm_hour= 10*(text[4]-'0')+text[5]-'0'; + erg->tm_min= 10*(text[6]-'0')+text[7]-'0'; + erg->tm_sec= 0; + if(l==8) + return(1); + if(l>10){ + year= 1000*(text[8]-'0')+100*(text[9]-'0')+10*(text[10]-'0')+(text[11]-'0'); + }else{ + year= 1900+10*(text[8]-'0')+(text[9]-'0'); + if(year<1970) + year+= 100; + } + erg->tm_year= year-1900; + if(l<=12) + return(1); + erg->tm_sec= 10*(text[13]-'0')+text[14]-'0'; + return(1); +} + + +int Decode_date_weekday(char *text, int flag) +{ + int i; + static char days[][4]= {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", ""}; + + for(i= 0; days[i][0]!=0; i++) + if(strncmp(text,days[i],3)==0) + return(i); + if((strlen(text)==3 || (strlen(text)==4 && text[3]==',')) && + isalpha(text[0]) && isalpha(text[1]) && isalpha(text[2])) + return(7); + return(-1); +} + + +int Decode_date_month(char *text, int flag) +{ + int i; + static char months[][4]= {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""}; + + for(i= 0; months[i][0]!=0; i++) + if(strncmp(text,months[i],3)==0) + return(i); + return(-1); +} + + +/* @return -1=not a number, -2=not a day , 1 to 31 day of month */ +int Decode_date_mday(char *text, int flag) +{ + int ret, i; + + for(i= 0; text[i]!=0; i++) + if(!isdigit(text[i])) + return(-1); + if(strlen(text)>2 || text[0]==0) + return(-2); + sscanf(text, "%d", &ret); + if(ret<=0 || ret>31) + return(-2); + return(ret); +} + +int Decode_date_hms(char *text, struct tm *erg, int flag) +{ + int i, hour= -1, minute= -1, second= 0; + + for(i= 0; i<9; i+= 3) { + if(i==6&&text[i]==0) + break; + if(!isdigit(text[i])) + return(-1); + if(!isdigit(text[i+1])) + return(-1); + if(text[i+2]!=':' && !(text[i+2]==0 && i>=3)) + return(-1); + if(i==0) + sscanf(text+i,"%d",&hour); + else if(i==3) + sscanf(text+i,"%d",&minute); + else + sscanf(text+i,"%d",&second); + } + if(hour<0 || hour>23 || minute<0 || minute>59 || second>59) + return(-1); + erg->tm_hour= hour; + erg->tm_min= minute; + erg->tm_sec= second; + return(1); +} + + +/* @return -1=not a number, -2=not a year , >=0 years AD */ +int Decode_date_year(char *text, int flag) +{ + int ret, i; + + for(i= 0; text[i]!=0; i++) + if(!isdigit(text[i])) + return(-1); + if(strlen(text)!=4) + return(-2); + sscanf(text, "%d", &ret); + if(ret<0 || ret>3000) + return(-2); + return(ret); +} + + +int Decode_date_timezone(char *text, struct tm *erg, int flag) +{ + int i; + static char tzs[][5]= {"GMT", "CET", "CEST", "0000", ""}; + + for(i= 0; tzs[i][0]!=0; i++) + if(strcmp(text,tzs[i])==0) { + + /* ??? >>> what to do with timezone info ? Add to ->tm_hour ? */ + + return(1); + } + if(text[0]=='+' || text[0]=='-') { + for(i= 1; text[i]!=0; i++) + if(!isdigit(text[i])) + return(-1); + if(i!=5) + return(-1); + + /* ??? >>> what to do with timezone info ? Add to ->tm_hour ? */ + + return(1); + } else { + for(i= 0; text[i]!=0; i++) + if(text[i]<'A' || text[i]>'Z') + return(-1); + if(i!=3 && i!=4) + return(-1); + return(2); + } +} + + +int Decode_date_output_format(struct tm *erg, char *text, int flag) +/* Thu Nov 8 09:07:50 CET 2007 */ +/* Sat, 03 Nov 2007 08:58:30 +0100 */ +/* Nov 7 23:24 */ +{ + int ret, i, argc= 0, seen_year= 0, seen_month= 0, seen_day= 0, seen_time= 0; + char **argv= NULL; + struct tm *now; + time_t timep; + + memset(erg, 0, sizeof(*erg)); + erg->tm_isdst= -1; + ret= Sfile_make_argv("xorriso", text, &argc, &argv, 0); + if(ret<=0) + goto ex; + for(i= 1; i<argc; i++) { + if(!seen_month) { + ret= Decode_date_month(argv[i], 0); + if(ret>=0) { + seen_month= 1; + erg->tm_mon= ret; + continue; + } + } + if(!seen_day) { + ret= Decode_date_mday(argv[i], 0); + if(ret>0) { + seen_day= 1; + erg->tm_mday= ret; + continue; + } + if(ret==-2) /* first pure number must be day of month */ + {ret= 0; goto ex;} + } + if(!seen_time) { + ret= Decode_date_hms(argv[i], erg, 0); + if(ret>0) { + seen_time= 1; + continue; + } + } + if(!seen_year) { + ret= Decode_date_year(argv[i], 0); + if(ret>0) { + erg->tm_year= ret-1900; + seen_year= 1; + continue; + } + } + + /* ignorants have to stay at the end of the loop */ + + ret= Decode_date_timezone(argv[i], erg, 0); + if(ret>=0) + continue; + ret= Decode_date_weekday(argv[i], 0); + if(ret>=0) + continue; /* ignore weekdays */ + + {ret= 0; goto ex;} /* unrecognizable component */ + } + + if(!(seen_day && seen_month)) + {ret= 0; goto ex;} + if(!seen_year) { /* then use this year */ + timep= time(NULL); + now= localtime(&timep); + erg->tm_year= now->tm_year; + } + ret= 1; +ex: + Sfile_make_argv("", "", &argc, &argv, 2); /* release storage */ + return(ret); +} + + +int Decode_ecma119_format(struct tm *erg, char *text, int flag) +/* YYYYMMDDhhmmsscc */ +/* 2010040711405800 */ +{ + int i, l, num; + + memset(erg, 0, sizeof(*erg)); + erg->tm_isdst= -1; + l= strlen(text); + if(l != 16) + return(0); + for(i= 0; i < l; i++) + if(text[i] < '0' || text[i] > '9') + return(0); + num= 0; + for(i= 0; i < 4; i++) + num= num * 10 + text[i] - '0'; + if(num < 1970 || num > 3000) + return(0); + erg->tm_year = num - 1900; + erg->tm_mon= 10*(text[4]-'0')+text[5]-'0'-1; + if(erg->tm_mon > 12) + return(0); + erg->tm_mday= 10*(text[6]-'0')+text[7]-'0'; + if(erg->tm_mday > 31) + return(0); + erg->tm_hour= 10*(text[8]-'0')+text[9]-'0'; + if(erg->tm_hour > 23) + return(0); + erg->tm_min= 10*(text[10]-'0')+text[11]-'0'; + if(erg->tm_min > 59) + return(0); + erg->tm_sec= 10*(text[12]-'0')+text[13]-'0'; + if(erg->tm_sec > 59) + return(0); + return(1); +} + + +int Decode_xorriso_timestamp(struct tm *erg, char *code, int flag) + /* 2007.11.07.225624 */ +{ + char buf[20]; + int year,month,day,hour= 0,minute= 0,second= 0, i, l, mem; + + memset(erg, 0, sizeof(*erg)); + erg->tm_isdst= -1; + + l= strlen(code); + if(l>17 || l<10) + return(0); + strcpy(buf, code); + for(i= 0; buf[i]!=0 && i<4; i++) + if(!isdigit(buf[i])) + return(0); + if(buf[4]!='.') + return(0); + buf[4]= 0; + sscanf(buf, "%d", &year); + if(year<1900 || year>3000) + return(0); + if(!(isdigit(buf[5]) && isdigit(buf[6]) && buf[7]=='.')) + return(0); + buf[7]= 0; + sscanf(buf+5, "%d", &month); + if(month<1 || month>12) + return(0); + if(!(isdigit(buf[8]) && isdigit(buf[9]) && (buf[10]=='.' || buf[10]==0))) + return(0); + buf[10]= 0; + sscanf(buf+8, "%d", &day); + if(day<1 || day>31) + return(0); + if(l==10) + goto done; + if(!(isdigit(buf[11]) && isdigit(buf[12]) && + (isdigit(buf[13]) || buf[13]==0))) + return(0); + mem= buf[13]; + buf[13]= 0; + sscanf(buf+11, "%d", &hour); + buf[13]= mem; + if(hour<0 || hour>23) + return(0); + if(l==13) + goto done; + if(!(isdigit(buf[13]) && isdigit(buf[14]) && + (isdigit(buf[15]) || buf[15]==0))) + return(0); + mem= buf[15]; + buf[15]= 0; + sscanf(buf+13, "%d", &minute); + buf[15]= mem; + if(minute<0 || minute>59) + return(0); + if(l==15) + goto done; + if(!(isdigit(buf[15]) && isdigit(buf[16]) && buf[17]==0)) + return(0); + sscanf(buf+15, "%d", &second); + if(second<0 || second>59) + return(0); + +done:; + erg->tm_year= year-1900; + erg->tm_mon= month-1; + erg->tm_mday= day; + erg->tm_hour= hour; + erg->tm_min= minute; + erg->tm_sec= second; + return(1); +} + + +time_t Decode_timestring(char *code, time_t *date, int flag) +{ + char scale_chr; + double value,seconds; + struct tm result_tm; + int seconds_valid= 0; + + *date= 0; + if(code[0]=='-' || code[0]=='+' || code[0]=='=' || code[0]=='@'){ + if(code[1]==0) + return(0); + if(!isdigit(code[1])) + return(0); + value= -1; + if(code[0]=='=' || code[0]=='@') { + seconds= 0; + sscanf(code+1,"%lf",&value); + } else { + seconds= time(NULL); + sscanf(code,"%lf",&value); + } + scale_chr= code[strlen(code)-1]; + if(isalpha(scale_chr)) + scale_chr= tolower(scale_chr); + if (scale_chr=='s') seconds+= 1.0*value; + else if(scale_chr=='h') seconds+= 3600.0*value; + else if(scale_chr=='d') seconds+= 86400.0*value; + else if(scale_chr=='w') seconds+= 86400.0*7.0*value; + else if(scale_chr=='m') seconds+= 86400.0*31.0*value; + else if(scale_chr=='y') seconds+= 86400.0*(365.25*value+1.0); + else seconds+= 1.0*value; + seconds_valid= 1; + goto completed; + } else if(Sfile_decode_datestr(&result_tm,code,0)>0) { + /* YYMMDD[.hhmm[ss]] */ + result_tm.tm_isdst= -1; + seconds= mktime(&result_tm); + seconds_valid= 1; + goto completed; + } else if(Decode_date_input_format(&result_tm,code,0)>0) { + /* MMDDhhmm[[CC]YY][.ss]] */ + result_tm.tm_isdst= -1; + seconds= mktime(&result_tm); + seconds_valid= 1; + goto completed; + } else if(Decode_xorriso_timestamp(&result_tm, code, 0)>0) { + /* 2007.11.07.225624 */ + seconds= mktime(&result_tm); + seconds_valid= 1; + goto completed; + } else if(Decode_date_output_format(&result_tm, code, 0)>0) { + /* Thu Nov 8 09:07:50 CET 2007 */; + /* Sat, 03 Nov 2007 08:58:30 +0100 */; + /* Nov 7 23:24 */; + seconds= mktime(&result_tm); + seconds_valid= 1; + goto completed; + } else if(Decode_ecma119_format(&result_tm, code, 0)>0) { + /* YYYYMMDDhhmmsscc */ + /* 2010040711405800 */ + seconds= mktime(&result_tm); + seconds_valid= 1; + goto completed; + } + return(0); +completed:; + if(!seconds_valid) + return(0); + *date= seconds; + return(1); +} + + +/* @param flag bit0=with year and seconds + bit1-3= form + 0= ls -l format + 1= timestamp format YYYY.MM.DD.hhmmss + 2= Wdy Mon Day hh:mm:ss Year + 3= Mon Day hh:mm:ss Year + 4= YYMMDD.hhmmss +*/ +char *Ftimetxt(time_t t, char timetext[40], int flag) +{ + char *rpt; + struct tm tms, *tmpt; + static char months[12][4]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static char days[7][4]= {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + int form; + + form= (flag>>1)&7; + tmpt= localtime_r(&t, &tms); + rpt= timetext; + rpt[0]= 0; + if(tmpt==0) + sprintf(rpt+strlen(rpt), "%12.f", (double) t); + else if (form==1) + sprintf(rpt+strlen(rpt), "%4.4d.%2.2d.%2.2d.%2.2d%2.2d%2.2d", + 1900+tms.tm_year, tms.tm_mon+1, tms.tm_mday, + tms.tm_hour, tms.tm_min, tms.tm_sec); + else if (form==2) + sprintf(rpt+strlen(rpt), "%s %s %2.2d %2.2d:%2.2d:%2.2d %4.4d", + days[tms.tm_wday], months[tms.tm_mon], tms.tm_mday, + tms.tm_hour, tms.tm_min, tms.tm_sec, 1900+tms.tm_year); + else if (form==3) + sprintf(rpt+strlen(rpt), "%s %2.2d %2.2d:%2.2d:%2.2d %4.4d", + months[tms.tm_mon], tms.tm_mday, + tms.tm_hour, tms.tm_min, tms.tm_sec, 1900+tms.tm_year); + else if (form == 4) { + if(tms.tm_year>99) + sprintf(rpt+strlen(rpt), "%c", 'A' + (tms.tm_year - 100) / 10); + else + sprintf(rpt+strlen(rpt), "%c", '0' + tms.tm_year / 10); + sprintf(rpt+strlen(rpt), "%1.1d%2.2d%2.2d.%2.2d%2.2d%2.2d", + tms.tm_year % 10, tms.tm_mon + 1, tms.tm_mday, + tms.tm_hour, tms.tm_min, tms.tm_sec); + } else if (flag&1) + sprintf(rpt+strlen(rpt), "%2d %3s %4.4d %2.2d:%2.2d:%2.2d", + tms.tm_mday, months[tms.tm_mon], 1900+tms.tm_year, + tms.tm_hour, tms.tm_min, tms.tm_sec); + else if(time(NULL)-t < 180*86400 && time(NULL)-t >= 0) + sprintf(rpt+strlen(rpt), "%3s %2d %2.2d:%2.2d", + months[tms.tm_mon], tms.tm_mday, tms.tm_hour, tms.tm_min); + else + sprintf(rpt+strlen(rpt), "%3s %2d %4.4d", + months[tms.tm_mon], tms.tm_mday, 1900+tms.tm_year); + return(timetext); +} + + +/* @param flag bit0= single letters */ +char *Ftypetxt(mode_t st_mode, int flag) +{ + if(flag&1) + goto single_letters; + if(S_ISDIR(st_mode)) + return("directory"); + else if(S_ISREG(st_mode)) + return("regular_file"); + else if(S_ISLNK(st_mode)) + return("symbolic_link"); + else if(S_ISBLK(st_mode)) + return("block_device"); + else if(S_ISCHR(st_mode)) + return("char_device"); + else if(S_ISFIFO(st_mode)) + return("name_pipe"); + else if(S_ISSOCK(st_mode)) + return("unix_socket"); + return("unknown"); +single_letters:; + if(S_ISDIR(st_mode)) + return("d"); + else if(S_ISREG(st_mode)) + return("-"); + else if(S_ISLNK(st_mode)) + return("l"); + else if(S_ISBLK(st_mode)) + return("b"); + else if(S_ISCHR(st_mode)) + return("c"); + else if(S_ISFIFO(st_mode)) + return("p"); + else if(S_ISSOCK(st_mode)) + return("s"); + return("?"); +} + + +int Wait_for_input(int fd, int microsec, int flag) +{ + struct timeval wt; + fd_set rds,wts,exs; + int ready; + + FD_ZERO(&rds); + FD_ZERO(&wts); + FD_ZERO(&exs); + FD_SET(fd,&rds); + FD_SET(fd,&exs); + wt.tv_sec= microsec/1000000; + wt.tv_usec= microsec%1000000; + ready= select(fd+1,&rds,&wts,&exs,&wt); + if(ready<=0) + return(0); + if(FD_ISSET(fd,&exs)) + return(-1); + if(FD_ISSET(fd,&rds)) + return(1); + return(0); +} + + +int System_uname(char **sysname, char **release, char **version, + char **machine, int flag) +{ + int ret; + static struct utsname uts; + static int initialized= 0; + + if(initialized == 0) { + ret= uname(&uts); + if(ret != 0) + initialized = -1; + } + if(initialized == -1) + return(0); + if(sysname != NULL) + *sysname= uts.sysname; + if(release != NULL) + *release= uts.release; + if(version != NULL) + *version= uts.version; + if(machine != NULL) + *machine= uts.machine; + return(1); +} + +/* ------------------------------------------------------------------------ */ + + +#ifndef Xorriso_sregex_externaL + +#ifndef Smem_malloC +#define Smem_malloC malloc +#endif +#ifndef Smem_freE +#define Smem_freE free +#endif + + +int Sregex_string_cut(char **handle, char *text, int len, int flag) +/* + bit0= append (text!=NULL) +*/ +{ + int l=0; + char *old_handle; + + if((flag&1)&&*handle!=NULL) + l+= strlen(*handle); + old_handle= *handle; + if(text!=NULL) { + l+= len; + *handle= TSOB_FELD(char,l+1); + if(*handle==NULL) { + *handle= old_handle; + return(0); + } + if((flag&1) && old_handle!=NULL) + strcpy(*handle,old_handle); + else + (*handle)[0]= 0; + if(len>0) + strncat(*handle,text,len); + } else { + *handle= NULL; + } + if(old_handle!=NULL) + Smem_freE(old_handle); + return(1); +} + + +int Sregex_string(char **handle, char *text, int flag) +/* + bit0= append (text!=NULL) +*/ +{ + int ret,l=0; + + if(text!=NULL) + l= strlen(text); + +/* #define Sregex_looking_for_contenT 1 */ +#ifdef Sregex_looking_for_contenT + /* a debugging point if a certain text content has to be caught */ + if(text!=NULL) + if(strcmp(text,"clear")==0) + ret= 0; +#endif + + ret= Sregex_string_cut(handle,text,l,flag&1); + return(ret); +} + + +/* + vars[][0] points to the variable names, vars[][1] to their contents. + start marks the begin of variable names. It must be non-empty. esc before + start disables this meaning. start and esc may be equal but else they must + have disjoint character sets. + end marks the end of a variable name. It may be empty but if non-empty it + must not appear in vars[][0]. + @param flag bit0= Substitute unknown variables by empty text + (else copy start,name,end unaltered to result). + Parameter end must be non-empty for that. +*/ +int Sregex_resolve_var(char *form, char *vars[][2], int num_vars, + char *start, char *end, char *esc, + char *result, int result_size, int flag) +{ + int l_e, l_s, l_esc, i, start_equals_esc; + char *rpt, *wpt, *spt, *npt, *ept; + + if(start[0] == 0) /* It is not allowed to have no start marker */ + return(-1); + l_s= strlen(start); + l_e= strlen(end); + l_esc= strlen(esc); + start_equals_esc= !strcmp(start, esc); + rpt= form; + wpt= result; + wpt[0]= 0; + while(1) { + + /* look for start mark */ + spt= strstr(rpt, start); + if(spt == NULL) { + if((wpt - result) + (int) strlen(rpt) >= result_size) + return(0); + strcpy(wpt, rpt); + wpt+= strlen(wpt); + break; + } + + /* copy cleartext part up to next variable */ + if((wpt - result) + (spt - rpt) >= result_size) + return(0); + strncpy(wpt, rpt, spt - rpt); + wpt+= spt - rpt; + *wpt= 0; + rpt= spt; + npt= spt + l_s; + + /* handle eventual escape */ + if(start_equals_esc) { + if(strncmp(spt + l_s, esc, l_esc) == 0) { + /* copy esc and start */ + if((wpt - result) + l_esc + l_s >= result_size) + return(0); + strncpy(wpt, spt, l_esc + l_s); + wpt+= l_esc + l_s; + rpt+= l_esc + l_s; + *wpt= 0; + continue; + } + } else { + /* escape would be already copied */ + if(l_esc > 0 && spt - form >= l_esc) { + if(strncmp(spt - l_esc, esc, l_esc) == 0) { + /* copy start */ + if((wpt - result) + l_s >= result_size) + return(0); + strncpy(wpt, spt, l_s); + wpt+= l_s; + rpt+= l_s; + *wpt= 0; + continue; + } + } + } + + /* Memorize eventual end mark for default handling */; + ept= NULL; + if(l_e > 0) + ept= strstr(npt, end); + + /* Look for defined variable name */ + for(i = 0; i < num_vars; i++) { + if(strncmp(npt, vars[i][0], strlen(vars[i][0])) == 0 + && (l_e == 0 || strncmp(npt + strlen(vars[i][0]), end, l_e) == 0)) + break; + } + if(i < num_vars) { + /* substitute found variable */ + if((wpt - result) + (int) strlen(vars[i][1]) >= result_size) + return(0); + strcpy(wpt, vars[i][1]); + rpt= npt + strlen(vars[i][0]) + l_e; + } else if((flag & 1) && ept != NULL) { + /* skip up to end mark */ + rpt= ept + l_e; + } else if(ept != NULL) { + /* copy start,name,end */ + if((wpt - result) + (ept - rpt) + l_e >= result_size) + return(0); + strncpy(wpt, rpt, (ept - rpt) + l_e); + rpt= ept + l_e; + } else { + /* copy start marker only */ + if((wpt - result) + l_s >= result_size) + return(0); + strncpy(wpt, rpt, l_s); + rpt= rpt + l_s; + } + wpt+= strlen(wpt); + *wpt= 0; + } + return(1); +} + + +/* @param flag bit0= only test expression whether compilable +*/ +int Sregex_match(char *pattern, char *text, int flag) +{ + int ret; + char *re_text= NULL; + regex_t re; + regmatch_t match[1]; + + re_text= TSOB_FELD(char, 2 * SfileadrL); + if(re_text == NULL) + {ret= -1; goto ex;} + + Xorriso__bourne_to_reg(pattern, re_text, 0); + ret= regcomp(&re, re_text, 0); + if(ret != 0) + {ret= -1; goto ex;} + if(flag & 1) { + regfree(&re); + {ret= 1; goto ex;} + } + ret= regexec(&re, text, 1, match, 0); + regfree(&re); + if(ret != 0) + {ret= 0; goto ex;} + ret= 1; +ex:; + if(re_text != NULL) + free(re_text); + return(ret); +} + + +#endif /* Xorriso_sregex_externaL */ + + + +/* @param flag bit0= append to out_text rather than overwrite it + bit1= length limit is 10 * SfileadrL rather than 5 * +*/ +char *Text_shellsafe(char *in_text, char *out_text, int flag) +{ + int l,i,w=0, limit= 5 * SfileadrL; + + if(flag&1) + w= strlen(out_text); + if(flag & 2) + limit= 10 * SfileadrL; + /* enclose everything by hard quotes */ + l= strlen(in_text); + out_text[w++]= '\''; + for(i=0;i<l;i++){ + if(in_text[i]=='\''){ + if(w + 7 > limit) + goto overflow; + /* escape hard quote within the text */ + out_text[w++]= '\''; + out_text[w++]= '"'; + out_text[w++]= '\''; + out_text[w++]= '"'; + out_text[w++]= '\''; + } else { + if(w + 3 > limit) { +overflow:; + strncpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... ",33); + break; + } + out_text[w++]= in_text[i]; + } + } + out_text[w++]= '\''; + out_text[w++]= 0; + return(out_text); +} + + +int Hex_to_bin(char *hex, + int bin_size, int *bin_count, unsigned char *bin_data, int flag) +{ + int i, l, acc; + + l= strlen(hex); + if(l % 2 || l == 0) + return(-1); /* malformed */ + *bin_count= 0; + for(i= 0; i < l; i+= 2) { + if(hex[i] >= '0' && hex[i] <= '9') + acc= (hex[i] - '0') << 4; + else if(hex[i] >= 'A' && hex[i] <= 'F') + acc= (hex[i] - 'A' + 10) << 4; + else if(hex[i] >= 'a' && hex[i] <= 'f') + acc= (hex[i] - 'a' + 10) << 4; + else + return(-1); + if(hex[i + 1] >= '0' && hex[i + 1] <= '9') + acc|= (hex[i + 1] - '0'); + else if(hex[i + 1] >= 'A' && hex[i + 1] <= 'F') + acc|= (hex[i + 1] - 'A' + 10); + else if(hex[i + 1] >= 'a' && hex[i + 1] <= 'f') + acc|= (hex[i + 1] - 'a' + 10); + else + return(-1); + if(*bin_count >= bin_size) + return(0); /* overflow */ + bin_data[*bin_count]= acc; + (*bin_count)++; + } + return(1); +} + + +#ifndef Xorriso_fileliste_externaL + +/* ??? ts A71006 : Is this compatible with mkisofs pathspecs ? + I dimly remember so */ + +int Fileliste__target_source_limit(char *line, char sep, char **limit_pt, + int flag) +{ + char *npt; + + for(npt= line;*npt!=0;npt++) { + if(*npt=='\\') { + if(*(npt+1)!=0) + npt++; + continue; + } + if(*npt=='=') + break; + } + if(*npt==0) + npt= NULL; + (*limit_pt)= npt; + return(npt!=NULL); +} + + +int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag) +/* reg_expr should be twice as large as bourne_expr ( + 2 to be exact) */ +/* return: 2= bourne_expr is surely a constant */ +{ + char *wpt,*lpt; + int backslash= 0,is_constant= 1,in_square_brackets= 0; + int first_in_square_brackets=0; + + wpt= reg_expr; + lpt= bourne_expr; + + *(wpt++)= '^'; + + while(*lpt!=0){ + if(first_in_square_brackets>0) + first_in_square_brackets--; + if(!backslash){ + switch(*lpt){ + case '?': + *(wpt++)= '.'; + is_constant= 0; + break;case '*': + *(wpt++)= '.'; + *(wpt++)= '*'; + is_constant= 0; + break;case '.': + *(wpt++)= '\\'; + *(wpt++)= '.'; + break;case '+': + *(wpt++)= '\\'; + *(wpt++)= '+'; + break;case '[': + *(wpt++)= *lpt; + first_in_square_brackets= 2; + in_square_brackets= 1; + is_constant= 0; + break;case ']': + *(wpt++)= *lpt; + in_square_brackets= 0; + break;case '!': + if(first_in_square_brackets) + *(wpt++)= '^'; + else if(in_square_brackets) + *(wpt++)= '!'; + else { + *(wpt++)= '\\'; + *(wpt++)= '!'; + } + break;case '^': + if(in_square_brackets) + *(wpt++)= '^'; + else + *(wpt++)= '\\'; + *(wpt++)= '^'; + break;case '$': + *(wpt++)= '\\'; + *(wpt++)= '$'; + break;case '\\': + backslash= 1; + *(wpt++)= '\\'; + is_constant= 0; + break;default: + *(wpt++)= *lpt; + } + } else { + backslash= 0; + *(wpt++)= *lpt; + } + lpt++; + } + *(wpt++)= '$'; + *wpt= 0; + return(1+(is_constant>0)); +} + + +#endif /* ! Xorriso_fileliste_externaL */ + + +int Xorriso__hide_mode(char *mode, int flag) +{ + if(strcmp(mode, "on") == 0) + return(1 | 2); + else if(strcmp(mode, "iso_rr") == 0) + return(1); + else if(strcmp(mode, "joliet") == 0) + return(2); + else if(strcmp(mode, "off") == 0) + return(0); + return(-1); +} + + +char *Xorriso__hide_mode_text(int hide_mode, int flag) +{ + switch(hide_mode & 3) { + case 0: + return "off"; + case 1: + return "iso_rr"; + case 2: + return "joliet"; + case 3: + return "on"; + } + return "invalid"; +} + + +/* @return 0=truncated, 1=ok +*/ +int Xorriso__to_upper(char *in, char *out, int out_size, int flag) +{ + int i; + + for(i= 0; i < out_size - 1 && in[i] != 0; i++) + if(isalpha(in[i])) + out[i]= toupper(in[i]); + else + out[i]= in[i]; + out[i]= 0; + return(in[i] == 0); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/misc_funct.h b/libisoburn/branches/1.1.8/xorriso/misc_funct.h new file mode 100644 index 00000000..317f1458 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/misc_funct.h @@ -0,0 +1,97 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of cellaneous helper functions of xorriso. +*/ + + +#ifndef Xorriso_pvt_misc_includeD +#define Xorriso_pvt_misc_includeD yes + +#include <regex.h> + + +char *Text_shellsafe(char *in_text, char *out_text, int flag); + +int Sort_argv(int argc, char **argv, int flag); + +/* @param flag bit0= single letters */ +char *Ftypetxt(mode_t st_mode, int flag); + +/* @param flag bit0=with year and seconds + bit1=timestamp format YYYY.MM.DD.hhmmss +*/ +char *Ftimetxt(time_t t, char timetext[40], int flag); + +int System_uname(char **sysname, char **release, char **version, + char **machine, int flag); + +/** Convert a text into a number of type double and multiply it by unit code + [kmgtpe] (2^10 to 2^60) or [s] (2048). (Also accepts capital letters.) + @param text Input like "42", "2k", "3.14m" or "-1g" + @param flag Bitfield for control purposes: + bit0= return -1 rathern than 0 on failure + @return The derived double value +*/ +double Scanf_io_size(char *text, int flag); + +/* + @flag bit0= do not initialize *diff_count + @return <0 error , 0 = mismatch , 1 = match +*/ +int Compare_text_lines(char *text1, char *text2, int *diff_count, int flag); + +time_t Decode_timestring(char *code, time_t *date, int flag); + +int Decode_ecma119_format(struct tm *erg, char *text, int flag); + +int Wait_for_input(int fd, int microsec, int flag); + +int Fileliste__target_source_limit(char *line, char sep, char **limit_pt, + int flag); + +int Hex_to_bin(char *hex, + int bin_size, int *bin_count, unsigned char *bin_data, int flag); + + +/* bit0= append (text!=NULL) */ +int Sregex_string(char **handle, char *text, int flag); + +/* @param flag bit0= only test expression whether compilable +*/ +int Sregex_match(char *pattern, char *text, int flag); + +/* + vars[][0] points to the variable names, vars[][1] to their contents. + start marks the begin of variable names. It must be non-empty. esc before + start disables this meaning. start and esc may be equal but else they must + have disjoint character sets. + end marks the end of a variable name. It may be empty but if non-empty it + must not appear in vars[][0]. + @param flag bit0= Substitute unknown variables by empty text + (else copy start,name,end unaltered to result). + Parameter end must be non-empty for that. +*/ +int Sregex_resolve_var(char *form, char *vars[][2], int num_vars, + char *start, char *end, char *esc, + char *result, int result_size, int flag); + +/* reg_expr should be twice as large as bourne_expr ( + 2 to be exact) */ +/* return: 2= bourne_expr is surely a constant */ +int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag); + + +int Xorriso__hide_mode(char *mode, int flag); + +char *Xorriso__hide_mode_text(int hide_mode, int flag); + +/* @return 0=truncated, 1=ok +*/ +int Xorriso__to_upper(char *in, char *out, int out_size, int flag); + +#endif /* ! Xorriso_pvt_misc_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/opts_a_c.c b/libisoburn/branches/1.1.8/xorriso/opts_a_c.c new file mode 100644 index 00000000..e9f5fb3f --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/opts_a_c.c @@ -0,0 +1,2338 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of options -a* to -c* as mentioned + in man page or info file derived from xorriso.texi. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + +/* for -charset */ +#include <iconv.h> +#include <langinfo.h> +#include <locale.h> + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* Option -abort_on */ +int Xorriso_option_abort_on(struct XorrisO *xorriso, char *in_severity, + int flag) +{ + int ret, sev; + char severity[20], *official; + + Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0); + ret= Xorriso__text_to_sev(severity, &sev, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "-abort_on: Not a known severity name : "); + Text_shellsafe(in_severity, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(ret); + } + ret= Xorriso__sev_to_text(sev, &official, 0); + if(ret <= 0) + official= severity; + if(Sfile_str(xorriso->abort_on_text, official, 0) <= 0) + return(-1); + xorriso->abort_on_severity= sev; + xorriso->abort_on_is_default= 0; + Xorriso_set_abort_severity(xorriso, 0); + return(1); +} + + +/* Option -abstract_file */ +int Xorriso_option_abstract_file(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, + (int) sizeof(xorriso->abstract_file), + "-abstract_file", 0) <= 0) + return(0); + strcpy(xorriso->abstract_file, name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + +/* Option -acl "on"|"off" */ +int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret; + + if(strcmp(mode, "off")==0) + xorriso->do_aaip&= ~3; + else if(strcmp(mode, "on")==0) + xorriso->do_aaip|= (1 | 2); + else { + sprintf(xorriso->info_text, "-acl: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_set_ignore_aclea(xorriso, 0); + if(ret <= 0) + return(ret); + return(1); +} + + +/* Option -add */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message + bit2= prepend ISO working directory in any case + bit3= unescape \\ +*/ +int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, end_idx, ret, was_failure= 0, fret, optc= 0, split; + char *target= NULL, *source= NULL, *ept, *eff_path= NULL; + char **optv= NULL, *rpt, *wpt; + + ret= Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx, + &optc, &optv, ((!!xorriso->allow_graft_points)<<2)|2); + if(ret<=0) + goto ex; + + Xorriso_alloc_meM(target, char, SfileadrL); + Xorriso_alloc_meM(source, char, SfileadrL); + Xorriso_alloc_meM(eff_path, char, SfileadrL); + + if(!(flag&2)) + Xorriso_pacifier_reset(xorriso, 0); + for(i= 0; i<optc; i++) { + if(Sfile_str(target,optv[i],0)<=0) + {ret= -1; goto ex;} + strcpy(source, optv[i]); + split= 0; + if(xorriso->allow_graft_points) { + ret= Fileliste__target_source_limit(target, '=', &ept, 0); + if(ret>0) { + *ept= 0; + strcpy(source, ept+1); + split= 1; + } + /* unescape \= */; + if(split) + rpt= wpt= target; + else + rpt= wpt= source; + for(; *rpt!=0; rpt++) { + if(*rpt=='\\') { + if(*(rpt+1)=='=') + continue; + if((flag & 8) && *(rpt + 1) == '\\') + rpt++; + } + *(wpt++)= *rpt; + } + *wpt= 0; + } + if(split==0) + strcpy(target, source); + if(flag & 4) { + ret= Sfile_prepend_path(xorriso->wdi, target, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", + (int) (strlen(xorriso->wdi)+strlen(target)+1)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto problem_handler; + } + } + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, target, eff_path, 2); + if(ret<=0) + goto problem_handler; + strcpy(target, eff_path); + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, source,eff_path,2|4); + if(ret<=0) + goto problem_handler; + strcpy(source, eff_path); + + ret= Xorriso_graft_in(xorriso, NULL, source, target, (off_t)0, (off_t)0, 0); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", + (ret>1 ? "directory" : "file"), (target[0] ? target : "/"), source); + if(!(flag&1)) + Xorriso_info(xorriso, 0); + + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + if(!(flag&2)) + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_free_meM(target); + Xorriso_free_meM(source); + Xorriso_free_meM(eff_path); + Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx, &optc, &optv, + 256); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -add_plainly "none"|"unknown" */ +int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode,int flag) +{ + if(strcmp(mode, "none")==0) + xorriso->add_plainly= 0; + if(strcmp(mode, "unknown")==0) + xorriso->add_plainly= 1; + else if(strcmp(mode, "dashed")==0) + xorriso->add_plainly= 2; + else if(strcmp(mode, "any")==0) + xorriso->add_plainly= 3; + else { + sprintf(xorriso->info_text, "-add_plainly: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -alter_date , -alter_date_r */ +/* @param flag bit0=recursive (-alter_date_r) +*/ +int Xorriso_option_alter_date(struct XorrisO *xorriso, + char *time_type, char *timestring, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, t_type= 0, end_idx, fret; + time_t t; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx, + &optc, &optv, 0); + if(ret<=0) + goto ex; + ret= Xorriso_convert_datestring(xorriso, "-alter_date", time_type, timestring, + &t_type, &t, 0); + if(ret<=0) + goto ex; + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-alter_date", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_ad(job, t_type, t, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else + ret= Xorriso_set_time(xorriso, optv[i], t, t_type); + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx, &optc, + &optv, 256); + Findjob_destroy(&job, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -append_partition */ +int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text, + char *type_text, char *image_path, int flag) +{ + int partno = 0, type_code= -1, i; + unsigned int unum; + char *tpt; + static char *part_type_names[] = {"FAT12", "FAT16", "Linux", "", NULL}; + static int part_type_codes[] = { 0x01, 0x06, 0x83, 0x00}; + + sscanf(partno_text, "%d", &partno); + if(partno < 1 || partno > Xorriso_max_appended_partitionS) { + sprintf(xorriso->info_text, + "-append_partition: Partition number '%s' is out of range (1...%d)", + partno_text, Xorriso_max_appended_partitionS); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + for(i= 0; part_type_names[i] != NULL; i++) + if(strcmp(part_type_names[i], type_text) == 0) + break; + if(part_type_names[i] != NULL) + type_code= part_type_codes[i]; + if(type_code < 0) { + tpt= type_text; + if(strncmp(tpt, "0x", 2) == 0) + tpt+= 2; + else + goto bad_type; + unum= 0xffffffff; + sscanf(tpt, "%X", &unum); + if(unum > 0xff) { +bad_type:; + sprintf(xorriso->info_text, + "-append_partition: Partition type '%s' is out of range (0x00...0xff)", + type_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + type_code= unum; + } + + if(xorriso->appended_partitions[partno - 1] != NULL) + free(xorriso->appended_partitions[partno - 1]); + xorriso->appended_partitions[partno - 1]= strdup(image_path); + if(xorriso->appended_partitions[partno - 1] == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + xorriso->appended_part_types[partno - 1]= type_code; + return(1); +} + + +/* Option -application_id */ +int Xorriso_option_application_id(struct XorrisO *xorriso, char *name, + int flag) +{ + if(Xorriso_check_name_len(xorriso, name, + (int) sizeof(xorriso->application_id), + "-application_id", 0) <= 0) + return(0); + if(strcmp(name, "@xorriso@") == 0) + Xorriso_preparer_string(xorriso, xorriso->application_id, 0); + else + strcpy(xorriso->application_id,name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Option -as */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message +*/ +int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int end_idx, ret, idx_count; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + idx_count= end_idx-(*idx); + if(end_idx<=0 || (*idx)>=argc) { + if(idx_count<1) + sprintf(xorriso->info_text, + "-as : Not enough arguments given. Needed: whom do_what %s", + xorriso->list_delimiter); + else + sprintf(xorriso->info_text, + "-as %s : Not enough arguments given. Needed: do_what %s", + argv[*idx], xorriso->list_delimiter); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(strcmp(argv[*idx], "cdrecord")==0 || strcmp(argv[*idx], "wodim")==0 || + strcmp(argv[*idx], "cdrskin")==0 || strcmp(argv[*idx], "xorrecord")==0) { + ret= Xorriso_cdrskin(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1, + 0); + if(ret<=0) + goto ex; + } else if(strcmp(argv[*idx], "mkisofs")==0 || + strcmp(argv[*idx], "genisoimage")==0 || + strcmp(argv[*idx], "genisofs")==0 || + strcmp(argv[*idx], "xorrisofs")==0) { + ret= Xorriso_genisofs(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1, + 0); + if(ret<=0) + goto ex; + } else { + sprintf(xorriso->info_text, + "-as : Not a known emulation personality: '%s'", argv[*idx]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + ret= 1; +ex:; + (*idx)= end_idx; + return(ret); +} + + +/* Option -assert_volid */ +int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern, + char *severity, int flag) +{ + int ret, sev; + char *sev_text= "", off_severity[20]; + + if(strlen(pattern)>=sizeof(xorriso->assert_volid)) { + sprintf(xorriso->info_text, + "Name too long with option -application_id (%d > %d)", + (int) strlen(pattern), (int) sizeof(xorriso->assert_volid)-1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + if(pattern[0]) { + ret= Sregex_match(pattern, "", 1); + if(ret <= 0) { + sprintf(xorriso->info_text, "-assert_volid: Cannot use given pattern."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + if(severity[0] != 0 || pattern[0] != 0) { + if(severity[0] == 0) + sev_text= xorriso->abort_on_text; + else + sev_text= severity; + if(strcmp(sev_text, "NEVER") == 0) + sev_text= "ABORT"; + Xorriso__to_upper(sev_text, off_severity, (int) sizeof(off_severity), 0); + sev_text= off_severity; + ret= Xorriso__text_to_sev(sev_text, &sev, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "-assert_volid: Not a known severity name : "); + Text_shellsafe(severity, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(ret); + } + } + if(Sfile_str(xorriso->assert_volid, pattern,0) <= 0) + return(-1); + strcpy(xorriso->assert_volid_sev, sev_text); + return(1); +} + + +/* Option -auto_charset "on"|"off" */ +int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->do_aaip&= ~(256 | 512); + else if(strcmp(mode, "on")==0) + xorriso->do_aaip|= (256 | 512); + else { + sprintf(xorriso->info_text, "-auto_charset: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -backslash_codes */ +int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode, + int flag) +{ + char *npt, *cpt; + int l, was; + + was= xorriso->bsl_interpretation; + xorriso->bsl_interpretation= 0; + npt= cpt= mode; + for(; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l == 0) + continue; + if(l == 3 && strncmp(cpt, "off", l)==0) { + xorriso->bsl_interpretation= 0; + } else if(l == 16 && strncmp(cpt, "in_double_quotes", l)==0) { + xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 1; + } else if(l == 9 && strncmp(cpt, "in_quotes", l)==0) { + xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 2; + } else if(l == 17 && strncmp(cpt, "with_quoted_input", l)==0) { + xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 3; + } else if(l == 22 && strncmp(cpt, "with_program_arguments", l)==0) { + xorriso->bsl_interpretation= xorriso->bsl_interpretation | 16; + } else if(l == 13 && strncmp(cpt, "encode_output", l)==0) { + xorriso->bsl_interpretation= xorriso->bsl_interpretation | 32 | 64; + } else if(l == 14 && strncmp(cpt, "encode_results", l)==0) { + xorriso->bsl_interpretation= xorriso->bsl_interpretation | 32; + } else if(l == 12 && strncmp(cpt, "encode_infos", l)==0) { + xorriso->bsl_interpretation= xorriso->bsl_interpretation | 64; + } else if(l == 2 && strncmp(cpt, "on", l)==0) { + xorriso->bsl_interpretation= 3 | 16 | 32 | 64; + } else { + if(l<SfileadrL) + sprintf(xorriso->info_text, "-backslash_codes: unknown mode '%s'", cpt); + else + sprintf(xorriso->info_text, + "-backslash_codes: oversized mode parameter (%d)", l); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->bsl_interpretation= was; + return(0); + } + } + return(1); +} + + +/* Option -ban_stdio_write */ +int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag) +{ + xorriso->ban_stdio_write= 1; + return(1); +} + + +/* Option -biblio_file */ +int Xorriso_option_biblio_file(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->biblio_file), + "-biblio_file", 0) <= 0) + return(0); + strcpy(xorriso->biblio_file, name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Option -blank and -format */ +/* @param flag bit0= format rather than blank + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag) +{ + char *cmd= "-blank"; + int aq_ret, ret, mode_flag= 0, as_needed= 0, idx; + off_t size= 0; + + if(flag&1) + cmd= "-format"; + if(xorriso->out_drive_handle == NULL) { + sprintf(xorriso->info_text, + "%s: No output drive set by -dev -or -outdev", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(xorriso->in_drive_handle == xorriso->out_drive_handle) { + if(xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "%s: Image changes pending. -commit or -rollback first.", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + ret= Xorriso_reassure(xorriso, cmd, + "possibly make unreadable data on outdev", 0); + if(ret<=0) + return(2); + + if(strcmp(mode, "as_needed")==0 || mode[0]==0) + as_needed= 1; + else if(strcmp(mode, "all")==0 || strcmp(mode, "full")==0) + mode_flag= 0; + else if((strcmp(mode, "deformat")==0 || + strcmp(mode, "deformat_sequential")==0) && !(flag&1)) + mode_flag= 2; + else if((strcmp(mode, "deformat_quickest")==0 || + strcmp(mode, "deformat_sequential_quickest")==0) && !(flag&1)) + mode_flag= 3; + else if(strcmp(mode, "fast")==0) + mode_flag= 1; + else if(strncmp(mode, "by_index_", 9)==0 && (flag&1)) { + mode_flag= 128; + idx= -1; + if(strlen(mode)>9) + sscanf(mode+9, "%d", &idx); + if(idx<0 || idx>255) { +unusable_index:; + sprintf(xorriso->info_text, + "-format: mode '%s' provides unusable index number", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + mode_flag|= (idx<<8); + } else if(strncmp(mode, "fast_by_index_", 14)==0 && (flag&1)) { + mode_flag= 1 | 128; + idx= -1; + if(strlen(mode)>14) + sscanf(mode+14, "%d", &idx); + if(idx<0 || idx>255) + goto unusable_index; + mode_flag|= (idx<<8); + } else if(strncmp(mode, "by_size_", 8) == 0 && (flag & 1)) { + size= (off_t) Scanf_io_size(mode + 8, 0); + if(size <= 0) { +unusable_size:; + sprintf(xorriso->info_text, + "-format: mode '%s' provides unusable size value", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + mode_flag= 2; + } else if(strncmp(mode, "fast_by_size_", 13) == 0 && (flag & 1)) { + size= (off_t) Scanf_io_size(mode + 13, 0); + if(size <= 0) + goto unusable_size; + mode_flag= 3; + } else { + sprintf(xorriso->info_text, + "%s: Unknown %s mode '%s'", + cmd, ((flag&1) ? "-format" : "-blank"), mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(as_needed) + ret= Xorriso_blank_as_needed(xorriso, (flag&1)<<2); + else if(flag&1) + ret= Xorriso_format_media(xorriso, size, mode_flag & 0xff83); + else + ret= Xorriso_blank_media(xorriso, mode_flag&3); + if(ret==0) + return(ret); + if(ret <= 0) { /* in case of success, above functions will have re-aquired */ + aq_ret= Xorriso_reaquire_outdev(xorriso, 0); /* actually give up drive */ + if(ret<aq_ret) + return(ret); + if(aq_ret<=0) + return(aq_ret); + } + return(1); +} + + +/* Option -boot_image */ +int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form, + char *treatment, int flag) +{ + int was_ok= 1, ret, isolinux_grub= 0, count; + unsigned int u; + char *formpt, *treatpt, *eff_path= NULL; + double num; + + Xorriso_alloc_meM(eff_path, char, SfileadrL); + formpt= form; + if(formpt[0]=='-') + formpt++; + treatpt= treatment; + if(treatpt[0]=='-') + treatpt++; + + if(strcmp(formpt, "isolinux")==0 || strcmp(formpt, "grub") == 0) + isolinux_grub= 1; + if(strcmp(treatpt, "keep")==0) { + if(xorriso->boot_count > 0) { +cannot_keep_or_patch:; + sprintf(xorriso->info_text, + "Loaded boot image has already been replaced. Cannot keep or patch it."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(isolinux_grub) + goto treatment_patch; + xorriso->keep_boot_image= 1; + xorriso->patch_isolinux_image= 0; + xorriso->boot_image_bin_path[0]= 0; + xorriso->patch_system_area= 0; + + } else if(strcmp(treatpt, "patch")==0) { +treatment_patch:; + if(xorriso->boot_count > 0) + goto cannot_keep_or_patch; + xorriso->keep_boot_image= 0; + xorriso->patch_isolinux_image= 1; + xorriso->boot_image_bin_path[0]= 0; + if(strcmp(formpt, "grub") == 0) { + xorriso->patch_isolinux_image|= 2; + xorriso->patch_system_area= 1; + } else if(strcmp(formpt, "isolinux") == 0) + xorriso->patch_system_area= 2; + else + xorriso->patch_system_area= 0; + + } else if(strcmp(treatpt, "discard")==0) { + xorriso->keep_boot_image= 0; + xorriso->patch_isolinux_image= 0; + xorriso->boot_image_bin_path[0]= 0; + xorriso->patch_system_area= 0; + if((xorriso->system_area_options & 0xfc ) == 0) + xorriso->system_area_options= 0; /* Reset eventual type 0 flags */ + if(xorriso->boot_count > 0) { + ret= Xorriso_attach_boot_image(xorriso, 2); /* dispose boot images */ + if(ret <= 0) + goto ex; + } + + } else if(strcmp(treatpt, "next") == 0) { + ret= Xorriso_attach_boot_image(xorriso, 0); + if(ret <= 0) + goto ex; + + } else if(strcmp(treatpt, "show_status")==0) { + sprintf(xorriso->result_line, "------------------------------------\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Status of loaded boot image :\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "------------------------------------\n"); + Xorriso_result(xorriso, 0); + Xorriso_show_boot_info(xorriso, 0); + sprintf(xorriso->result_line, "------------------------------------\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "Boot image settings for next commit:\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "------------------------------------\n"); + Xorriso_result(xorriso, 0); + Xorriso_status(xorriso, "-boot_image", NULL, 0); + sprintf(xorriso->result_line, "------------------------------------\n"); + Xorriso_result(xorriso, 0); + + } else if(strcmp(treatpt, "cat_path=") == 0) { + xorriso->boot_image_cat_path[0] = 0; + } else if(strncmp(treatpt, "cat_path=", 9) == 0) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9, + xorriso->boot_image_cat_path, 2); + if(ret <= 0) + goto ex; + + } else if(strncmp(treatpt, "cat_hidden=", 11) == 0) { + ret= Xorriso__hide_mode(treatpt + 11, 0); + if(ret >= 0) + xorriso->boot_image_cat_hidden= ret; + else + was_ok= 0; + + } else if(strncmp(treatpt, "dir=", 4) == 0) { + if(strcmp(formpt, "isolinux")==0) { + /* ISOLINUX */ + /* The three locations mentioned in http://syslinux.zytor.com/iso.php */ + if(strcmp(treatpt + 4, "/") == 0) + strcpy(xorriso->boot_image_bin_path, "/"); + else if(strcmp(treatpt + 4, "isolinux") == 0 + || strcmp(treatpt + 4, "/isolinux") == 0) + strcpy(xorriso->boot_image_bin_path, "/isolinux/"); + else if(strcmp(treatpt + 4, "boot/isolinux") == 0 + || strcmp(treatpt + 4, "/boot/isolinux") == 0 + || strcmp(treatpt + 4, "boot") == 0 + || strcmp(treatpt + 4, "/boot") == 0) + strcpy(xorriso->boot_image_bin_path, "/boot/isolinux/"); + else { + sprintf(xorriso->info_text, + "Unrecognized keyword with -boot_image %s %s", + form, treatment); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Allowed with dir= are / , /isolinux . /boot/isolinux"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + {ret= 0; goto ex;} + } + strcpy(xorriso->boot_image_cat_path, xorriso->boot_image_bin_path); + strcat(xorriso->boot_image_bin_path, "isolinux.bin"); + strcat(xorriso->boot_image_cat_path, "boot.cat"); + xorriso->boot_image_load_size= 4 * 512; + xorriso->keep_boot_image= 0; + xorriso->patch_isolinux_image= 1; + strcpy(xorriso->boot_image_bin_form, formpt); + {ret= 1; goto ex;} + + } else if(strcmp(formpt, "grub") == 0) { + + /* >>> GRUB */ + was_ok= 0; + + strcpy(xorriso->boot_image_bin_form, formpt); + + } else + was_ok= 0; + + } else if(strcmp(treatpt, "bin_path=") == 0) { + xorriso->boot_image_bin_path[0] = 0; + xorriso->boot_efi_default= 0; + } else if(strncmp(treatpt, "bin_path=", 9) == 0) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9, + xorriso->boot_image_bin_path, 2); + if(ret <= 0) + goto ex; + xorriso->keep_boot_image= 0; + if(isolinux_grub) { + xorriso->patch_isolinux_image= 1; + if(xorriso->boot_image_bin_path[0]) + xorriso->boot_image_load_size= 4 * 512; + strcpy(xorriso->boot_image_bin_form, formpt); + } else + strcpy(xorriso->boot_image_bin_form, "any"); + xorriso->boot_efi_default= 0; + + } else if(strcmp(treatpt, "efi_path=") == 0) { + xorriso->boot_image_bin_path[0] = 0; + xorriso->boot_efi_default= 0; + } else if(strncmp(treatpt, "efi_path=", 9) == 0) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9, + xorriso->boot_image_bin_path, 2); + if(ret <= 0) + goto ex; + xorriso->keep_boot_image= 0; + xorriso->boot_efi_default= 1; + + } else if(strncmp(treatpt, "mips_path=", 10) == 0) { + sprintf(eff_path, "-boot_image %s mips_path=", formpt); + ret= Xorriso_coordinate_system_area(xorriso, 1, 0, eff_path, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 10, + eff_path, 2); + if(ret <= 0) + goto ex; + ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 0); + if(ret <= 0) + goto ex; + + } else if(strncmp(treatpt, "mipsel_path=", 12) == 0) { + sprintf(eff_path, "-boot_image %s mipsel_path=", formpt); + ret= Xorriso_coordinate_system_area(xorriso, 2, 0, eff_path, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 12, + eff_path, 2); + if(ret <= 0) + goto ex; + ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 2); + if(ret <= 0) + goto ex; + + } else if(strcmp(treatpt, "mips_discard") == 0 || + strcmp(treatpt, "mipsel_discard") == 0 || + strcmp(treatpt, "sparc_discard") == 0) { + xorriso->system_area_options&= ~0xfc; /* system area type 0 */ + Xorriso_add_mips_boot_file(xorriso, "", 1); /* give up MIPS boot files */ + + } else if(strncmp(treatpt, "sparc_label=", 12) == 0) { + sprintf(eff_path, "-boot_image %s sparc_path=", formpt); + ret= Xorriso_coordinate_system_area(xorriso, 3, 0, eff_path, 0); + if(ret <= 0) + goto ex; + strncpy(xorriso->ascii_disc_label, treatpt + 12, + Xorriso_disc_label_sizE - 1); + xorriso->ascii_disc_label[Xorriso_disc_label_sizE - 1] = 0; + + } else if(strncmp(treatpt, "boot_info_table=", 16)==0) { + if(strcmp(treatpt + 16, "off") == 0) + xorriso->patch_isolinux_image= 0; + else if(strcmp(treatpt + 16, "on") == 0) + xorriso->patch_isolinux_image= 1 | (2 * (strcmp(treatpt, "grub") == 0)); + else + was_ok= 0; + + } else if(strncmp(treatpt, "load_size=", 10) == 0) { + num= Scanf_io_size(treatpt + 10, 0); + if(num < 512 && isolinux_grub) { + sprintf(xorriso->info_text, + "-boot_image %s : load_size too small (%s < 512)", + formpt, treatpt + 10); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->boot_image_load_size= num; + + } else if(strncmp(treatpt, "id_string=", 10) == 0) { + memset(xorriso->boot_id_string, 0, 29); + if(strlen(treatpt + 10) == 56) { + ret= Hex_to_bin(treatpt + 10, 28, &count, xorriso->boot_id_string, 0); + } else + ret= 0; + if(ret <= 0) + strncpy((char *) xorriso->boot_id_string, treatpt + 10, 28); + + } else if(strncmp(treatpt, "sel_crit=", 9) == 0) { + memset(xorriso->boot_selection_crit, 0, 21); + count= 0; + ret= Hex_to_bin(treatpt + 9, 20, &count, xorriso->boot_selection_crit, 0); + if(ret <= 0) { + sprintf(xorriso->info_text, + "-boot_image %s sel_crit= : Wrong form. Need even number of hex digits.", + formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + } else if(strncmp(treatpt, "system_area=", 12) == 0) { + if(strcmp(formpt, "isolinux")==0) { + ret= Xorriso_coordinate_system_area(xorriso, 0, 2, + "-boot_image isolinux system_area=", 0); + if(ret <= 0) + goto ex; + } + ret= Xorriso_set_system_area_path(xorriso, treatpt + 12, 0); + if(ret <= 0) + goto ex; + + } else if(strncmp(treatpt, "partition_table=", 16)==0) { + if(strcmp(treatpt + 16, "off") == 0) { + xorriso->system_area_options&= ~3; + } else if(strcmp(treatpt + 16, "on") == 0) { + sprintf(eff_path, "-boot_image %s partition_table=", formpt); + if(strcmp(formpt, "isolinux")==0) + ret= Xorriso_coordinate_system_area(xorriso, 0, 2, eff_path, 0); + else + ret= Xorriso_coordinate_system_area(xorriso, 0, 1, eff_path, 0); + if(ret <= 0) + goto ex; + } else + was_ok= 0; + + } else if(strncmp(treatpt, "partition_offset=", 17)==0) { + u= 0; + sscanf(treatpt + 17, "%u", &u); + if(u > 0 && u < 16) { + sprintf(xorriso->info_text, + "-boot_image %s partition_offset= : Non-zero number too small (<16).", + formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->partition_offset= u; + + } else if(strncmp(treatpt, "partition_hd_cyl=", 17)==0) { + u= 0; + sscanf(treatpt + 17, "%u", &u); + if(u > 255) { + sprintf(xorriso->info_text, + "-boot_image %s partition_hd_cyl= : Number too large (>255).", formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->partition_heads_per_cyl= u; + + } else if(strncmp(treatpt, "partition_sec_hd=", 17)==0) { + u= 0; + sscanf(treatpt + 17, "%u", &u); + if(u > 63) { + sprintf(xorriso->info_text, + "-boot_image %s partition_sec_hd= : Number too large (>63).", formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->partition_secs_per_head= u; + + } else if(strncmp(treatpt, "partition_cyl_align=", 20)==0) { + if(strcmp(treatpt + 20, "auto") == 0) + xorriso->system_area_options= (xorriso->system_area_options & ~0x300); + else if(strcmp(treatpt + 20, "on") == 0) + xorriso->system_area_options= + (xorriso->system_area_options & ~0x300) | 0x100; + else if(strcmp(treatpt + 20, "off") == 0) + xorriso->system_area_options= + (xorriso->system_area_options & ~0x300) | 0x200; + else { + sprintf(xorriso->info_text, + "-boot_image %s partition_cyl_align: unknown mode : %s", + formpt, treatpt + 20); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + + } else if(strncmp(treatpt, "platform_id=", 12)==0) { + if(strncmp(treatpt + 12, "0x", 2) == 0) + sscanf(treatpt + 14, "%x", &u); + else + sscanf(treatpt + 12, "%u", &u); + if(u > 0xff) { + sprintf(xorriso->info_text, + "-boot_image %s : platform_id too large (%s > 0xff)", + formpt, treatpt + 12); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->boot_platform_id= u; + + } else if(strncmp(treatpt, "emul_type=", 10)==0) { + if(strcmp(treatpt + 10, "none") == 0 || + strcmp(treatpt + 10, "no_emulation") == 0) { + xorriso->boot_image_emul= 0; + } else if(strcmp(treatpt + 10, "hard_disk") == 0) { + xorriso->boot_image_emul= 1; + } else if(strcmp(treatpt + 10, "floppy") == 0 || + strcmp(treatpt + 10, "diskette") == 0) { + xorriso->boot_image_emul= 2; + } else { + sprintf(xorriso->info_text, + "-boot_image %s : Unknown media_type : %s", + formpt, treatpt + 10); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + } else if(strncmp(treatpt, "isohybrid=", 10) == 0 && + strcmp(formpt, "isolinux")==0) { + +#ifdef Xorriso_with_isohybriD + + if(strcmp(treatpt + 10, "off") == 0) + xorriso->boot_image_isohybrid= 0; + else if(strcmp(treatpt + 10, "auto") == 0) + xorriso->boot_image_isohybrid= 1; + else if(strcmp(treatpt + 10, "on") == 0) + xorriso->boot_image_isohybrid= 2; + else if(strcmp(treatpt + 10, "force") == 0) + xorriso->boot_image_isohybrid= 3; + else { + sprintf(xorriso->info_text, + "Unrecognized keyword with -boot_image %s %s", + form, treatment); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Allowed with isohybrid= are: off , auto , on , force"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + {ret= 0; goto ex;} + } + +#else + + if(strcmp(treatpt + 10, "off") == 0) { + xorriso->boot_image_isohybrid= 0; + } else { + sprintf(xorriso->info_text, + "isohybrid MBR generation has been disabled on request of its inventor H. Peter Anvin on 31 Mar 2010"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "It has been replaced by -boot_image isolinux system_area=External-File"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + } + +#endif /* ! Xorriso_with_isohybriD */ + + } else + was_ok= 0; + + if(!was_ok) { + sprintf(xorriso->info_text, "Unrecognized options with -boot_image: %s %s", + form, treatment); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= 1; +ex: + Xorriso_free_meM(eff_path); + return(ret); +} + + +/* Option -calm_drive */ +int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag) +{ + int gu_flag= 0, ret; + + if(strcmp(which,"in")==0) + gu_flag= 1; + else if(strcmp(which,"out")==0) + gu_flag= 2; + else if(strcmp(which,"on")==0) { + xorriso->do_calm_drive|= 1; + } else if(strcmp(which,"off")==0) { + xorriso->do_calm_drive&= ~1; + } else if(strcmp(which,"revoke")==0) { + gu_flag= 7; + } else + gu_flag= 3; + ret= Xorriso_drive_snooze(xorriso, gu_flag); + return(ret); +} + + +/* Option -cd alias -cdi */ +int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag) +{ + char *path= NULL, *eff_path= NULL; + int ret; + + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(eff_path, char, SfileadrL); + + if (strlen(iso_rr_path)>sizeof(xorriso->wdi)) { + sprintf(xorriso->info_text,"-cdi: iso_rr_path too long (%d > %d)", + (int) strlen(iso_rr_path), (int) sizeof(xorriso->wdi)-1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + Xorriso_warn_of_wildcards(xorriso, iso_rr_path, 1); + sprintf(xorriso->info_text,"previous working directory:\n"); + Xorriso_info(xorriso,0); + Text_shellsafe(xorriso->wdi, xorriso->result_line, 0); + strcat(xorriso->result_line, "/\n"); + Xorriso_result(xorriso,0); + if(strcmp(iso_rr_path,"/")==0 || iso_rr_path[0]==0) { + strcpy(xorriso->wdi,""); + Xorriso_option_pwdi(xorriso, 0); + {ret= 1; goto ex;} + } else if(iso_rr_path[0]!='/') { + strcpy(path, xorriso->wdi); + if(Sfile_add_to_path(path,iso_rr_path,0)<=0) + {ret= -1; goto ex;} + } else { + if(Sfile_str(path,iso_rr_path,0)<=0) + {ret= -1; goto ex;} + } + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 1); + if(ret<0) + goto ex; + if(ret==0) { + sprintf(xorriso->info_text, "-cdi: not existing yet in ISO image : "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 2); + if(ret<=0) + goto ex; + } else if(ret!=2) { + sprintf(xorriso->info_text, "-cdi: not a directory : "); + Text_shellsafe(eff_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + strcpy(xorriso->wdi, eff_path); + + Xorriso_option_pwdi(xorriso, 0); + ret= 1; +ex:; + Xorriso_free_meM(path); + Xorriso_free_meM(eff_path); + return(ret); +} + + +/* Option -cdx */ +int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag) +{ + char *path= NULL, *eff_path= NULL; + int ret; + + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(eff_path, char, SfileadrL); + + if (strlen(disk_path)>sizeof(xorriso->wdx)) { + sprintf(xorriso->info_text,"-cdx: disk_path too long (%d > %d)", + (int) strlen(disk_path), (int) sizeof(xorriso->wdx)-1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + Xorriso_warn_of_wildcards(xorriso, disk_path, 1|2); + sprintf(xorriso->info_text,"previous working directory on hard disk:\n"); + Xorriso_info(xorriso,0); + Text_shellsafe(xorriso->wdx, xorriso->result_line, 0); + strcat(xorriso->result_line, "/\n"); + Xorriso_result(xorriso,0); + if(strcmp(disk_path,"/")==0) { + strcpy(xorriso->wdx,""); + Xorriso_option_pwdx(xorriso, 0); + {ret= 1; goto ex;} + } else if(disk_path[0]!='/') { + strcpy(path, xorriso->wdx); + if(Sfile_add_to_path(path,disk_path,0)<=0) + {ret= -1; goto ex;} + } else { + if(Sfile_str(path,disk_path,0)<=0) + {ret= -1; goto ex;} + } + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, path, eff_path, 2|4); + if(ret<=0) + goto ex; + if(eff_path[0]) { + ret= Sfile_type(eff_path,1|4|8); + if(ret<0) { + Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text,"-cdx: file not found : "); + Text_shellsafe(eff_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(ret!=2) { + Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "-cdx: not a directory : "); + Text_shellsafe(eff_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + if(Sfile_str(xorriso->wdx,eff_path,0)<=0) + {ret= -1; goto ex;} + Xorriso_option_pwdx(xorriso, 0); + ret= 1; +ex:; + Xorriso_free_meM(path); + Xorriso_free_meM(eff_path); + return(ret); +} + + +/* Option -charset */ +/* @param flag bit0= set in_charset + bit1= set out_charset + bit2= set local_charset +*/ +int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag) +{ + int ret; + char *name_pt= NULL, *local_charset; + iconv_t iconv_ret= (iconv_t) -1; + + if(name != NULL) + if(name[0] != 0) + name_pt= name; + if(flag & 4) { + ret= Xorriso_set_local_charset(xorriso, name_pt, 0); + if(ret <= 0) + return(ret); + } + if(flag & 1) { + if(name_pt != NULL) { + Xorriso_get_local_charset(xorriso, &local_charset, 0); + iconv_ret= iconv_open(local_charset, name_pt); + if(iconv_ret == (iconv_t) -1) { + sprintf(xorriso->info_text, + "-%scharset: Cannot convert from character set ", + flag & 2 ? "" : "in_"); + Text_shellsafe(name_pt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", + 0); + return(0); + } else + iconv_close(iconv_ret); + } + if(Sregex_string(&(xorriso->in_charset), name_pt, 0) <= 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + } + if(flag & 2) { + if(name_pt != NULL) { + Xorriso_get_local_charset(xorriso, &local_charset, 0); + iconv_ret= iconv_open(local_charset, name_pt); + if(iconv_ret == (iconv_t) -1) { + sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset ", + flag & 1 ? "" : "out_"); + Text_shellsafe(name_pt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", + 0); + return(0); + } else + iconv_close(iconv_ret); + } + if(Sregex_string(&(xorriso->out_charset), name_pt, 0) <= 0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + } + if(flag & 3) { + if(name_pt == NULL) + Xorriso_get_local_charset(xorriso, &name_pt, 0); + sprintf(xorriso->info_text, "Character set for %sconversion is now: ", + (flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : ""); + Text_shellsafe(name_pt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + return(1); +} + + +/* Options -check_md5 and -check_md5_r + @param flag bit0= issue summary message + bit1= do not reset pacifier, no final pacifier message + >>> bit2= do not issue pacifier messages at all + bit3= recursive: -check_md5_r +*/ +int Xorriso_option_check_md5(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +{ + int ret, i, mem_pci, end_idx, fret, sev, do_report= 0; + int optc= 0; + char **optv= NULL, *cpt, *severity= "ALL", off_severity[20]; + struct FindjoB *job= NULL; + double mem_lut= 0.0; + + mem_pci= xorriso->pacifier_interval; + + ret= Xorriso_opt_args(xorriso, "-check_md5", argc, argv, *idx + 1, + &end_idx, &optc, &optv, 128); + if(ret<=0) + goto ex; + + /* Interpret argv[*idx] as severity */ + if(argc <= *idx) { + sprintf(xorriso->info_text, + "-check_md5: No event severity given for case of mismatch"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + severity= argv[*idx]; + Xorriso__to_upper(severity, off_severity, (int) sizeof(off_severity), 0); + severity= off_severity; + ret= Xorriso__text_to_sev(severity, &sev, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "-check_md5: Not a known severity name : "); + Text_shellsafe(severity, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + + if(!(flag & (2 | 4))) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + xorriso->pacifier_interval= 5.0; + + xorriso->find_check_md5_result= 0; + + if(optc == 0) { + ret= Xorriso_check_session_md5(xorriso, severity, 0); + do_report= 1; + goto ex; + } + + for(i= 0; i < optc; i++) { + if(flag & 8) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-check_md5_r", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_target(job, 35, severity, 0); + cpt= optv[i]; + ret= Xorriso_findi_sorted(xorriso, job, (off_t) 0, 1, &cpt, 0); + Findjob_destroy(&job, 0); + if(ret > 0) + ret= xorriso->find_compare_result; + else { + ret= -1; + xorriso->find_check_md5_result|= 2; + } + } else { + ret= Xorriso_check_md5(xorriso, NULL, optv[i], 4); + if(ret < 0) + xorriso->find_check_md5_result|= 2; + else if(ret == 0) + xorriso->find_check_md5_result|= 1; + else if(ret == 1) + xorriso->find_check_md5_result|= 8; + else if(ret == 2) + xorriso->find_check_md5_result|= 4; + } + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto report_outcome; + } + ret= 1; + +report_outcome:; + do_report= 1; + +ex:; + if(!(flag & (2 | 4))) { + xorriso->pacifier_interval= mem_pci; + if(mem_lut!=xorriso->last_update_time && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 1); + } + if(do_report) { + if(optc == 0) { + if(ret <= 0) { + sprintf(xorriso->result_line, + "MD5 MISMATCH WITH DATA OF LOADED SESSION !\n"); + Xorriso_result(xorriso,0); + if(strcmp(severity, "ALL") != 0) { + sprintf(xorriso->info_text, + "Event triggered by MD5 comparison mismatch"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, severity, 0); + } + } else { + sprintf(xorriso->result_line, "Ok, session data match recorded md5.\n"); + Xorriso_result(xorriso,0); + } + } else { + Xorriso_report_md5_outcome(xorriso, severity, 0); + } + } + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx, + &optc, &optv, 256); + Findjob_destroy(&job, 0); + if(ret <= 0) + return(ret); + return((xorriso->find_check_md5_result & 3) == 0); +} + + +/* Option -check_media */ +int Xorriso_option_check_media(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +{ + int ret, i, count, lba, blocks, quality, pass, was_md5= 0, was_event= 0; + int end_idx, old_idx, os_errno; + char quality_name[80], *head_buffer= NULL; + struct SpotlisT *spotlist= NULL; + struct CheckmediajoB *job= NULL; + struct FindjoB *findjob= NULL; + struct stat dir_stbuf; + + old_idx= *idx; + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + (*idx)= end_idx; + + Xorriso_alloc_meM(head_buffer, char, 64 * 1024); + + ret= Checkmediajob_new(&job, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_check_media_setup_job(xorriso, job, argv, old_idx, end_idx, 0); + if(ret <= 0) + goto ex; + + if((job->report_mode == 1 || job->report_mode == 2) && job->use_dev == 1) { + sprintf(xorriso->info_text, + "-check_media: cannot report=*files while use=outdef"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(job->patch_lba0 && job->data_to_path[0] == 0) { + sprintf(xorriso->info_text, + "-check_media: cannot apply patch_lba0= while data_to= has empty value"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + if(job->use_dev == 2) { + if(job->sector_map_path[0] == 0) { + sprintf(xorriso->info_text, + "-check_media: option use=sector_map but sector_map=''"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + ret= Sectorbitmap_from_file(&(job->sector_map), job->sector_map_path, + xorriso->info_text, &os_errno, 0); + if(ret <= 0) { + if(xorriso->info_text[0]) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, os_errno, + "FAILURE", 0); + goto ex; + } + ret= Xorriso_sectormap_to_spotlist(xorriso, job, &spotlist, 0); + if(ret <= 0) + goto ex; + Sectorbitmap_destroy(&(xorriso->in_sector_map), 0); + ret= Sectorbitmap_clone(job->sector_map, &(xorriso->in_sector_map), 0); + if(ret <= 0) + goto ex; + } else { + ret= Xorriso_check_media(xorriso, &spotlist, job, 0); + if(ret <= 0) + goto ex; + } + + if(job->patch_lba0) { + ret= Xorriso_open_job_data_to(xorriso, job, 0); + if(ret <= 0) + goto ex; + if(ret == 1) { + ret= Xorriso_update_iso_lba0(xorriso, job->patch_lba0_msc1, 0, + head_buffer, job, + (8 * (job->patch_lba0 == 1)) | + 4 | (job->patch_lba0_msc1 < 0)); + if(ret <= 0) + goto ex; + } + } + + if(job->report_mode == 0 || job->report_mode == 2) { /* report blocks */ + for(pass= 0; pass < 2; pass++) { + if(pass == 0) { + sprintf(xorriso->result_line, + "Media checks : lba , size , quality\n"); + } else { + if(!was_md5) + break; + sprintf(xorriso->result_line, + "MD5 checks : lba , size , result\n"); + } + Xorriso_result(xorriso,0); + count= Spotlist_count(spotlist, 0); + for(i= 0; i < count; i++) { + ret= Spotlist_get_item(spotlist, i, &lba, &blocks, &quality, 0); + if(ret <= 0) + continue; + if(pass == 0) { + if(quality == Xorriso_read_quality_md5_mismatcH || + quality == Xorriso_read_quality_unreadablE) { + was_event= 1; + } + if(quality == Xorriso_read_quality_md5_matcH || + quality == Xorriso_read_quality_md5_mismatcH) { + was_md5= 1; + continue; + } + } + else if(pass == 1 && !(quality == Xorriso_read_quality_md5_matcH || + quality == Xorriso_read_quality_md5_mismatcH)) + continue; + sprintf(xorriso->result_line, "%s: %10d , %10d , %s\n", + pass == 0 ? "Media region " : "MD5 tag range", + lba, blocks, Spotlist__quality_name(quality, quality_name, + xorriso->check_media_bad_limit, 0)); + Xorriso_result(xorriso,0); + } + } + } + if(job->report_mode == 1 || job->report_mode == 2) { /* report files */ + ret= Findjob_new(&findjob, "/", 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-check_media report=files", 0); + {ret= -1; goto ex;} + } + Findjob_set_damage_filter(findjob, 1, 0); + Findjob_set_action_target(findjob, 21, NULL, 0); + ret= Xorriso_findi(xorriso, findjob, NULL, (off_t) 0, + NULL, "/", &dir_stbuf, 0, 0); + Findjob_destroy(&findjob, 0); + if(ret <= 0) + goto ex; + } + ret= 1; +ex:; + if(was_event && strcmp(job->event_severity, "ALL") != 0) { + sprintf(xorriso->info_text, + "Event triggered by media read error or MD5 comparison mismatch"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, job->event_severity, + 0); + } + Spotlist_destroy(&spotlist, 0); + Checkmediajob_destroy(&job, 0); + Xorriso_free_meM(head_buffer); + return(ret); +} + + +/* Option -check_media_defaults */ +int Xorriso_option_check_media_defaults(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +{ + int ret, old_idx, end_idx; + struct CheckmediajoB *job= NULL; + + old_idx= *idx; + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + (*idx)= end_idx; + + ret= Checkmediajob_new(&job, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_check_media_setup_job(xorriso, job, argv, old_idx, end_idx, 0); + if(ret <= 0) + goto ex; + Checkmediajob_destroy(&(xorriso->check_media_default), 0); + xorriso->check_media_default= job; + job= NULL; + ret= 1; +ex:; + Checkmediajob_destroy(&job, 0); + return(ret); +} + + +/* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */ +/* @param flag bit0=recursive (-chgrp_r) +*/ +int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + gid_t gid_number; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-chgrpi", argc, argv, *idx, &end_idx, &optc, + &optv, 0); + if(ret<=0) + goto ex; + ret= Xorriso_convert_gidstring(xorriso, gid, &gid_number, 0); + if(ret<=0) + goto ex; + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-chgrp_r", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_chgrp(job, gid_number, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else + ret= Xorriso_set_gid(xorriso, optv[i], gid_number, 0); + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-chgrpi", argc, argv, *idx, &end_idx, &optc, &optv, + 256); /* clean up */ + if(ret<=0) + return(ret); + Findjob_destroy(&job, 0); + return(!was_failure); +} + + +/* Option -chmod alias -chmodi , -chmod_r alias chmod_ri */ +/* @param flag bit0=recursive (-chmod_r) +*/ +int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + mode_t mode_and= ~0, mode_or= 0; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-chmodi", argc, argv, *idx, &end_idx, &optc, + &optv, 0); + if(ret<=0) + goto ex; + ret= Xorriso_convert_modstring(xorriso, "-chmodi", + mode, &mode_and, &mode_or, 0); + if(ret<=0) + goto ex; + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-chmod_r", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_chmod(job, mode_and, mode_or, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else { + ret= Xorriso_set_st_mode(xorriso, optv[i], mode_and, mode_or, 0); + } + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-chmodi", argc, argv, *idx, &end_idx, &optc, &optv, + 256); + Findjob_destroy(&job, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -chown alias -chowni , chown_r alias chown_ri */ +/* @param flag bit0=recursive (-chown_r) +*/ +int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + uid_t uid_number; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-chowni", argc, argv, *idx, &end_idx, + &optc, &optv, 0); + if(ret<=0) + goto ex; + ret= Xorriso_convert_uidstring(xorriso, uid, &uid_number, 0); + if(ret<=0) + goto ex; + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-chown_r", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_chown(job, uid_number, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else + ret= Xorriso_set_uid(xorriso, optv[i], uid_number, 0); + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-chowni", argc, argv, *idx, &end_idx, + &optc, &optv, 256); + Findjob_destroy(&job, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -clone */ +int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest, + int flag) +{ + int ret; + + ret= Xorriso_clone_tree(xorriso, NULL, origin, dest, 0); + return(ret); +} + + +/* Option -close "on"|"off" */ +int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag) +{ + xorriso->do_close= !!strcmp(mode, "off"); + return(1); +} + + +/* Option -close_damaged */ +int Xorriso_option_close_damaged(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret, force= 0; + + if(strcmp(mode, "as_needed") == 0 || strcmp(mode, "") == 0) + force= 0; + else if(strcmp(mode, "force") == 0) + force= 1; + else { + sprintf(xorriso->info_text, "-close_damaged: unknown mode "); + Text_shellsafe(mode, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_reassure(xorriso, "-close_damaged", + "Close damaged track and session", 0); + if(ret <= 0) + {ret= 2; goto ex;} + ret= Xorriso_close_damaged(xorriso, force); + if(ret <= 0) + goto ex; + ret= 1; +ex:; + return(ret); +} + + +/* Option -close_filter_list */ +int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag) +{ + xorriso->filter_list_closed= 1; + return(1); +} + + +/* Option -commit */ +/* @param flag bit0= leave indrive and outdrive aquired as they were, + i.e. do not aquire outdrive as new in-out-drive + bit1= do not perform eventual -reassure + @return <=0 error , 1 success, 2 revoked by -reassure , 3 no change pending +*/ +int Xorriso_option_commit(struct XorrisO *xorriso, int flag) +{ + int ret; + + if(!xorriso->volset_change_pending) { + sprintf(xorriso->info_text, "-commit: No image modifications pending"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + {ret= 3; goto ex;} + } + if(!(flag&2)) { + ret= Xorriso_reassure(xorriso, "-commit", + "write the pending image changes to the medium", 0); + if(ret<=0) + {ret= 2; goto ex;} + } + Xorriso_process_errfile(xorriso, 0, "burn session start", 0, 1); + ret= Xorriso_write_session(xorriso, 0); + Xorriso_process_errfile(xorriso, 0, "burn session end", 0, 1); + if(ret<=0) + goto ex; + Xorriso_write_session_log(xorriso, 0); + xorriso->volset_change_pending= 0; + xorriso->no_volset_present= 0; + if(flag&1) + {ret= 1; goto ex;} + if(Sregex_string(&(xorriso->in_charset), xorriso->out_charset, 0) <= 0) + {ret= -1; goto ex;} + if(xorriso->grow_blindly_msc2>=0) + ret= Xorriso_option_dev(xorriso, "", 3|4); + else { + xorriso->displacement= 0; + xorriso->displacement_sign= 0; + ret= Xorriso_reaquire_outdev(xorriso, 3); + if(xorriso->in_drive_handle == NULL) + xorriso->image_start_mode= 0; /* session setting is invalid by now */ + } +ex:; + return(ret); +} + + +/* Option -commit_eject */ +/* @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag) +{ + int ret, eret; + + ret= Xorriso_option_commit(xorriso, 1); + if(ret<=0 || ret==2 || ret==3) + return(ret); + if(strcmp(which, "none")==0) + eret= 1; + else + eret= Xorriso_option_eject(xorriso, which, 1); + ret= Xorriso_option_dev(xorriso, "", 3|4); + if(eret<ret) + return(eret); + return(ret); +} + + +/* Options -compare and -compare_r + @param flag bit0= issue summary message + bit1= do not reset pacifier, no final pacifier message + bit2= do not issue pacifier messages at all + bit3= recursive: -compare_r +*/ +int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag) +{ + int ret, mem_pci, zero= 0, result, follow_links; + double mem_lut= 0.0; + char *ipth, *argv[6], *eff_origin= NULL, *eff_dest= NULL; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + + ipth= iso_path; + if(ipth[0]==0) + ipth= disk_path; + if(disk_path[0]==0) { + sprintf(xorriso->info_text, "-compare: Empty disk_path given"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + {ret= 0; goto ex;} + } + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin, + 2|4|8); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2|8); + if(ret<=0) + goto ex; + + if(xorriso->disk_excl_mode&8) + ret= Xorriso_path_is_excluded(xorriso, eff_origin, 1); + else + ret= 0; + if(ret!=0) + goto report_outcome; + if(!(flag&2)) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + mem_pci= xorriso->pacifier_interval; + xorriso->pacifier_interval= 5.0; + + if(flag&8) { + xorriso->find_compare_result= 1; + argv[0]= eff_dest; + argv[1]= "-exec"; + argv[2]= "compare"; + argv[3]= eff_origin; + zero= 0; + ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */ + if(ret>0) { + argv[0]= eff_origin; + argv[1]= "-exec"; + argv[2]= "not_in_iso"; + argv[3]= eff_dest; + zero= 0; + ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */ + if(ret>0 && !xorriso->do_follow_mount) { + argv[0]= eff_origin; + argv[1]= "-type"; + argv[2]= "m"; + argv[3]= "-exec"; + argv[4]= "is_full_in_iso"; + argv[5]= eff_dest; + zero= 0; + ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */ + } + if(ret>0) + ret= xorriso->find_compare_result; + else + ret= -1; + } else + ret= -1; + } else { + follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) << 28; + ret= Xorriso_compare_2_files(xorriso, eff_origin, eff_dest, "", &result, + 2 | follow_links | ((flag&4)<<27) | (1<<30)); + } + + xorriso->pacifier_interval= mem_pci; + if(mem_lut!=xorriso->last_update_time && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 1); +report_outcome:; + if(ret>0) { + sprintf(xorriso->result_line, + "Both file objects match as far as expectable.\n"); + } else if(ret==0) { + sprintf(xorriso->result_line, "Differences detected.\n"); + } else { + sprintf(xorriso->result_line, "Comparison failed due to error.\n"); + } + if(flag&1) + Xorriso_result(xorriso,0); + if(ret<0) + goto ex; + ret= 1; +ex:; + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + return(ret); +} + + +/* Option -compliance */ +int Xorriso_option_compliance(struct XorrisO *xorriso, char *mode, + int flag) +{ + return(Xorriso_relax_compliance(xorriso, mode, 0)); +} + + +/* Option -copyright_file */ +int Xorriso_option_copyright_file(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, + (int) sizeof(xorriso->copyright_file), + "-copyright_file", 0) <= 0) + return(0); + strcpy(xorriso->copyright_file, name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Option -cp_clone */ +int Xorriso_option_cp_clone(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, end_idx_dummy, ret, is_dir= 0, was_failure= 0, fret, pass; + char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL; + int optc= 0; + char **optv= NULL; + struct stat stbuf; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(dest_dir, char, SfileadrL); + Xorriso_alloc_meM(leafname, char, SfileadrL); + + ret= Xorriso_cpmv_args(xorriso, "-cp_clone", argc, argv, idx, + &optc, &optv, eff_dest, 1); + if(ret<=0) + goto ex; + if(ret == 1 && optc > 1) { +nondir_exists:; + sprintf(xorriso->info_text, + "-cp_clone: Copy address already exists and is not a directory: "); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + strcpy(dest_dir, eff_dest); + if(optc == 1) { + ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0); + if(ret >= 0) { + if(S_ISDIR(stbuf.st_mode))/* target directory exists */ + is_dir= 1; + else + goto nondir_exists; + } + } else { + is_dir= 1; + ret= Xorriso_mkdir(xorriso, dest_dir, 1 | 2); + if(ret < 0) + {ret= -(ret != -1); goto ex;} + } + + /* Pass 0 checks whether the way is clear, pass 1 does the cloning */ + for(pass= 0; pass < 2; pass++) { + for(i= 0; i<optc; i++) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, + optv[i], eff_origin, !!pass); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + if(is_dir) { + ret= Sfile_leafname(eff_origin, leafname, 0); + if(ret<=0) + goto problem_handler; + strcpy(eff_dest, dest_dir); + ret= Sfile_add_to_path(eff_dest, leafname, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", + (int) (strlen(eff_dest)+strlen(leafname)+1)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto problem_handler; + } + } + ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0); + if(pass == 0) { + /* It is ok if both are directories */; + if(ret >= 0 && S_ISDIR(stbuf.st_mode)) { + ret= Xorriso_iso_lstat(xorriso, eff_origin, &stbuf, 0); + if (ret >= 0 && S_ISDIR(stbuf.st_mode)) + ret= -1; + } + if(ret >= 0) { + sprintf(xorriso->info_text, "Cloning: May not overwrite: "); + Text_shellsafe(eff_dest, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto problem_handler; + } + } else { + ret= Xorriso_clone_tree(xorriso, NULL, eff_origin, eff_dest, 1); + if(ret <= 0) + goto problem_handler; + } + + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + } + ret= !was_failure; +ex:; + Xorriso_opt_args(xorriso, "-cp_clone", + argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256); + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(dest_dir); + Xorriso_free_meM(leafname); + return(ret); +} + + +/* Option -cpr alias -cpri */ +int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy; + char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL; + int optc= 0; + char **optv= NULL; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(dest_dir, char, SfileadrL); + Xorriso_alloc_meM(leafname, char, SfileadrL); + + ret= Xorriso_cpmv_args(xorriso, "-cpri", argc, argv, idx, + &optc, &optv, eff_dest, 1|2); + if(ret<=0) + goto ex; + if(ret==2) { + is_dir= 1; + strcpy(dest_dir, eff_dest); + } + + /* Perform graft-ins */ + Xorriso_pacifier_reset(xorriso, 0); + for(i= 0; i<optc && !xorriso->request_to_abort; i++) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, optv[i], eff_origin, + 2|4); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + if(is_dir) { + ret= Sfile_leafname(eff_origin, leafname, 0); + if(ret<=0) + goto problem_handler; + strcpy(eff_dest, dest_dir); + ret= Sfile_add_to_path(eff_dest, leafname, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", + (int) (strlen(eff_dest)+ strlen(leafname)+1)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto problem_handler; + } + } + ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest, + (off_t) 0, (off_t) 0, 0); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", + (ret>1 ? "directory" : "file"), (eff_dest[0] ? eff_dest : "/"), + eff_origin); + if(!(flag&1)) + Xorriso_info(xorriso, 0); + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + ret= !was_failure; +ex:; + Xorriso_opt_args(xorriso, "-cpri", + argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256); + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(dest_dir); + Xorriso_free_meM(leafname); + return(ret); +} + + +/* Options -cpx , -cpax, -cp_rx , -cp_rax */ +/* @param flag bit0= recursive (-cp_rx, -cp_rax) + bit1= full property restore (-cpax, -cp_rax) +*/ +int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy, problem_count; + char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL; + char **eff_src_array= NULL, **eff_tgt_array= NULL; + int optc= 0; + char **optv= NULL; + struct stat stbuf; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(dest_dir, char, SfileadrL); + Xorriso_alloc_meM(leafname, char, SfileadrL); + + ret= Xorriso_cpmv_args(xorriso, "-cp*x", argc, argv, idx, + &optc, &optv, eff_dest, 1|4); + if(ret<=0) + goto ex; + if(ret==2) { + is_dir= 1; + strcpy(dest_dir, eff_dest); + } + if(xorriso->allow_restore <= 0) { + sprintf(xorriso->info_text, + "-cpx: image-to-disk copies are not enabled by option -osirrox"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + if(xorriso->do_restore_sort_lba || !(xorriso->ino_behavior & 4)) { + eff_src_array= calloc(optc, sizeof(char *)); + eff_tgt_array= calloc(optc, sizeof(char *)); + if(eff_src_array == NULL || eff_tgt_array == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + for(i= 0; i < optc; i++) + eff_src_array[i]= eff_tgt_array[i]= NULL; + } + + /* Perform copying */ + Xorriso_pacifier_reset(xorriso, 0); + for(i= 0; i<optc && !xorriso->request_to_abort; i++) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, optv[i], eff_origin, + 2|8); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + + ret= Xorriso_iso_lstat(xorriso, eff_origin, &stbuf, 2|4); + if(ret==-1) + goto problem_handler; + if(S_ISDIR(stbuf.st_mode) && !(flag&1)) { + /* only allow directories if they actually represent split data files */ + ret= 0; + if(xorriso->do_concat_split) + ret= Xorriso_is_split(xorriso, eff_origin, NULL, 0); + if(ret<0) + goto problem_handler; + if(ret==0) { + sprintf(xorriso->info_text, "-cpx: May not copy directory "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto problem_handler; + } + } + + if(is_dir && strcmp(eff_origin, "/")!=0) { + ret= Sfile_leafname(eff_origin, leafname, 0); + if(ret<=0) + goto problem_handler; + strcpy(eff_dest, dest_dir); + ret= Sfile_add_to_path(eff_dest, leafname, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", + (int) (strlen(eff_dest)+strlen(leafname)+1)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto problem_handler; + } + } + if(eff_src_array != NULL) { + eff_src_array[i]= strdup(eff_origin); + eff_tgt_array[i]= strdup(eff_dest); + if(eff_src_array[i] == NULL || eff_tgt_array[i] == NULL) { + Xorriso_no_malloc_memory(xorriso, &(eff_src_array[i]), 0); + ret= -1; goto ex; + } + } else { + ret= Xorriso_restore(xorriso, eff_origin, eff_dest, (off_t) 0, (off_t) 0, + 16 | ((!(flag&2))<<6)); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + if(ret==3 || (flag&1)) + continue; + sprintf(xorriso->info_text, + "Copied from ISO image to disk: %s '%s' = '%s'\n", + (ret>1 ? "directory" : "file"), eff_origin, eff_dest); + Xorriso_info(xorriso, 0); + } + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + + if(eff_src_array != NULL) { + ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, + &problem_count, 0); + if(ret <= 0 || problem_count > 0) + was_failure= 1; + } + if(xorriso->pacifier_count>0) + Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count, + xorriso->pacifier_total, "", 1|4); + ret= !was_failure; +ex:; + i= optc; + Sfile_destroy_argv(&i, &eff_src_array, 0); + i= optc; + Sfile_destroy_argv(&i, &eff_tgt_array, 0); + Xorriso_opt_args(xorriso, "-cp*x", + argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256); + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(dest_dir); + Xorriso_free_meM(leafname); + return(ret); +} + + +/* Option -cut_out */ +int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, + char *start, char *count, char *iso_rr_path, int flag) +{ + int ret; + double num; + off_t startbyte, bytecount; + + num= Scanf_io_size(start, 0); + if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */ + sprintf(xorriso->info_text, + "-cut_out: startbyte address negative or much too large (%s)", start); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + startbyte= num; + num= Scanf_io_size(count, 0); + if(num<=0 || num > 1.0e18) { + sprintf(xorriso->info_text, + "-cut_out: bytecount zero, negative or much too large (%s)", count); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + bytecount= num; + sprintf(xorriso->info_text, + "-cut_out from %s , byte %.f to %.f, and graft as %s", + disk_path, (double) startbyte, (double) (startbyte+bytecount), + iso_rr_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount, + iso_rr_path, 0); + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/opts_d_h.c b/libisoburn/branches/1.1.8/xorriso/opts_d_h.c new file mode 100644 index 00000000..e5dcb57a --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/opts_d_h.c @@ -0,0 +1,2101 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of options as mentioned in man page + or info file derived from xorriso.texi. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* Options -dev , -indev, -outdev */ +/** @param flag bit0= use as indev + bit1= use as outdev + bit2= do not -reassure + bit3= regard overwriteable media as blank + bit4= if the drive is a regular disk file: truncate it to + the write start address + bit5= do not print toc of aquired drive + bit6= do not calm down drive after aquiring it + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag) +{ + int ret; + char *adr; + + adr= in_adr; + if(strcmp(in_adr, "-")==0) + adr= "stdio:/dev/fd/1"; + if(strncmp(adr, "stdio:", 6)==0) { + if(strlen(adr)==6 || strcmp(adr, "stdio:/")==0 || + strcmp(adr, "stdio:.")==0 || strcmp(adr, "stdio:..")==0 || + strcmp(adr, "stdio:-")==0) { + sprintf(xorriso->info_text, + "No suitable path given by device address '%s'", adr); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + + if(xorriso->volset_change_pending && (flag&1)) { + sprintf(xorriso->info_text, + "%s: Image changes pending. -commit or -rollback first", + (flag&2) ? "-dev" : "-indev"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if((flag&1) && (xorriso->in_drive_handle != NULL || adr[0]) && !(flag&4)) { + ret= Xorriso_reassure(xorriso, (flag&2) ? "-dev" : "-indev", + "eventually discard the current image", 0); + if(ret<=0) + return(2); + } + + if(adr[0]==0) { + if((flag&1) && xorriso->in_drive_handle != NULL) { + if(xorriso->in_drive_handle == xorriso->out_drive_handle) + sprintf(xorriso->info_text,"Giving up -dev "); + else + sprintf(xorriso->info_text,"Giving up -indev "); + Text_shellsafe(xorriso->indev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + if((flag&2) && xorriso->out_drive_handle != NULL && + xorriso->in_drive_handle != xorriso->out_drive_handle) { + sprintf(xorriso->info_text,"Giving up -outdev "); + Text_shellsafe(xorriso->outdev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + ret= Xorriso_give_up_drive(xorriso, (flag&3)|((flag&32)>>2)); + } else + ret= Xorriso_aquire_drive(xorriso, adr, NULL, + (flag & (3 | 32 | 64)) | (((flag & (8 | 16)) >> 1))); + if(ret<=0) + return(ret); + if(xorriso->in_drive_handle == NULL) + xorriso->image_start_mode= 0; /* session setting is invalid by now */ + return(1); +} + + +/* Option -devices , -device_links */ +/* @param flag bit0= perform -device_links rather than -devices + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_devices(struct XorrisO *xorriso, int flag) +{ + int ret; + + if(xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "-devices: Image changes pending. -commit or -rollback first"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_reassure(xorriso, "-devices", + "eventually discard the current image", 0); + if(ret<=0) + return(2); + xorriso->info_text[0]= 0; + if(xorriso->in_drive_handle!=NULL || xorriso->out_drive_handle!=NULL) { + if(xorriso->in_drive_handle == xorriso->out_drive_handle) { + sprintf(xorriso->info_text, "Gave up -dev "); + Text_shellsafe(xorriso->indev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + }else { + if(xorriso->in_drive_handle!=NULL) { + sprintf(xorriso->info_text, "Gave up -indev "); + Text_shellsafe(xorriso->indev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + if(xorriso->out_drive_handle!=NULL) { + sprintf(xorriso->info_text, "Gave up -outdev "); + Text_shellsafe(xorriso->outdev, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + } + Xorriso_give_up_drive(xorriso, 3); + } + ret= Xorriso_show_devices(xorriso, flag & 1); + return(ret); +} + + +/* Option -dialog "on"|"single_line"|"off" */ +int Xorriso_option_dialog(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "on") == 0 || strcmp(mode, "multi_line") == 0) + xorriso->dialog= 2; + else if(strcmp(mode, "single_line") == 0) + xorriso->dialog= 2; + else if(strcmp(mode, "off") == 0) + xorriso->dialog= 0; + else { + sprintf(xorriso->info_text, "-dialog: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + +/* Option -disk_dev_ino "on"|"ino_only"|"off" */ +int Xorriso_option_disk_dev_ino(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "on") == 0) + xorriso->do_aaip= (xorriso->do_aaip & ~128) | 16 | 32 | 64; + else if(strcmp(mode, "ino_only") == 0) + xorriso->do_aaip|= 16 | 32 | 64 | 128; + else if(strcmp(mode, "off") == 0) + xorriso->do_aaip &= ~(16 | 32 | 64 | 128); + else { + sprintf(xorriso->info_text, "-disk_dev_ino: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + +/* Option -disk_pattern "on"|"ls"|"off" */ +int Xorriso_option_disk_pattern(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->do_disk_pattern= 0; + else if(strcmp(mode, "on")==0) + xorriso->do_disk_pattern= 1; + else if(strcmp(mode, "ls")==0) + xorriso->do_disk_pattern= 2; + else { + sprintf(xorriso->info_text, "-disk_pattern: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -displacement [-]offset */ +int Xorriso_option_displacement(struct XorrisO *xorriso, char *value, int flag) +{ + double num; + int displacement_sign= 1, l; + char *cpt; + + cpt= value; + if(value[0] == '-') { + displacement_sign= -1; + cpt++; + } else if(value[0] == '+') + cpt++; + num= Scanf_io_size(cpt, 0); + l= strlen(cpt); + if(cpt[l - 1] < '0' || cpt[l - 1] > '9') + num/= 2048.0; + if(num < 0.0 || num > 4294967295.0) { + sprintf(xorriso->info_text, + "-displacement: too large or too small: '%s'", value); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(num == 0) + displacement_sign= 0; + xorriso->displacement= num; + xorriso->displacement_sign= displacement_sign; + return(1); +} + + +/* Option -drive_class */ +int Xorriso_option_drive_class(struct XorrisO *xorriso, + char *d_class, char *pattern, int flag) +{ + int ret= 1; + + if(strcmp(d_class, "banned") == 0) { + ret= Xorriso_lst_new(&(xorriso->drive_blacklist), pattern, + xorriso->drive_blacklist, 1); + } else if(strcmp(d_class, "caution") == 0) { + ret= Xorriso_lst_new(&(xorriso->drive_greylist), pattern, + xorriso->drive_greylist, 1); + } else if (strcmp(d_class, "harmless") == 0) { + ret= Xorriso_lst_new(&(xorriso->drive_whitelist), pattern, + xorriso->drive_whitelist, 1); + } else if (strcmp(d_class, "clear_list") == 0) { + if(strcmp(pattern, "banned") == 0) + Xorriso_lst_destroy_all(&(xorriso->drive_blacklist), 0); + else if(strcmp(pattern, "caution") == 0) + Xorriso_lst_destroy_all(&(xorriso->drive_greylist), 0); + else if(strcmp(pattern, "harmless") == 0) + Xorriso_lst_destroy_all(&(xorriso->drive_whitelist), 0); + else if(strcmp(pattern, "all") == 0) { + Xorriso_lst_destroy_all(&(xorriso->drive_blacklist), 0); + Xorriso_lst_destroy_all(&(xorriso->drive_greylist), 0); + Xorriso_lst_destroy_all(&(xorriso->drive_whitelist), 0); + } else { + sprintf(xorriso->info_text, "-drive_class clear : unknown class '%s'", + pattern); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= 1; + } else { + sprintf(xorriso->info_text, "-drive_class: unknown class '%s'", d_class); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(ret); +} + + +/* Option -dummy "on"|"off" */ +int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag) +{ + xorriso->do_dummy= !!strcmp(mode, "off"); + return(1); +} + + +/* Option -dvd_obs "default"|"32k"|"64k" */ +int Xorriso_option_dvd_obs(struct XorrisO *xorriso, char *obs, int flag) +{ + double num; + + if(strcmp(obs, "default") == 0) + num= 0; + else + num = Scanf_io_size(obs,0); + if(num != 0 && num != 32768 && num != 65536) { + sprintf(xorriso->info_text, + "-dvd_obs : Bad size. Acceptable are 0, 32k, 64k"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } else + xorriso->dvd_obs= num; + return(1); +} + + +/* Option -early_stdio_test */ +int Xorriso_option_early_stdio_test(struct XorrisO *xorriso, char *mode, + int flag) +{ + if(strcmp(mode, "on") == 0) + xorriso->early_stdio_test= 2 | 4; + else if(strcmp(mode, "off") == 0) + xorriso->early_stdio_test= 0; + else if(strcmp(mode, "appendable_wo") == 0) + xorriso->early_stdio_test= 2 | 4 | 8; + else { + sprintf(xorriso->info_text, "-early_stdio_test: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + +/* Option -eject */ +/* @param flag bit0=do not report toc of eventually remaining drives +*/ +int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag) +{ + int gu_flag= 4, ret; + + if(strncmp(which,"in",2)==0) + gu_flag|= 1; + else if(strncmp(which,"out",3)==0) + gu_flag|= 2; + else + gu_flag|= 3; + if((gu_flag&1) && xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "-eject: Image changes pending. -commit or -rollback first"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(flag&1) + gu_flag|= 8; + ret= Xorriso_give_up_drive(xorriso, gu_flag); + return(ret); +} + + +/* Options -end , and -rollback_end */ +/* @param flag bit0= discard pending changes + bit1= do not -reassure + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_end(struct XorrisO *xorriso, int flag) +{ + int ret; + char *cmd, *which_will; + + if(flag&1) + cmd= "-rollback_end"; + else + cmd= "-end"; + if(xorriso->volset_change_pending) { + if((flag & 1) || xorriso->volset_change_pending != 1) + which_will= "end the program discarding image changes"; + else + which_will= "commit image changes and then end the program"; + } else { + which_will= "end the program"; + } + if(!(flag&2)) { + ret= Xorriso_reassure(xorriso, cmd, which_will, 0); + if(ret<=0) + return(2); + } + + if(xorriso->volset_change_pending) { + if((flag & 1) || xorriso->volset_change_pending != 1) { + xorriso->volset_change_pending= 0; + } else { + ret= Xorriso_option_commit(xorriso, 1); + xorriso->volset_change_pending= 0; /* no further tries to commit */ + if(ret<=0) + return(ret); + } + } + ret= Xorriso_give_up_drive(xorriso, 3); + if(ret<=0) + return(ret); + return(1); +} + + +/* Option -errfile_log marked|plain path|-|"" */ +int Xorriso_option_errfile_log(struct XorrisO *xorriso, + char *mode, char *path, int flag) +{ + int ret, mode_word; + FILE *fp= NULL; + + if(path[0]==0 || path[0]=='-') { + /* ok */; + } else { + fp= fopen(path, "a"); + if(fp==0) { + sprintf(xorriso->info_text, "-errfile_log: Cannot open file "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + mode_word= xorriso->errfile_mode; + if(strcmp(mode, "marked")==0) + mode_word|= 1; + else if(strcmp(mode, "plain")==0) + mode_word&= ~1; + else { + sprintf(xorriso->info_text, "-errfile_log: Unknown mode "); + Text_shellsafe(mode, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + if(fp != NULL) + fclose(fp); + return(0); + } + + Xorriso_process_errfile(xorriso, 0, "log end", 0, 1); + if(xorriso->errfile_fp!=NULL) + fclose(xorriso->errfile_fp); + xorriso->errfile_fp= fp; + xorriso->errfile_mode= mode_word; + ret= Sfile_str(xorriso->errfile_log, path, 0); + if(ret>0) + ret= Xorriso_process_errfile(xorriso, 0, "log start", 0, 1); + if(ret<=0) + return(ret); + return(1); +} + + +/* Option -error_behavior */ +int Xorriso_option_error_behavior(struct XorrisO *xorriso, + char *occasion, char *behavior, int flag) +{ + if(strcmp(occasion, "image_loading")==0) { + if(strcmp(behavior, "best_effort")==0) + xorriso->img_read_error_mode= 0; + else if(strcmp(behavior, "failure")==0 || strcmp(behavior, "FAILURE")==0) + xorriso->img_read_error_mode= 1; + else if(strcmp(behavior, "fatal")==0 || strcmp(behavior, "FATAL")==0) + xorriso->img_read_error_mode= 2; + else { +unknown_behavior:; + sprintf(xorriso->info_text, + "-error_behavior: with '%s': unknown behavior '%s'", + occasion, behavior); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } else if(strcmp(occasion, "file_extraction")==0) { + if(strcmp(behavior, "best_effort")==0) + xorriso->extract_error_mode= 0; + else if(strcmp(behavior, "keep")==0) + xorriso->extract_error_mode= 1; + else if(strcmp(behavior, "delete")==0) + xorriso->extract_error_mode= 2; + else + goto unknown_behavior; + } else { + sprintf(xorriso->info_text, "-error_behavior: unknown occasion '%s'", + occasion); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -external_filter */ +int Xorriso_option_external_filter(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +{ + int ret, start_idx, end_idx; + + start_idx= *idx; + end_idx= Xorriso_end_idx(xorriso, argc, argv, start_idx, 1); + (*idx)= end_idx; + if(end_idx - start_idx < 3) { + sprintf(xorriso->info_text, + "-external_filter : Not enough arguments given. Needed: name options path %s", + xorriso->list_delimiter); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_external_filter(xorriso, argv[start_idx], + argv[start_idx + 1], argv[start_idx + 2], + end_idx - start_idx - 3, argv + start_idx + 3, 0); + return(ret); +} + + +/* Options -extract , -extract_single */ +/* @param flag bit0=do not report the restored item + bit1=do not reset pacifier, no final pacifier message + bit2= do not make lba-sorted node array for hardlink detection + bit5= -extract_single: eventually do not insert directory tree +*/ +int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path, + char *disk_path, int flag) +{ + int ret, problem_count; + char *eff_origin= NULL, *eff_dest= NULL, *ipth, *eopt[1], *edpt[1]; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + + if(xorriso->allow_restore <= 0) { + sprintf(xorriso->info_text, + "-extract: image-to-disk copies are not enabled by option -osirrox"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(!(flag&2)) + Xorriso_pacifier_reset(xorriso, 0); + + ipth= iso_path; + if(ipth[0]==0) + ipth= disk_path; + if(disk_path[0]==0) { + sprintf(xorriso->info_text, "-extract: Empty disk_path given"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + ret= 0; goto ex; + } + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_dest, + 2|4); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_origin, 2|8); + if(ret<=0) + goto ex; + + eopt[0]= eff_origin; + edpt[0]= eff_dest; + ret= Xorriso_restore_sorted(xorriso, 1, eopt, edpt, &problem_count, + (flag & 32 ? 33 : 0)); + + if(!(flag&2)) + Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count, + xorriso->pacifier_total, "", 1|4); + if(ret <= 0 || problem_count > 0) + goto ex; + + if(!(flag&1)) { + sprintf(xorriso->info_text, "Extracted from ISO image: %s '%s'='%s'\n", + (ret>1 ? "directory" : "file"), eff_origin, eff_dest); + Xorriso_info(xorriso,0); + } + ret= 1; +ex:; + if(!(flag & (4 | 32))) + Xorriso_destroy_node_array(xorriso, 0); + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + return(ret); +} + + +/* Option -extract_cut */ +int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path, + char *start, char *count, char *disk_path, int flag) +{ + int ret; + double num; + off_t startbyte, bytecount; + + num= Scanf_io_size(start, 0); + if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */ + sprintf(xorriso->info_text, + "-extract_cut: startbyte address negative or much too large (%s)", + start); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + startbyte= num; + num= Scanf_io_size(count, 0); + if(num<=0 || num > 1.0e18) { + sprintf(xorriso->info_text, + "-extract_cut: bytecount zero, negative or much too large (%s)", + count); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + bytecount= num; + sprintf(xorriso->info_text, + "-extract_cut from %s , byte %.f to %.f, and store as %s", + iso_rr_path, (double) startbyte, (double) (startbyte+bytecount), + disk_path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + ret= Xorriso_extract_cut(xorriso, iso_rr_path, disk_path, + startbyte, bytecount, 0); + return(ret); +} + + +/* Option -file_size_limit */ +int Xorriso_option_file_size_limit(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +{ + int ret, i, end_idx; + off_t new_limit= 0; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + if(*idx >= end_idx) + {ret= 2; goto ex;} + if(*idx + 1 == end_idx && strcmp(argv[*idx], "off") == 0) { + xorriso->file_size_limit= 0; + ret= 1; goto ex; + } + for(i= *idx; i < end_idx; i++) + new_limit+= Scanf_io_size(argv[i], 0); + if(new_limit <= 0) { + sprintf(xorriso->info_text, "-file_size_limit: values sum up to %.f", + (double) new_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); + ret= 0; goto ex; + } + xorriso->file_size_limit= new_limit; + ret= 1; +ex:; + (*idx)= end_idx; + if(ret > 0) { + if(xorriso->file_size_limit > 0) + sprintf(xorriso->info_text, "-file_size_limit now at %.f\n", + (double) xorriso->file_size_limit); + else + sprintf(xorriso->info_text, "-file_size_limit now off\n"); + Xorriso_info(xorriso,0); + } + return(ret); +} + + +/* Option -find alias -findi, and -findx */ +/* @param flag bit0= -findx rather than -findi + bit1= do not reset pacifier, no final pacifier message + do not reset find_compare_result + bit2= do not count deleted files with rm and rm_r + bit3= use Xorriso_findi_sorted() rather than Xorriso_findi() + (this can also be ordered by test -sort_lba) +*/ +int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count; + int list_extattr_head= 0, bsl_mem; + struct FindjoB *job, *first_job= NULL, *new_job; + char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt; + char *access_acl_text= NULL, *default_acl_text= NULL, *list_extattr_mode; + + struct stat dir_stbuf; + uid_t user= 0; + gid_t group= 0; + time_t date= 0; + mode_t mode_or= 0, mode_and= ~1; + double mem_lut= 0.0; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(other_path_start, char, SfileadrL); + + start_path= "."; + list_extattr_mode= "e"; + if(end_idx > *idx && start_path[0]!=0) + start_path= argv[*idx]; + ret= Findjob_new(&first_job, start_path, 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-find[ix]", 0); + {ret= -1; goto ex;} + } + job= first_job; + if(!(flag&2)) + xorriso->find_compare_result= 1; + for(i= *idx+1; i<end_idx; i++) { + if(strcmp(argv[i], "-name")==0) { + if(i+1>=end_idx) { +not_enough_arguments:; + sprintf(xorriso->info_text, + "-find[ix]: not enough arguments with test "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + i++; + ret= Findjob_set_name_expr(job, argv[i], 0); + if(ret<=0) { + sprintf(xorriso->info_text, "-find[ix]: cannot set -name expression "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + } else if(strcmp(argv[i], "-wholename")==0) { + if(i+1>=end_idx) + goto not_enough_arguments; + i++; + ret= Findjob_set_name_expr(job, argv[i], 1); + if(ret<=0) { + sprintf(xorriso->info_text, + "-find[ix]: cannot set -wholename expression "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + } else if(strcmp(argv[i], "-type")==0) { + if(i+1>=end_idx) + goto not_enough_arguments; + i++; + ret= Findjob_set_file_type(job, argv[i][0], 0); + if(ret<=0) { + sprintf(xorriso->info_text, "-find[ix]: unknown -type '%c'",argv[i][0]); + goto sorry_ex; + } + } else if(strcmp(argv[i], "-damaged")==0) { + Findjob_set_damage_filter(job, 1, 0); + } else if(strcmp(argv[i], "-undamaged")==0) { + Findjob_set_damage_filter(job, -1, 0); + } else if(strcmp(argv[i], "-lba_range")==0) { + if(i+2>=end_idx) + goto not_enough_arguments; + i+= 2; + sscanf(argv[i-1], "%d", &start_lba); + sscanf(argv[i], "%d", &count); + Findjob_set_lba_range(job, start_lba, count, 0); + } else if(strcmp(argv[i], "-pending_data")==0) { + Findjob_set_commit_filter_2(job, 0); + } else if(strcmp(argv[i], "-has_acl")==0) { + Findjob_set_acl_filter(job, 1, 0); + } else if(strcmp(argv[i], "-has_no_acl")==0) { + Findjob_set_acl_filter(job, -1, 0); + } else if(strcmp(argv[i], "-has_xattr")==0) { + Findjob_set_xattr_filter(job, 1, 0); + } else if(strcmp(argv[i], "-has_any_xattr")==0) { + Findjob_set_xattr_filter(job, 1, 1); + } else if(strcmp(argv[i], "-has_no_xattr")==0) { + Findjob_set_xattr_filter(job, -1, 0); + } else if(strcmp(argv[i], "-has_aaip")==0) { + Findjob_set_aaip_filter(job, 1, 0); + } else if(strcmp(argv[i], "-has_no_aaip")==0) { + Findjob_set_aaip_filter(job, -1, 0); + } else if(strcmp(argv[i], "-has_filter")==0) { + Findjob_set_filter_filter(job, 1, 0); + } else if(strcmp(argv[i], "-has_no_filter")==0) { + Findjob_set_filter_filter(job, -1, 0); + } else if(strcmp(argv[i], "-has_md5")==0) { + Findjob_set_prop_filter(job, 15, 1, 0); + } else if(strcmp(argv[i], "-disk_name")==0) { + if(i+1>=end_idx) + goto not_enough_arguments; + i++; + ret= Findjob_set_name_expr(job, argv[i], 2); + if(ret<=0) { + sprintf(xorriso->info_text, + "-find[ix]: cannot set -disk_name expression "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + } else if(strcmp(argv[i], "-hidden")==0) { + if(i + 1 >= end_idx) + goto not_enough_arguments; + i+= 1; + type= Xorriso__hide_mode(argv[i], 0); + if(type < 0) { + sprintf(xorriso->info_text, "-findi: -hidden : unknown hide state "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } else { + ret= Findjob_set_test_hidden(job, type, 0); + if(ret <= 0) { + sprintf(xorriso->info_text, "-findi: cannot setup -hidden test"); + goto sorry_ex; + } + } + } else if(strcmp(argv[i], "-true") == 0) { + ret= Findjob_set_false(job, -1, 0); + } else if(strcmp(argv[i], "-false") == 0) { + ret= Findjob_set_false(job, 1, 0); + } else if(strcmp(argv[i], "-decision") == 0) { + if(i+1>=end_idx) + goto not_enough_arguments; + i++; + ret= Findjob_set_decision(job, argv[i], 0); + } else if(strcmp(argv[i], "-prune") == 0) { + ret= Findjob_set_prune(job, 0); + } else if(strcmp(argv[i], "-sub") == 0 || strcmp(argv[i], "(") == 0) { + ret= Findjob_open_bracket(job, 0); + } else if(strcmp(argv[i], "-subend") == 0 || strcmp(argv[i], ")") == 0) { + ret= Findjob_close_bracket(job, 0); + } else if(strcmp(argv[i], "-not") == 0 || strcmp(argv[i], "!") == 0) { + ret= Findjob_not(job, 0); + } else if(strcmp(argv[i], "-and") == 0 || strcmp(argv[i], "-a") == 0) { + ret= Findjob_and(job, 0); + } else if(strcmp(argv[i], "-or") == 0 || strcmp(argv[i], "-o") == 0) { + ret= Findjob_or(job, 0); + } else if(strcmp(argv[i], "-if") == 0) { + ret= Findjob_if(job, 0); + } else if(strcmp(argv[i], "-then") == 0) { + ret= Findjob_then(job, 0); + } else if(strcmp(argv[i], "-else") == 0) { + ret= Findjob_else(job, 0); + } else if(strcmp(argv[i], "-elseif") == 0) { + ret= Findjob_elseif(job, 0); + } else if(strcmp(argv[i], "-endif") == 0) { + ret= Findjob_endif(job, 0); + } else if(strcmp(argv[i], "-sort_lba") == 0) { + flag|= 8; + /* If an operator is open: insert a -true test, else do nothing */ + ret= Findjob_set_false(job, -1, 1); + if(ret == 2) + ret= 1; + } else if(strcmp(argv[i], "-exec")==0) { + if(i+1>=end_idx) { +not_enough_exec_arguments:; + sprintf(xorriso->info_text, + "-find[ix]: not enough arguments with -exec "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + i++; + cpt= argv[i]; + if(*cpt=='-') + cpt++; + if(strcmp(cpt, "echo")==0) { + Findjob_set_action_target(job, 0, NULL, 0); + } else if(strcmp(cpt, "rm")==0) { + Findjob_set_action_target(job, 1, NULL, 0); + deleter= 1; + } else if(strcmp(cpt, "rm_r")==0) { + Findjob_set_action_target(job, 2, NULL, 0); + deleter= 1; + +#ifdef NIX +/* >>> not implemented yet */; + } else if(strcmp(cpt, "mv")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + Findjob_set_action_target(job, 3, argv[i], 0); +#endif + + } else if(strcmp(cpt, "chown")==0 || strcmp(cpt, "chown_r")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0); + if(ret<=0) + goto ex; + ret= Findjob_set_action_chown(job, user, strlen(cpt)>5); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-find -exec chown_r", 0); + goto ex; + } + } else if(strcmp(cpt, "chgrp")==0 || strcmp(cpt, "chgrp_r")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0); + if(ret<=0) + goto ex; + ret= Findjob_set_action_chgrp(job, group, strlen(cpt)>5); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-find -exec chgrp_r", 0); + goto ex; + } + } else if(strcmp(cpt, "chmod")==0 || strcmp(cpt, "chmod_r")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod", + argv[i], &mode_and, &mode_or, 0); + if(ret<=0) + goto ex; + ret= Findjob_set_action_chmod(job, mode_and, mode_or, strlen(cpt)>5); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-find -exec chmod_r", 0); + goto ex; + } + } else if(strcmp(cpt, "alter_date")==0 || strcmp(cpt, "alter_date_r")==0){ + if(i+2>=end_idx) + goto not_enough_exec_arguments; + i+= 2; + ret= Xorriso_convert_datestring(xorriso, "-find -exec alter_date", + argv[i-1], argv[i], &type, &date, 0); + if(ret<=0) + goto ex; + ret= Findjob_set_action_ad(job, type, date, strlen(cpt)>10); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-find -exec alter_date_r", 0); + goto ex; + } + } else if(strcmp(cpt, "lsdl")==0) { + Findjob_set_action_target(job, 8, NULL, 0); + + } else if(strcmp(cpt, "find")==0) { + ret= Findjob_new(&new_job, "", 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-find[ix]", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_subjob(job, 13, new_job, 0); + job= new_job; + + } else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0 || + strcmp(cpt, "widen_hardlinks")==0 || + strcmp(cpt, "update_merge")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + action= 14; + if(strcmp(cpt, "update")==0) + action= 17; + else if(strcmp(cpt, "widen_hardlinks")==0) + action= 32; + else if(strcmp(cpt, "update_merge") == 0) { + action= 41; + /* Enter update_merge mode for node adding */ + xorriso->update_flags|= 1; + } + + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i], + other_path_start, 1|2|4|8); + if(ret<=0) + goto ex; + Findjob_set_action_target(job, action, other_path_start, 0); + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, start_path, + path, 1|2|4); + if(ret<=0) + goto ex; + Findjob_set_start_path(job, path, 0); + if(!(flag&2)) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + } else if(strcmp(cpt, "in_iso")==0 || + strcmp(cpt, "not_in_iso")==0 || + strcmp(cpt, "add_missing")==0 || + strcmp(cpt, "empty_iso_dir")==0 || + strcmp(cpt, "is_full_in_iso")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, argv[i], + other_path_start, 1|2|4); + if(ret<=0) + goto ex; + if(strcmp(cpt, "in_iso")==0) + action= 15; + else if(strcmp(cpt, "add_missing")==0) + action= 18; + else if(strcmp(cpt, "empty_iso_dir")==0) + action= 19; + else if(strcmp(cpt, "is_full_in_iso")==0) + action= 20; + else + action= 16; + Findjob_set_action_target(job, action, other_path_start, 0); + ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, start_path, path, + 1|2|4|8); + if(ret<=0) + goto ex; + Findjob_set_start_path(job, path, 0); + + } else if(strcmp(cpt, "report_damage")==0) { + Findjob_set_action_target(job, 21, NULL, 0); + } else if(strcmp(cpt, "report_lba")==0) { + Findjob_set_action_target(job, 22, NULL, 0); + } else if(strcmp(cpt, "getfacl")==0) { + Findjob_set_action_target(job, 24, NULL, 0); + } else if(strcmp(cpt, "setfacl")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + ret= Xorriso_normalize_acl_text(xorriso, argv[i], + &access_acl_text, &default_acl_text, 0); + if(ret <= 0) + goto ex; + Findjob_set_action_text_2(job, 25, access_acl_text, default_acl_text, + 0); + } else if(strcmp(cpt, "getfattr")==0) { + Findjob_set_action_target(job, 26, NULL, 0); + } else if(strcmp(cpt, "setfattr")==0) { + if(i + 2 >= end_idx) + goto not_enough_exec_arguments; + i+= 2; + /* check input */ + ret= Xorriso_path_setfattr(xorriso, NULL, "", argv[i - 1], + strlen(argv[i]), argv[i], 1); + if(ret <= 0) + goto ex; + Findjob_set_action_text_2(job, 27, argv[i - 1], argv[i], 0); + } else if(strcmp(cpt, "set_filter")==0) { + if(i + 1 >= end_idx) + goto not_enough_exec_arguments; + i+= 1; + Findjob_set_action_target(job, 28, argv[i], 0); + if(!(flag&2)) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + } else if(strcmp(cpt, "show_stream")==0) { + Findjob_set_action_target(job, 29, NULL, 0); + } else if(strcmp(cpt, "get_any_xattr")==0) { + Findjob_set_action_target(job, 33, NULL, 0); + } else if(strcmp(cpt, "get_md5")==0) { + Findjob_set_action_target(job, 34, NULL, 0); + } else if(strcmp(cpt, "check_md5")==0) { + if(i + 1 >= end_idx) + goto not_enough_exec_arguments; + i+= 1; + Findjob_set_action_target(job, 35, argv[i], 0); + flag|= 8; + if(!(flag&2)) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + if(!(flag & 1)) + xorriso->find_check_md5_result= 0; + } else if(strcmp(cpt, "make_md5")==0) { + Findjob_set_action_target(job, 36, NULL, 0); + flag|= 8; + if(!(flag&2)) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + } else if(strcmp(cpt, "mkisofs_r")==0) { + Findjob_set_action_target(job, 37, NULL, 0); + } else if(strcmp(cpt, "sort_weight")==0) { + if(i + 1 >= end_idx) + goto not_enough_exec_arguments; + i+= 1; + sscanf(argv[i], "%d", &type); + Findjob_set_action_type(job, 38, type, 0); + } else if(strcmp(cpt, "hide")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + type= Xorriso__hide_mode(argv[i], 0); + if(type < 0) { + sprintf(xorriso->info_text, "-find -exec hide: unknown hide state "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + Findjob_set_action_type(job, 39, type, 0); + } else if(strcmp(cpt, "estimate_size")==0) { + Findjob_set_action_target(job, 40, NULL, 0); + } else if(strcmp(cpt, "rm_merge")==0) { + Findjob_set_action_target(job, 42, NULL, 0); + xorriso->update_flags&= ~1; /* End update_merge mode for node adding */ + } else if(strcmp(cpt, "clear_merge")==0) { + Findjob_set_action_target(job, 43, NULL, 0); + xorriso->update_flags&= ~1; /* End update_merge mode for node adding */ + } else if(strcmp(cpt, "list_extattr")==0) { + if(i+1>=end_idx) + goto not_enough_exec_arguments; + i++; + Findjob_set_action_target(job, 44, argv[i], 0); + list_extattr_head= 1; + list_extattr_mode= argv[i]; + } else { + sprintf(xorriso->info_text, "-find -exec: unknown action "); + Text_shellsafe(argv[i], xorriso->info_text, 1); + goto sorry_ex; + } + } else { + sprintf(xorriso->info_text, "-find[ix]: unknown option "); + Text_shellsafe(argv[i], xorriso->info_text, 1); +sorry_ex:; + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + if(list_extattr_head) { + sprintf(xorriso->result_line, + "# Output of xorriso %s action list_extattr\n", + (flag & 1) ? "-findx" : "-find"); + Xorriso_result(xorriso, 0); + strcpy(xorriso->result_line, "cd "); + if(start_path[0] == '/') + strcat(xorriso->result_line, "/"); + else { + cd_pt= (flag & 1) ? xorriso->wdx : xorriso->wdi; + if(cd_pt[0] == 0) + cd_pt= "/"; + ret= Xorriso_append_extattr_comp(xorriso, cd_pt, strlen(cd_pt), + list_extattr_mode, 0); + if(ret <= 0) + goto ex; + } + strcat(xorriso->result_line, "\n"); + /* temporarily disable -backslash_codes with result output */ + bsl_mem= xorriso->bsl_interpretation; + xorriso->bsl_interpretation= 0; + Xorriso_result(xorriso, 0); + xorriso->bsl_interpretation= bsl_mem; + + sprintf(xorriso->result_line, "c=\"setextattr\"\n\n"); + Xorriso_result(xorriso, 0); + } + if(flag&1) + ret= Xorriso_findx(xorriso, first_job, "", start_path, &dir_stbuf, 0, NULL, + 0); + else if(flag & 8) { + cpt= start_path; + ret= Xorriso_findi_sorted(xorriso, first_job, (off_t) 0, 1, &cpt, 0); + } else + ret= Xorriso_findi(xorriso, first_job, NULL, (off_t) 0, NULL, + start_path, &dir_stbuf, 0, (flag&4)>>1); +ex:; + if(deleter && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "iso_rr_paths deleted", + xorriso->pacifier_count, 0, "", 1|2); + else if(first_job->action == 28 && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "file filters processed", + xorriso->pacifier_count, 0, "", 1 | 2); + else if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2)) + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 1); + if(first_job->action == 35 && !(flag & 1)) + Xorriso_report_md5_outcome(xorriso, first_job->target, 0); + if(first_job->action == 40) { + sprintf(xorriso->result_line,"Size lower : %lus\n", + (unsigned long) (first_job->estim_lower_size / (off_t) 2048)); + Xorriso_result(xorriso,0); + sprintf(xorriso->result_line,"Size upper : %lus\n", + (unsigned long) ((first_job->estim_upper_size / (off_t) 2048) + + !!(first_job->estim_upper_size % 2048))); + Xorriso_result(xorriso,0); + } + if(access_acl_text != NULL) + free(access_acl_text); + if(default_acl_text != NULL) + free(default_acl_text); + Findjob_destroy(&first_job, 0); + Xorriso_free_meM(path); + Xorriso_free_meM(other_path_start); + (*idx)= end_idx; + return(ret); +} + + +/* Option -follow */ +int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) +{ + int was_fl, was_fm, was_fpr, was_fpt, l; + double num; + char *cpt, *npt; + + was_fpt= xorriso->do_follow_pattern; + was_fpr= xorriso->do_follow_param; + was_fl= xorriso->do_follow_links; + was_fm= xorriso->do_follow_mount; + xorriso->do_follow_pattern= 0; + xorriso->do_follow_param= 0; + xorriso->do_follow_links= 0; + xorriso->do_follow_mount= 0; + npt= cpt= mode; + for(cpt= mode; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l==0) + goto unknown_mode; + if(strncmp(cpt, "off", l)==0) { + xorriso->do_follow_pattern= 0; + xorriso->do_follow_param= 0; + xorriso->do_follow_links= 0; + xorriso->do_follow_mount= 0; + } else if(strncmp(cpt, "on", l)==0) { + xorriso->do_follow_pattern= 1; + xorriso->do_follow_param= 1; + xorriso->do_follow_links= 1; + xorriso->do_follow_mount= 1; + } else if(strncmp(cpt, "default", l)==0) { + xorriso->do_follow_pattern= 1; + xorriso->do_follow_param= 0; + xorriso->do_follow_links= 0; + xorriso->do_follow_mount= 1; + xorriso->follow_link_limit= 100; + } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) { + xorriso->do_follow_links= 1; + } else if(strncmp(cpt, "mount", l)==0) { + xorriso->do_follow_mount= 1; + } else if(strncmp(cpt,"param", l)==0) { + xorriso->do_follow_param= 1; + } else if(strncmp(cpt, "pattern", l)==0) { + xorriso->do_follow_pattern= 1; + } else if(strncmp(cpt, "limit=", 6)==0) { + sscanf(cpt+6, "%lf", &num); + if(num<=0 || num>1.0e6) { + sprintf(xorriso->info_text, "-follow: Value too %s with '%s'", + num<=0 ? "small" : "large", cpt+6); + goto sorry_ex; + } + xorriso->follow_link_limit= num; + } else { +unknown_mode:; + if(l<SfileadrL) + sprintf(xorriso->info_text, "-follow: unknown mode '%s'", cpt); + else + sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l); +sorry_ex: + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->do_follow_pattern= was_fpt; + xorriso->do_follow_param= was_fpr; + xorriso->do_follow_links= was_fl; + xorriso->do_follow_mount= was_fm; + return(0); + } + } + return(1); +} + + +/* Option -fs */ +int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag) +{ + double num; + + num= Scanf_io_size(size, 0); + if(num < 64*1024 || num > 1024.0 * 1024.0 * 1024.0) { + sprintf(xorriso->info_text, "-fs: wrong size %.f (allowed: %.f - %.f)", + num, 64.0 * 1024.0, 1024.0 * 1024.0 * 1024.0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->fs= num / 2048.0; + if(xorriso->fs * 2048 < num) + xorriso->fs++; + return(1); +} + + +/* Optionis -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri + -getfattr alias getfattri +*/ +/* @param flag bit0= recursive -getfacl_r + bit1= getfattr rather than getfacl + bit3= with bit1: do not ignore eventual non-user attributes +*/ +int Xorriso_option_getfacli(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx, &optc, + &optv, 0); + if(ret<=0) + goto ex; + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-getfacl_r", 0); + {ret= -1; goto ex;} + } + if(flag & 2) { + Findjob_set_action_target(job, 26, NULL, 0); + } else + Findjob_set_action_target(job, 24, NULL, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else { + if(flag & 2) + ret= Xorriso_getfattr(xorriso, NULL, optv[i], NULL, flag & 8); + else + ret= Xorriso_getfacl(xorriso, NULL, optv[i], NULL, 0); + } + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx, + &optc, &optv, 256); + Findjob_destroy(&job, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -gid */ +int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag) +{ + int ret; + + xorriso->do_global_gid= 0; + if(gid[0]==0 || strcmp(gid,"-")==0) + return(1); + ret= Xorriso_convert_gidstring(xorriso, gid, &(xorriso->global_gid), 0); + if(ret>0) + xorriso->do_global_gid= 1; + return(ret); +} + + +/* Option -grow_blindly */ +int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag) +{ + double num; + int l; + + if(msc2[0]==0 || msc2[0]=='-' || strcmp(msc2, "off")==0) { + xorriso->grow_blindly_msc2= -1; + return(1); + } + num= Scanf_io_size(msc2, 0); + l= strlen(msc2); + if(msc2[l-1]<'0' || msc2[l-1]>'9') + num/= 2048.0; + xorriso->grow_blindly_msc2= num; + return(1); +} + + +/* Option -hardlinks "on"|"off" */ +int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret; + char *what_data= NULL, *what, *what_next; + + Xorriso_alloc_meM(what_data, char, SfileadrL); + if(Sfile_str(what_data, mode, 0)<=0) { + sprintf(xorriso->info_text, + "-hardlinks: mode string is much too long (%d)", + (int) strlen(mode)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + for(what= what_data; what != NULL; what= what_next) { + what_next= strchr(what, ':'); + if(what_next != NULL) { + *what_next= 0; + what_next++; + } + if(strcmp(what, "off") == 0) { + Xorriso_finish_hl_update(xorriso, 0); + xorriso->ino_behavior|= 1 | 2 | 4; + xorriso->ino_behavior&= ~8; + } else if(strcmp(what, "on") == 0) { + xorriso->ino_behavior&= ~(1 | 2 | 4 | 8); + } else if(strcmp(what, "without_update") == 0) { + Xorriso_finish_hl_update(xorriso, 0); + xorriso->ino_behavior&= ~(1 | 2 | 4); + xorriso->ino_behavior|= 8; + } else if(strcmp(what, "start_update") == 0) { + xorriso->ino_behavior&= ~(1 | 2 | 4 | 8); + ret= Xorriso_make_di_array(xorriso, 1); + if(ret <= 0) + goto ex; + } else if(strcmp(what, "end_update") == 0) { + Xorriso_finish_hl_update(xorriso, 0); + } else if(strcmp(what, "perform_update") == 0) { + Xorriso_finish_hl_update(xorriso, 0); + } else if(strcmp(what, "start_extract") == 0) { + xorriso->ino_behavior&= ~(1 | 2 | 4); + ret= Xorriso_make_hln_array(xorriso, 1); + if(ret <= 0) + goto ex; + } else if(strcmp(what, "end_extract") == 0) { + Xorriso_destroy_hln_array(xorriso, 0); + } else if(strcmp(what, "discard_extract") == 0) { + Xorriso_destroy_hln_array(xorriso, 0); + } else if(strcmp(what, "normal_extract") == 0) { + xorriso->ino_behavior&= ~16; + } else if(strcmp(what, "cheap_sorted_extract") == 0) { + xorriso->ino_behavior|= 16; + } else { + sprintf(xorriso->info_text, "-hardlinks: unknown mode '%s' in '%s'", + what, mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + + /* <<< ts B00613 : This is wrong: it enables new_rr if -hardlinks is off. + Documented is that new_rr gets enabled if hardlinks are on. + But it never worked that way. + A compromise seems to be to disable this totally and + to change man xorriso. + new_rr still is not recognized by mount on Solaris. + + if(xorriso->ino_behavior & 2) + Xorriso_option_compliance(xorriso, "new_rr", 0); + */ + + ret= 1; +ex:; + Xorriso_free_meM(what_data); + return(ret); +} + + +/* Option -help and part of -prog_help */ +int Xorriso_option_help(struct XorrisO *xorriso, int flag) +{ + static char text[][80]={ + +#ifdef Xorriso_no_helP + +"This binary program does not contain a help text.", +"If available, read: man 1 xorriso", + +#else + +"This program creates, loads, manipulates and writes ISO 9660 filesystem", +"images with Rock Ridge extensions. Write targets can be drives with optical", +"media or local filesystem objects.", +"", +"Preparation options:", +"Drive addresses are either /dev/... as listed with option -devices or", +"disk files, eventually with prefix \"stdio:\" if non-CD-drive in /dev tree.", +"E.g. /dev/sr0 , /tmp/pseudo_drive , stdio:/dev/sdc", +" -dev address Set input and output drive and load eventual ISO image.", +" Set the image expansion method to growing.", +" -indev address Set input drive and load eventual ISO image. Use expansion", +" methods modifying or blind growing.", +" -outdev address", +" Set output drive and use modifying or blind growing.", +" -drive_class \"harmless\"|\"banned\"|\"risky\"|\"clear_list\" disk_pattern", +" Add a drive path pattern to one of the safety lists or make", +" those lists empty. Defaulty entry in \"risky\" is \"/dev\".", +" -grow_blindly \"off\"|predicted_nwa", +" Switch between modifying and blind growing.", +" -load \"session\"|\"track\"|\"lba\"|\"sbsector\"|\"volid\"|\"auto\" id", +" Load a particular (outdated) ISO image from a -dev or", +" -indev which hosts more than one session.", +" -displacement [-]block_address", +" When loading ISO tree or reading data files compensate a", +" displacement versus the start address for which the image", +" was prepared.", +" -rom_toc_scan \"on\"|\"force\"|\"off\"[:\"emul_on\"|\"emul_off\"]", +" Enable scanning for ISO sessions on read-only drives/media", +" resp. on overwriteable media with emulated TOC.", +" -calm_drive \"in\"|\"out\"|\"all\"|\"on\"|\"off\"", +" Reduce drive noise until it gets actually used again.", +" -assert_volid pattern severity", +" Accept input image only if its volume id matches pattern.", +" -charset name Set the character set name to be used for file name", +" conversion from and to media.", +" -in_charset name", +" Like -charset but only for conversion from media.", +" -auto_charset \"on\"|\"off\"", +" Enable writing and reading of character set name in image.", +" -out_charset name", +" Like -charset but only for conversion to media.", +" -local_charset name", +" Override system assumption of the local character set name.", +" -hardlinks mode[:mode ...]", +" Enable resp. disable recording and restoring of hard links.", +" Modes are \"on\", \"off\", \"perform_update\",", +" \"without_update\", \"discard_extract\",", +" \"cheap_sorted_extract\", \"normal_extract\"", +" -acl \"on\"|\"off\"", +" Enable resp. disable reading and writing of ACLs.", +" -xattr \"on\"|\"off\"", +" Enable resp. disable reading and writing of xattr.", +" -for_backup", +" Shortcut for: -hardlinks on -acl on -xattr on -md5 on", +" -disk_dev_ino \"on\"|\"ino_only\"|\"off\"", +" Enable resp. disable recording of disk file dev_t and ino_t", +" and their use in file comparison.", +" -md5 \"on\"|\"all\"|\"off\"", +" Enable resp. disable processing of MD5 checksums.", +" -scdbackup_tag list_path record_name", +" Enable production of scdbackup tag with -md5 on", +" -ban_stdio_write", +" Allow for writing only the usage of optical drives.", +" -early_stdio_test \"on\"|\"appendable_wo\"|\"off\"", +" Classify stdio drives by effective access permissions.", +" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"", +" Blank medium resp. invalidate ISO image on medium.", +" -close_damaged \"as_needed\"|\"force\"", +" Close track and session of damaged medium.", +" -format \"as_needed\"|\"full\"|\"fast\"|\"by_index_#\"|\"by_size_#\"", +" Format BD-RE, BD-R, DVD-RAM, DVD-RW, DVD+RW.", +" -volid volume_id", +" Specifies the volume ID text. (32 chars out of [A-Z0-9_])", +" -volset_id name", +" Specifies the volume set id. (128 chars)", +" -publisher name", +" Specifies the publisher name. (128 chars)", +" -application_id name", +" Specifies the application id. (128 chars)", +" -system_id name", +" Specifies the system id for the System Area. (32 chars)", +" -volume_date type timestring", +" Specifies volume timestamps. [\"c\",\"m\",\"x\",\"f\",\"uuid\"]", +" -copyright_file name", +" Specifies the name of the Copyright File. (37 chars)", +" -biblio_file name", +" Specifies the name of the Bibliographic File. (37 chars)", +" -abstract_file name", +" Specifies the name of the Abstract File. (37 chars)", +" -joliet \"on\"|\"off\"", +" Generate Joliet info additional to Rock Ridge info.", +" -jigdo \"clear\"|\"template_path\"|\"jigdo_path\"|\"md5_path\"", +" |\"min_size\"|\"checksum_iso\"|\"checksum_template\"", +" |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"", +" |\"checksum_iso\"|\"checksum_template\"", +" value", +" Clear Jigdo Template Extraction parameter list or add a", +" parameter with its value to that list.", +" -compliance rule[:rule...]", +" Allow more or less harmless deviations from strict standards", +" compliance.", +" -boot_image \"any\"|\"isolinux\"|\"grub\"", +" |\"discard\"|\"keep\"|\"patch\"|\"dir=\"|\"bin_path=\"", +" |\"cat_path=\"|\"cat_hidden=on|iso_rr|joliet|off\"", +" |\"load_size=\"|\"system_area=\"|\"partition_table=on|off\"", +" |\"mips_path=\"|\"mipsel_path=\"|\"mips_discard\"", +" |\"sparc_label=\"|\"sparc_discard\"", +" |\"show_status\"", +" Whether to discard or keep an exiting El Torito boot image.", +" ISOLINUX can be made bootable by dir=/ or dir=/isolinux", +" or dir=/boot/isolinux. Others, like GRUB, by bin_path=...", +" and cat_path=...", +" The boot image and its helper files need to be added to the", +" ISO image by the usual commands like -map or -add.", +" system_area= and partition_table= are for MBR based booting", +" from USB stick. The system_area= file needs not to be added.", +" mips_path= adds Big Endian MIPS boot files. mipsel_path=", +" sets one Little Endian MIPS boot file. sparc_label=", +" activates SUN Disk Label. All three are mutually exclusive", +" and exclusive to MBR production.", +" -append_partition partition_number type_code disk_path", +" Append a prepared filesystem image after the end of the", +" ISO image. Caution: Will be overwritten by multi-session.", +"", +" -uid uid User id to be used for the whole multi-session ISO image.", +" -gid gid Group id for the same purpose.", +"", +" -devices Show list of available optical drives and their addresses.", +" -device_links Like devices, but showing link paths which are hopefully", +" persistent over reboot on modern Linux systems.", +"", +" -toc Show media specific table of content (sessions).", +"", +" -mount_cmd drive entity id path", +" Print to result channel a command suitable to mount the", +" depicted entity (see -load) at the given directory path.", +" -mount_opts \"exclusive\"|\"shared\"", +" Set options for -mount and -mount_cmd.", +" -session_string drive entity id \"linux:\"path|\"freebsd:\"path|form", +" Print foreign OS command or custom line.", +"", +" -list_formats Show media specific list of format descriptors.", +"", +" -list_speeds Show media specific list of write speed descriptors.", +"", +" -list_profiles \"in\"|\"out\"|\"all\"", +" Show list of media types supported by indev resp. outdev.", +" -print_size Print the foreseeable consumption by next -commit.", +"", +" -tell_media_space", +" Print foreseeable available space on output medium", +" -pvd_info Print various id strings of the loaded ISO image." +"", +"Options with variable length path list [...] need the list delimiter text", +"as end mark if they are followed by another option. By default this delimiter", +"is \"--\". In dialog and with options read from files, the line end serves", +"as such a mark. With program arguments this mark can be omitted only with", +"the last option in the list of arguments.", +"For brevity the list delimiter is referred as \"--\" throughout this text.", +"", +" -list_delimiter text Set the list delimiter to be used instead of \"--\"", +" It has to be a single word, must not be empty, not longer", +" than 80 characters, may mot contain quotation marks.", +"", +"Manipulation options:", +"disk_path is a path to an object in the local filesystem tree.", +"iso_rr_path is the Rock Ridge name of a file object in the ISO image.", +"pathspec is either a disk_path or (if allowed) a pair: iso_rr_path=disk_path", +"Options marked by [***] have variable argument length and perform pattern", +"expansion if enabled by -iso_rr_pattern resp. -disk_pattern.", +"", +" -pathspecs \"on\"|\"off\" Allow or disallow pathspecs of form ", +" iso_rr_path=disk_path . Only \"off\" allows eventual", +" -disk_pattern expansion.", +" -add pathspec [...] | disk_path [***]", +" Insert the given files or directory trees from", +" filesystem into the ISO image. Much like mkisofs.", +" -add_plainly \"none\"|\"unknown\"|\"dashed\"|\"any\"", +" Whether to add lonely arguments as pathspec resp. disk_path.", +" -path_list disk_path", +" Like -add but read the pathspecs from file disk_path.", +" -quoted_path_list disk_path", +" Like -path_list but with line rules as -dialog \"on\".", +"", +" -map disk_path iso_rr_path", +" Insert disk file object at the given iso_rr_path.", +" -map_single disk_path iso_rr_path", +" Like -map but with directory do not insert its sub tree.", +" -map_l disk_prefix iso_rr_prefix disk_path [***]", +" Performs -map with each disk_path.", +" -update disk_path iso_rr_path", +" Compare both file objects and do what is necessary to make", +" iso_rr_path a matching copy of disk_path.", +" -update_r disk_path iso_rr_path", +" Like -update but affecting all files below directories.", +" -update_l disk_prefix iso_rr_prefix disk_path [***]", +" Performs -update_r with each disk_path.", +" -cut_out disk_path byte_offset byte_count iso_rr_path", +" Map a byte interval of a regular disk file into a regular", +" file in the ISO image.", +"", +" -cpr disk_path [***] iso_rr_path", +" Insert the given files or directory trees from filesystem", +" into the ISO image, according to the rules of cp -r.", +"", +" -rm iso_rr_path [***]", +" Delete the given files from the ISO image.", +" -rm_r iso_rr_path [***]", +" Delete the given directory trees from ISO image.", +" -mv iso_rr_path [***] iso_rr_path", +" Rename the given file objects in the ISO tree to the last", +" argument in the list.", +" -chown uid iso_rr_path [***]", +" Equivalent to chown in the ISO image.", +" -chown_r uid iso_rr_path [***]", +" Like -chown but affecting all files below directories.", +" -chgrp gid iso_rr_path [***]", +" Equivalent to chgrp in the ISO image.", +" -chgrp_r gid iso_rr_path [***]", +" Like -chgrp but affecting all files below directories.", +" -chmod mode iso_rr_path [***]", +" Equivalent to chmod in the ISO image.", +" -chmod_r mode iso_rr_path [***]", +" Like -chmod but affecting all files below directories.", +" -setfacl acl_text iso_rr_path [***]", +" Replace the permissions and eventual ACL of the given files", +" in the ISO image by the ACL which is defined by acl_text.", +" -setfacl_r acl_text iso_rr_path [***]", +" Like -setfacl but affecting all files below directories.", +" -setfacl_list disk_path", +" Read output of getfacl from file disk_path. Set owner,", +" group and ACL of the iso_rr_path given by line \"# file:\".", +" -setfattr [-]name value iso_rr_path [***]", +" Set xattr pair with the given name to the given value, or", +" delete pair if name is prefixed with \"-\" and value is", +" an empty text.", +" -setfattr_r [-]name value iso_rr_path [***]", +" Like -setfattr but affecting all files below directories.", +" -setfattr_list disk_path", +" Read output of getfattr from file disk_path. Replace the", +" xattr of the iso_rr_path given by line \"# file:\".", +" -alter_date type timestring iso_rr_path [***]", +" Alter the date entries of a file in the ISO image. type is", +" one of \"a\", \"m\", \"b\" for:", +" access time, modification time, both times.", +" -alter_date_r type timestring iso_rr_path [***]", +" Like -alter_date but affecting all files below directories.", +" -hide on|iso_rr|joliet|off iso_rr_path [***]", +" Keep names of files out of directory tree, but store their", +" data content in the image.", +" -find iso_rr_path [test [op] [test ...]] [-exec action [params]]", +" performs an action on files below the given directory in", +" the ISO image. Tests:", +" -name pattern, -wholename pattern, -disk_name pattern,", +" -type b|c|d|p|f|l|s|e, -pending_data, -hidden,", +" -lba_range start count, -damaged, -has_acl, -has_xattr,", +" -has_aaip, -has_filter, -has_md5, -has_any_xattr,", +" -prune, -decision yes|no, -true, -false", +" Operators: -not, -or, -and, -sub, (, -subend, ),", +" -if, -then, -elseif, -else, -endif", +" Action may be one of: echo, chown, chown_r, chgrp, chgrp_r", +" chmod, chmod_r, alter_date, alter_date_r, lsdl, compare,", +" rm, rm_r, compare, update, report_damage, report_lba,", +" getfacl, setfacl, getfattr, setfattr, get_any_xattr,", +" list_extattr, get_md5, check_md5, make_md5,", +" set_filter, show_stream, mkisofs_r, hide, find.", +" params are their arguments except iso_rr_path.", +" -mkdir iso_rr_path [...]", +" Create empty directories if they do not exist yet.", +" -rmdir iso_rr_path [***]", +" Delete empty directories.", +" -clone iso_rr_path_original iso_rr_path_copy", +" Create an ISO copy of an ISO file or ISO directory tree.", +" -cp_clone iso_rr_path_original [***] iso_rr_path_dest", +" Create ISO to ISO copies according to the rules of cp -r.", +"", +" -- Default list delimiter marking the end of action argument", +" list. It may be changed by option -list_delimiter.", +"", +" -not_paths disk_path [***]", +" Add the given paths to the list of excluded absolute paths.", +" -not_leaf pattern", +" Add the given pattern to the list of leafname exclusions.", +" -not_list disk_path", +" Read lines from disk_path and use as -not_paths (with \"/\")", +" or as -not_leaf (without \"/\").", +" -quoted_not_list disk_path", +" Like -not_list but with line rules as -dialog \"on\".", +" -not_mgt \"reset\"|\"on\"|\"off\"|\"param_on\"|\"subtree_on\"|\"ignore_on\"", +" Control effect of exclusion lists.", +" -follow \"on\"|\"pattern:param:link:mount:limit=#\"|\"default\"|\"off\"", +" Follow symbolic links and mount points within disk_path.", +" -overwrite \"on\"|\"nondir\"|\"off\"", +" Allow or disallow to overwrite existing files in ISO image.", +" -split_size number[\"k\"|\"m\"]", +" Set the threshold for automatic splitting of regular files.", +" -reassure \"on\"|\"tree\"|\"off\"", +" If \"on\" then ask the user for \"y\" or \"n\" with any", +" file before deleting or overwriting it in the ISO image.", +"", +"Filter options:", +"External filter processes may produce synthetic file content by reading the", +"original content from stdin and writing to stdout whatever they want.", + +#ifdef Xorriso_allow_external_filterS + +" -external_filter name option[:option] program_path [arguments] --", +" Define an external filter. Options are: suffix=...: ", +" remove_suffix:if_nonempty:if_reduction:if_block_reduction.", +" -unregister_filter name", +" Undefine an external filter.", +" -close_filter_list", +" Irrevocably ban -external_filter and -unregister_filter.", + +#else + +"Sorry: The use of external filters was not enabled at compile time.", +" E.g. by ./configure option --enable-external-filters", + +#endif /* ! Xorriso_allow_external_filterS */ + +" -set_filter name iso_rr_path [***]", +" Apply a defined filter to the given data files.", +" Special name \"--remove-all-filters\" revokes filtering.", +" Builtin filters are --gzip , --gunzip, --zisofs .", +" -set_filter_r name iso_rr_path [***]", +" Like -set_filter but affecting all files below directories.", +"", +"zisofs is a compression format which is recognized by some Linux kernels.", +"xorriso supports it by builtin filter \"--zisofs\" which is to be applied by", +"the user, and by \"--zisofs-decode\" which is applied automatically when", +"compressed content is detected with a file in the ISO image.", +" -zisofs option[:options]", +" Set global zisofs parameters:", +" level=0|...|9 , block_size=32k|64k|128k , by_magic=on|off", +"", +"Write-to-media options:", +" -rollback Discard the manipulated ISO image and reload it.", +"", +" -commit Perform the write operation and then perform -dev outdrive.", +" Hint: To perform a final write operation with no new -dev", +" and no new loading of image, execute option -end.", +" -commit_eject \"in\"|\"out\"|\"all\"|\"none\"", +" Like -commit but rather eject than load image from outdrive.", +" Give up any unejected drive afterwards.", +" -close \"on\"|\"off\"", +" If \"on\" then mark the written medium as not appendable.", +" -padding number[\"k\"|\"m\"]|\"included\"|\"appended\"", +" Append extra bytes to image stream. (Default is 300k)", +" -dummy \"on\"|\"off\"", +" If \"on\" simulate burning. Refuse if medium cannot simulate.", +" -speed number[\"k/s\"|\"m/s\"|\"[x]CD\"|\"[x]DVD\"|\"[x]BD\"]", +" Set the burn speed. Default is 0 = maximum speed.", +" -stream_recording \"on\"|\"off\"", +" Try to circumvent slow checkread on DVD-RAM, BD-RE, BD-R.", +" -dvd_obs \"default\"|\"32k\"|\"64k\"", +" Set number of bytes per DVD/BD write operation.", +" -stdio_sync \"on\"|\"off\"|number", +" Set number of bytes after which to force output to stdio", +" pseudo drives. \"on\" is the same as 16m.", +" -fs number[\"k\"|\"m\"]", +" Set the size of the fifo buffer. (Default is 4m)", +" -eject \"in\"|\"out\"|\"all\"", +" Immediately eject the medium in -indev, resp. -outdev,", +" resp. both.", +"", +"Navigation options:", +"", +" -cd iso_rr_path Change working directory in the ISO image. iso_rr_paths", +" which do not begin with '/' will be inserted beginning at", +" the path given with -cd. -ls patterns will eventually", +" looked up at this path.", +" -cdi disk_path Same as -cd disk_path", +" -cdx disk_path Change the current working directory in the local", +" filesystem. disk_paths which do not begin with '/'", +" will be looked up beginning at the path given with -cdx.", +" -lsx patterns will eventually be looked up at this path.", +" -pwd tells the current working directory in the ISO image.", +" -pwdi same as -pwd.", +" -pwdx tells the current working directory in the local filesystem.", +"", +" -iso_rr_pattern \"on\"|\"ls\"|\"off\"", +" Enable or disable pattern expansions for ISO image commands", +" marked by [***]. \"ls\" restricts it to -ls and -du.", +" -disk_pattern \"on\"|\"ls\"|\"off\"", +" Enable or disable pattern expansions for local filesystem", +" commands marked by [***]. \"ls\" restricts to -ls*x and -du*x.", +"", +" -ls pattern [***] lists files of the ISO image which match one of the", +" given shell parser patterns. (I.e. wildcards '*' '?').", +" Directories are listed by their content.", +" -lsd pattern [***] like -ls but listing directories as single items.", +" -lsl pattern [***] like -ls but also telling some file attributes.", +" -lsdl pattern [***] like -lsd but also telling some file attributes.", +"", +" -lsx pattern [***] lists files of the local filesystem which match one", +" of the patterns. Directories are listed by their content.", +" -lsdx pattern [***] like -lsx but listing directories as single items.", +" -lslx pattern [***] like -lsx but also telling some file attributes.", +" -lsdlx pattern [***] like -lsdx but also telling some file attributes.", +" -getfacl pattern [***] list eventual ACLs of the given files.", +" -getfacl_r pattern [***] like -getfacl but listing whole file trees.", +" -getfattr pattern [***] list eventual xattr of the given files.", +" -getfxattr_r pattern [***] like -getfxattr but listing whole file trees.", +"", +" -du pattern [***] recursively lists sizes of files or directories in the", +" ISO image which match one of the shell parser patterns.", +" -dux pattern [***] recursively lists sizes of files or directories in the", +" local filesystem which match one of the shell parser", +" patterns.", +" -dus pattern [***] like -du but summing up subdirectories without", +" listing them explicitely.", +" -dusx pattern [***] like -dux but summing up subdirectories without", +" listing them explicitely.", +"", +" -findx disk_path [-name pattern] [-type t] [-exec action [params]]", +" Like -find but operating on local filesystem. Most -exec", +" actions are defaulted to action echo. Supported actions are:", +" in_iso, not_in_iso, is_full_in_iso, add_missing,", +" empty_iso_dir", +"", +" -compare disk_path iso_rr_path", +" compare attributes and in case of regular data files the", +" content of filesystem object and ISO object.", +" -compare_r disk_path iso_rr_path", +" Like -compare but affecting all files below directories.", +" -compare_l disk_prefix iso_rr_prefix disk_path [***]", +" Performs -compare_r with each disk_path.", +"", +" -show_stream iso_rr_path [***]", +" Show content stream chain of data files in the ISO image.", +" -show_stream_r iso_rr_path [***]", +" Like -show_stream but affecting all files below directories.", +"", +"Restore options which copy file objects from ISO image to disk filesystem:", +" -osirrox \"on\"|\"device_files\"|\"off\"|\"banned\"", +" [:\"concat_split_on\"|\"concat_split_off\"]", +" [:\"auto_chmod_on\"|\"auto_chmod_off\"]", +" [:\"sort_lba_on\"|\"sort_lba_off\"]", +" [:\"strict_acl_on\"|\"strict_acl_off\"]", +" By default \"off\" the inverse operation of xorriso from ISO", +" image to disk filesystem is disabled. \"on\" allows xorriso", +" to create, overwrite, delete files in the disk filesystem.", +" \"banned\" is irrevocably \"off\".", +" -extract iso_rr_path disk_path", +" Copy tree under iso_rr_path onto disk address disk_path.", +" This avoids the pitfalls of cp -r addressing rules.", +" -extract_l iso_rr_prefix disk_prefix iso_rr_path [***]", +" Perform -extract with each iso_rr_path.", +" -extract_single iso_rr_path disk_path", +" Like -extract but with directory do not restore sub tree.", +" -extract_cut iso_rr_path byte_offset byte_count disk_path", +" Copy a byte interval from iso_rr_path to disk_path.", +" This is governed in part by -check_media_defaults.", +" -cpx iso_rr_path [***] disk_path", +" Copy leaf file objects from ISO image to disk filesystem.", +" -cpax iso_rr_path [***] disk_path", +" Like -cpx but trying to restore timestamps and ownership.", +" -cp_rx iso_rr_path [***] disk_path", +" Copy directory trees from ISO image to disk filesystem.", +" -cp_rax iso_rr_path [***] disk_path", +" Like -cp_rx but trying to restore timestamps and ownership.", +" -paste_in iso_rr_path disk_path byte_offset byte_count", +" Copy ISO file content into a byte interval of a disk file.", +" -mount drive entity id path", +" Like -mount_cmd but actually performing that command if", +" not setuid or setgid is active.", +"", +"Evaluation of readability:", +" -check_media [options] --", +" Try to read data blocks from the medium and report about the", +" outcome. Several options modify the behavior:", +" use=indev|outdev , what=track|session ,", +" min_lba=blockadr , max_lba=blockadr ,", +" abort_file=path , time_limit=seconds , item_limit=number ,", +" retry=on|off|default , data_to=filepath ,", +" sector_map=filepath , map_with_volid=on|off ,", +" patch_lba0=on|off|force|blockadr[:force] ,", +" report=blocks|files|blocks_files event=severity ,", +" bad_limit=quality , slow_limit=seconds , chunk_size=bytes", +" -check_media_defaults [options] --", +" Preset options for runs of -check_media and -extract_cut.", +"", +"Compatibility emulation (argument list may be ended by list delimiter --):", +" -as mkisofs [-help|-version|-o|-R|-r|-J|-V|-P|-f|-m|-exclude-list|", +" -no-pad|-M|-C|-graft-points|-path-list|pathspecs|-z|", +" -no-emul-boot|-b|-c|-boot-info-table|-boot-load-size|-G|...]", +" Perform some mkisofs gestures, understand pathspecs as mkisofs", +" does. Commit happens outside emulation at usual occasions.", +" For a list of options see -as mkisofs -help.", +" -read_mkisofsrc", +" Read and interpret the .mkisofsrc configuration file.", +" -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|-multi]", +" path|-", +" Perform some cdrecord gestures, eventually write at most one", +" data track to blank, appendable or overwriteable media.", +" -pacifier \"xorriso\"|\"cdrecord\"|\"mkisofs\"", +" Choose format of UPDATE pacifier during write operations.", +"", +"General options:", +" -help Print this text", +" -abort_on severity Set the threshhold for events to abort the program.", +" Useful severities: NEVER, ABORT, FATAL, FAILURE, SORRY, WARNING", +" -return_with severity exit_value Set the threshhold for events to return", +" at program end the given exit_value even if not aborted.", +" exit_value may be 0 or 32 to 63.", +" -report_about severity Set the threshhold for events to be reported.", +" Use -abort_on severities or: HINT, NOTE, UPDATE, DEBUG, ALL", +" -signal_handling \"on\"|\"off\"|\"sig_dfl\"|\"sig_ign\"", +" Handling of signals. Default \"on\" uses libburn handler.", +" -error_behavior \"image_loading\"|\"file_extraction\" behavior", +" Behavior \"best_effort\" is most endurant but may produce", +" results which are correct only on the first glimpse.", +" -dialog \"on\"|\"off\"|\"single_line\"", +" After all arguments are processed, enter dialog mode.", +" \"single_line\" does not support newline characters within", +" open quotation marks and no line continuation by trailing \\.", +" -page len width Prompt user after len output lines (0=no prompt).", +" width (default 80) can adjust line number computation", +" to the output terminal's line width.", +#ifdef Xorriso_with_readlinE +" -use_stdin Use raw standard input even if libreadline is available", +" -use_readline Use libreadline for dialog if available", +" -history text Copy text into libreadline history. This command", +" itself is not copied to the history list.", +#endif /* Xorriso_with_readlinE */ +" -backslash_codes \"on\"|\"off\"|", +" \"in_double_quotes\"|\"in_quotes\"|\"with_quoted_input\"", +" [:\"with_program_arguments\"][:\"encode_output\"]", +" Disable or enable interpretation of \\a \\b \\e \\f \\n \\r \\t \\v", +" \\\\ \\NNN \\xNN \\cC in input or program arguments.", +" -pkt_output \"on\"|\"off\" Direct output to stdout and prefix each line", +" by a short header which tells channel id and a mode number.", +" Each such output packet is finalized by a newline.", +" Channel ids are 'R:' for result lines, 'I:' for notes", +" and error messages, 'M:' for -mark texts. Bit 0 of the", +" mode number tells whether the newline is also part of the", +" packet payload. Example of a info message with newline:", +" I:1: enter option text :", +" -pkt_output:on is intended for use by frontend programs.", +" -logfile channel fileaddress Copy output of a channel to the given file.", +" channel may be 'R','I','M' as with -pkt_output or '.'", +" for the consolidated -pkt_output stream.", +" -mark text If text is not empty it will get put out each time an", +" option is completed.", +" -temp_mem_limit number[\"k\"|\"m\"]", +" Set the maximum size for pattern expansion. (Default is 16m)", +" -prog text Use text as this program's name in subsequent messages", +" -prog_help text Use text as this program's name and perform -help", +" -status mode|filter Report the current settings of persistent options.", +" Modes:", +" short... print only important or altered options", +" long ... print options even if they have default settings", +" long_history like long plus -history: lines", +" Filters begin with '-' and are compared literally against the", +" output lines of -status long_history. A line is put out only", +" if its start matches the filter.", +" -status_history_max number Maximum number of history lines to be reported", +" with -status:long_history", +" -options_from_file fileaddress", +" Reads lines from the given file and executes them as program", +" options.", +" -no_rc Only if used as first command line argument this option", +" prevents reading and interpretation of startup files.", +" -print text", +" Print a text to result channel.", +" -print_info text", +" Print a text to info channel.", +" -print_mark text", +" Print a text to mark channel.", +" -prompt text", +" Wait for Enter key resp. for a line of input at stdin.", +" -sleep number", +" Do nothing during the given number of seconds.", +" -errfile_log mode path|channel", +" Log disk paths of files involved in problem events.", +" -session_log path", +" Set path of a file where a log record gets appended after", +" each session. Form: timestamp start_lba size volume-id", +" -scsi_log \"on\"|\"off\"", +" Enable or disable logging of SCSI commands to stderr.", +" # any text Is ignored. In dialog mode the input line will be stored in", +" the eventual readline history, nevertheless.", +" -list_extras code", +" Tell whether certain extra features were enabled at compile", +" time. Code \"all\" lists all features and a headline. Other", +" codes pick a single feature. \"codes\" lists the known codes.", +" -version Tell program and version number", +" -end End program. Commit eventual pending changes.", +" -rollback_end", +" End program. Discard pending changes.", +"", +"", +"Option -page causes a user prompt after the given number of result lines.", +"Empty input resumes output until the next prompt. Other input may be:", +" @ suppresses paging until the current action is done", +" @@ suppresses further result output but continues the action", +" @@@ aborts the current action", +" other aborts the current action and executes input as new", +" option", +"", + +#endif /* ! Xorriso_no_helP */ + +"@ENDE_OF_HELPTEXT_(HOPEFULLY_UNIQUELY_SILLY_TEXT)@" + }; + + char *tpt= NULL; + int i,pass; + + Xorriso_restxt(xorriso,"\n"); + sprintf(xorriso->result_line,"usage: %s [settings|actions]\n", + xorriso->progname); + Xorriso_result(xorriso,0); + Xorriso_restxt(xorriso,"\n"); + for(pass=0;pass<1;pass++) { + for(i=0;1;i++) { + if(pass==0) + tpt= text[i]; + + if(strcmp(tpt,"@ENDE_OF_HELPTEXT_(HOPEFULLY_UNIQUELY_SILLY_TEXT)@")==0) + break; + sprintf(xorriso->result_line,"%s\n",tpt); + Xorriso_result(xorriso,0); + if(xorriso->request_to_abort) + return(1); + } + } + Xorriso_restxt(xorriso,"\n"); + return(1); +} + + +/* Option -hide */ +int Xorriso_option_hide(struct XorrisO *xorriso, char *hide_state, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, end_idx, optc= 0, was_failure= 0, fret, hide_mode; + char **optv= NULL; + + ret= Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc, + &optv, 0); + if(ret<=0) + goto ex; + hide_mode= Xorriso__hide_mode(hide_state, 0); + if(hide_mode < 0) { + sprintf(xorriso->info_text, "-hide : unknown hide state "); + Text_shellsafe(hide_state, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + for(i= 0; i<optc; i++) { + ret= Xorriso_set_hidden(xorriso, NULL, optv[i], hide_mode, 0); + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc, &optv, + 256); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -history */ +int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag) +{ + Xorriso_dialog_input(xorriso,line,strlen(line)+1,2); + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/opts_i_o.c b/libisoburn/branches/1.1.8/xorriso/opts_i_o.c new file mode 100644 index 00000000..f3ece124 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/opts_i_o.c @@ -0,0 +1,1321 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of options as mentioned in man page + or info file derived from xorriso.texi. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* Option -iso_rr_pattern "on"|"ls"|"off" */ +int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode,int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->do_iso_rr_pattern= 0; + else if(strcmp(mode, "on")==0) + xorriso->do_iso_rr_pattern= 1; + else if(strcmp(mode, "ls")==0) + xorriso->do_iso_rr_pattern= 2; + else { + sprintf(xorriso->info_text, "-iso_rr_pattern: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -jigdo aspect argument */ +int Xorriso_option_jigdo(struct XorrisO *xorriso, char *aspect, char *arg, + int flag) +{ + int ret; + + ret= Xorriso_jigdo_interpreter(xorriso, aspect, arg, 0); + return(ret); +} + + +/* Option -joliet "on"|"off" */ +int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->do_joliet= 0; + else if(strcmp(mode, "on")==0) + xorriso->do_joliet= 1; + else { + sprintf(xorriso->info_text, "-joliet: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -list_delimiter */ +int Xorriso_option_list_delimiter(struct XorrisO *xorriso, char *text, + int flag) +{ + int ret, argc; + char **argv= NULL; + + if(text[0] == 0) { + sprintf(xorriso->info_text, + "-list_delimiter: New delimiter text is empty"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(strlen(text) > 80) { + sprintf(xorriso->info_text, + "-list_delimiter: New delimiter text is too long"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Sfile_make_argv(xorriso->progname, text, &argc, &argv, 4); + if(ret > 0) { + if(argc > 2) { + sprintf(xorriso->info_text, + "-list_delimiter: New delimiter text contains more than one word"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + Sfile_make_argv(xorriso->progname, text, &argc, &argv, 2); + if(argc > 2) + return(0); + } + if(strchr(text, '"') != NULL || strchr(text, '\'') != NULL) { + sprintf(xorriso->info_text, + "-list_delimiter: New delimiter text contains quotation marks"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + strcpy(xorriso->list_delimiter, text); + return(1); +} + + +/* Option -list_extras */ +int Xorriso_option_list_extras(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret; + + ret= Xorriso_list_extras(xorriso, mode, 0); + return(ret); +} + + +/* Option -list_formats */ +int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag) +{ + int ret; + + ret= Xorriso_list_formats(xorriso, 0); + return(ret); +} + + +/* Option -list_speeds */ +int Xorriso_option_list_speeds(struct XorrisO *xorriso, int flag) +{ + int ret; + + ret= Xorriso_list_speeds(xorriso, 0); + return(ret); +} + + +/* Option -list_profiles */ +int Xorriso_option_list_profiles(struct XorrisO *xorriso, char *which, + int flag) +{ + int ret; + int mode= 0; + + if(strncmp(which,"in",2)==0) + mode|= 1; + else if(strncmp(which,"out",3)==0) + mode|= 2; + else + mode|= 3; + if(mode & 1) { + ret= Xorriso_toc(xorriso, 1 | 16 | 32); + if(ret > 0) + Xorriso_list_profiles(xorriso, 0); + } + if((mode & 2) && xorriso->in_drive_handle != xorriso->out_drive_handle) { + ret= Xorriso_toc(xorriso, 1 | 2 | 16 | 32); + if(ret > 0) + Xorriso_list_profiles(xorriso, 2); + } + return(1); +} + + +/* Option -load session|track|sbsector value */ +/* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_load(struct XorrisO *xorriso, char *adr_mode, + char *adr_value, int flag) +{ + int ret; + + if(xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "-load: Image changes pending. -commit or -rollback first"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_reassure(xorriso, "-load", "loads an alternative image", 0); + if(ret<=0) + return(2); + ret= Xorriso_decode_load_adr(xorriso, "-load", adr_mode, adr_value, + &(xorriso->image_start_mode), + xorriso->image_start_value, flag & 1); + if(ret <= 0) + return(ret); + xorriso->image_start_mode|= (1<<30); /* enable non-default msc1 processing */ + if(strlen(xorriso->indev)>0) { + ret= Xorriso_option_rollback(xorriso, 1); /* Load image, no -reassure */ + if(ret<=0) + return(ret); + } + return(1); +} + + +/* Option -logfile */ +int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel, + char *fileadr, int flag) +{ + int hflag,channel_no= 0, ret; + + if(channel[0]==0) { +logfile_wrong_form:; + sprintf(xorriso->info_text,"Wrong form. Correct would be: -logfile \".\"|\"R\"|\"I\"|\"M\" file_address"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + hflag= 2; + if(channel[0]=='R') + channel_no= 1; + else if(channel[0]=='I') + channel_no= 2; + else if(channel[0]=='M') + channel_no= 3; + else if(channel[0]=='.') + hflag= 4; + else + goto logfile_wrong_form; + if(strcmp(fileadr,"-")==0 || fileadr[0]==0) + hflag|= (1<<15); + xorriso->logfile[channel_no][0]= 0; + ret= Xorriso_write_to_channel(xorriso, fileadr, channel_no, hflag); + if(ret<=0) { + sprintf(xorriso->info_text, "Cannot open logfile: %s", fileadr); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + } else if(!(hflag&(1<<15))) + if(Sfile_str(xorriso->logfile[channel_no], fileadr, 0)<=0) + return(-1); + return(ret>0); +} + + +/* Options -ls alias -lsi and -lsl alias -lsli + and -lsd alias -lsdi and -lsdl alias -lsdli + and -du alias -dui and -dus alias -dusi + @param flag bit0= long format (-lsl , -du) + bit1= do not expand patterns but use literally + bit2= du rather than ls + bit3= list directories as themselves (ls -d) +*/ +int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int ret, end_idx, filec= 0, nump, i; + char **filev= NULL, **patterns= NULL; + off_t mem= 0; + struct stat stbuf; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + if(xorriso->do_iso_rr_pattern==0) + flag|= 2; + + nump= end_idx - *idx; + if((flag&2) && nump>0 ) { + ; + } else if(nump <= 0) { + if(Xorriso_iso_lstat(xorriso, xorriso->wdi, &stbuf, 0)<0) { + sprintf(xorriso->info_text, + "Current -cd path does not yet exist in the ISO image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + if(!S_ISDIR(stbuf.st_mode)) { + sprintf(xorriso->info_text, + "Current -cd meanwhile points to a non-directory in ISO image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + patterns= calloc(1, sizeof(char *)); + if(patterns == NULL) { +no_memory:; + sprintf(xorriso->info_text, + "Cannot allocate enough memory for pattern expansion"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + nump= 1; + if(flag&8) + patterns[0]= "."; + else + patterns[0]= "*"; + flag&= ~2; + } else { + patterns= calloc(nump, sizeof(char *)); + if(patterns==NULL) + goto no_memory; + for(i= 0; i<nump; i++) { + if(argv[i + *idx][0]==0) + patterns[i]= "*"; + else + patterns[i]= argv[i + *idx]; + } + } + + if((flag & 1) && !(xorriso->ino_behavior & 1)) { + ret= Xorriso_make_hln_array(xorriso, 0); /* for stbuf.st_nlink */ + if(ret < 0) + return(ret); + } + if(flag&2) { + ret= Xorriso_ls_filev(xorriso, xorriso->wdi, nump, argv + (*idx), mem, + flag&(1|4|8)); + } else if(nump==1 && strcmp(patterns[0],"*")==0 && !(flag&4)){ + /* save temporary memory by calling simpler function */ + ret= Xorriso_ls(xorriso, (flag&1)|4); + } else { + ret= Xorriso_expand_pattern(xorriso, nump, patterns, 0, &filec, &filev, + &mem, 0); + if(ret<=0) + {ret= 0; goto ex;} + ret= Xorriso_ls_filev(xorriso, xorriso->wdi, filec, filev, mem, + flag&(1|4|8)); + } + if(ret<=0) + {ret= 0; goto ex;} + + ret= 1; +ex:; + if(patterns!=NULL) + free((char *) patterns); + Sfile_destroy_argv(&filec, &filev, 0); + (*idx)= end_idx; + return(ret); +} + + +/* Options -lsx, -lslx, -lsdx , -lsdlx , -dux , -dusx + @param flag bit0= long format (-lslx , -dux) + bit1= do not expand patterns but use literally + bit2= du rather than ls + bit3= list directories as themselves (ls -d) +*/ +int Xorriso_option_lsx(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int ret, end_idx, filec= 0, nump, i; + char **filev= NULL, **patterns= NULL; + off_t mem= 0; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1|2); + if(xorriso->do_disk_pattern==0) + flag|= 2; + + nump= end_idx - *idx; + if((flag&2) && nump>0) { + ; + } else if(nump <= 0) { + patterns= calloc(1, sizeof(char *)); + if(patterns == NULL) { +no_memory:; + sprintf(xorriso->info_text, + "Cannot allocate enough memory for pattern expansion"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + nump= 1; + if(flag&8) + patterns[0]= "."; + else + patterns[0]= "*"; + flag&= ~2; + } else { + patterns= calloc(nump, sizeof(char *)); + if(patterns==NULL) + goto no_memory; + for(i= 0; i<nump; i++) { + if(argv[i + *idx][0]==0) + patterns[i]= "*"; + else + patterns[i]= argv[i + *idx]; + } + } + if(flag&2) { + ret= Xorriso_lsx_filev(xorriso, xorriso->wdx, + nump, argv + (*idx), mem, flag&(1|4|8)); + +#ifdef Not_yeT + } else if(nump==1 && strcmp(patterns[0],"*")==0 && !(flag&4)){ + /* save temporary memory by calling simpler function */ + ret= Xorriso_ls(xorriso, (flag&1)|4); +#endif + + } else { + ret= Xorriso_expand_disk_pattern(xorriso, nump, patterns, 0, &filec, &filev, + &mem, 0); + if(ret<=0) + {ret= 0; goto ex;} + ret= Xorriso_lsx_filev(xorriso, xorriso->wdx, filec, filev, mem, + flag&(1|4|8)); + } + if(ret<=0) + {ret= 0; goto ex;} + + ret= 1; +ex:; + if(patterns!=NULL) + free((char *) patterns); + Sfile_destroy_argv(&filec, &filev, 0); + (*idx)= end_idx; + return(ret); +} + + +/* Option -map , -map_single */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message + bit5=eventually do not insert directory tree +*/ +int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag) +{ + int ret; + char *eff_origin= NULL, *eff_dest= NULL, *ipth; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + + if(!(flag&2)) + Xorriso_pacifier_reset(xorriso, 0); + + ipth= iso_path; + if(ipth[0]==0) + ipth= disk_path; + if(disk_path[0]==0) { + sprintf(xorriso->info_text, "-map: Empty disk_path given"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + {ret= 0; goto ex;} + } + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin, + 2|4); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2); + if(ret<=0) + goto ex; + ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest, + (off_t) 0, (off_t) 0, 2|(flag&32)); + if(!(flag&2)) + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + if(ret<=0) + goto ex; + + if(!(flag&1)) { + sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", + (ret>1 ? "directory" : "file"), (eff_dest[0] ? eff_dest : "/"), + eff_origin); + Xorriso_info(xorriso,0); + } + ret= 1; +ex:; + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + return(ret); +} + + +/* Options -map_l , -compare_l , -update_l , -extract_l */ +/* @param flag bit4= do not establish and dispose xorriso->di_array + for update_l + bit8-11= mode 0= -map_l + 1= -compare_l + 2= -update_l + 3= -extract_l +*/ +int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int ret, end_idx, optc= 0, was_failure= 1, i, fret, mode, problem_count; + int ns_flag= 2|4, nt_flag= 2, opt_args_flag= 2; + char *source_prefix= NULL, *target_prefix= NULL, *cmd, **optv= NULL; + char *eff_source= NULL, *eff_target= NULL, *source_pt, *s_wd, *t_wd; + char **eff_src_array= NULL, **eff_tgt_array= NULL; + + cmd= "-map_l"; + s_wd= xorriso->wdx; + t_wd= xorriso->wdi; + Xorriso_pacifier_reset(xorriso, 0); + mode= (flag>>8) & 15; + + if(mode==1) + cmd= "-compare_l"; + else if(mode==2) + cmd= "-update_l"; + else if(mode==3) { + cmd= "-extract_l"; + ns_flag= 2; + s_wd= xorriso->wdi; + nt_flag= 2|4; + t_wd= xorriso->wdx; + opt_args_flag= 0; + } + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1|2); + if(end_idx - (*idx) < 3) { + sprintf(xorriso->info_text, "%s: Not enough arguments given (%d < 3)", cmd, + end_idx - (*idx)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); + ret= 0; goto ex; + } + + Xorriso_alloc_meM(source_prefix, char, SfileadrL); + Xorriso_alloc_meM(target_prefix, char, SfileadrL); + Xorriso_alloc_meM(eff_source, char, SfileadrL); + Xorriso_alloc_meM(eff_target, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, s_wd, argv[*idx], + source_prefix, ns_flag | 64); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, t_wd, argv[(*idx)+1], + target_prefix, nt_flag); + if(ret<=0) + goto ex; + ret= Xorriso_opt_args(xorriso, cmd, argc, argv, (*idx)+2, &end_idx, + &optc, &optv, opt_args_flag); + if(ret<=0) + goto ex; + + + if(mode == 3 && + (xorriso->do_restore_sort_lba || !(xorriso->ino_behavior & 4))) { + eff_src_array= calloc(optc, sizeof(char *)); + eff_tgt_array= calloc(optc, sizeof(char *)); + if(eff_src_array == NULL || eff_tgt_array == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + for(i= 0; i < optc; i++) + eff_src_array[i]= eff_tgt_array[i]= NULL; + } + if(mode == 2 && !((xorriso->ino_behavior & 2) || (flag & 16) || + xorriso->di_array != NULL)) { + /* Create all-image node array sorted by isofs.di */ + ret= Xorriso_make_di_array(xorriso, 0); + if(ret <= 0) + goto ex; + } + + for(i= 0; i<optc; i++) { + ret= Xorriso_normalize_img_path(xorriso, s_wd, optv[i], + eff_source, ns_flag); + if(ret<=0) + goto ex; + strcpy(eff_target, target_prefix); + source_pt= eff_source; + if(source_prefix[0]) { + if(strncmp(source_prefix, eff_source, strlen(source_prefix))!=0) { + sprintf(xorriso->info_text, "%s: disk_path ", cmd); + Text_shellsafe(eff_source, xorriso->info_text, 1); + strcat(xorriso->info_text, " does not begin with disk_prefix "); + Text_shellsafe(source_prefix, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); + ret= 0; goto ex; + } + source_pt+= strlen(source_prefix); + } + strcat(eff_target, source_pt); + + if(mode==0) + ret= Xorriso_option_map(xorriso, eff_source, eff_target, 2); + else if(mode==1) + ret= Xorriso_option_compare(xorriso, eff_source, eff_target, 2|8); + else if(mode==2) + ret= Xorriso_option_update(xorriso, eff_source, eff_target, 2 | 8 | 16); + else if(mode==3) { + if(eff_src_array != NULL) { + eff_src_array[i]= strdup(eff_source); + eff_tgt_array[i]= strdup(eff_target); + if(eff_src_array[i] == NULL || eff_tgt_array[i] == NULL) { + Xorriso_no_malloc_memory(xorriso, &(eff_src_array[i]), 0); + ret= -1; goto ex; + } + } else { + ret= Xorriso_option_extract(xorriso, eff_source, eff_target, 2 | 4); + } + } + + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(fret>=0) + continue; + goto ex; + } + + ret= 1; + if(mode == 3 && eff_src_array != NULL) { + ret= Xorriso_lst_append_binary(&(xorriso->node_disk_prefixes), + target_prefix, strlen(target_prefix) + 1, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_lst_append_binary(&(xorriso->node_img_prefixes), + source_prefix, strlen(source_prefix) + 1, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, + &problem_count, 0); + if(ret <= 0 || problem_count > 0) + was_failure= 1; + } + if(mode==0) + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + else if(mode==1 || mode==2) + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 1); + else if(mode==3) + Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count, + xorriso->pacifier_total, "", 1|4); +ex:; + Xorriso_destroy_node_array(xorriso, 0); + i= optc; + Sfile_destroy_argv(&i, &eff_src_array, 0); + i= optc; + Sfile_destroy_argv(&i, &eff_tgt_array, 0); + Xorriso_free_meM(source_prefix); + Xorriso_free_meM(target_prefix); + Xorriso_free_meM(eff_source); + Xorriso_free_meM(eff_target); + (*idx)= end_idx; + Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv, 256); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -mark */ +int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag) +{ + if(mark[0]==0) + xorriso->mark_text[0]= 0; + else + strncpy(xorriso->mark_text,mark,sizeof(xorriso->mark_text)-1); + xorriso->mark_text[sizeof(xorriso->mark_text)-1]= 0; + return(1); +} + + +/* Option -md5 "on"|"all"|"off" */ +int Xorriso_option_md5(struct XorrisO *xorriso, char *mode, int flag) +{ + char *npt, *cpt; + int l; + + npt= cpt= mode; + for(; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l == 0) + continue; + if(l == 3 && strncmp(cpt, "off", l) == 0) + xorriso->do_md5&= ~31; + else if(l == 2 && strncmp(cpt, "on", l) == 0) + xorriso->do_md5= (xorriso->do_md5 & ~31) | 7 | 16; + else if(l == 3 && strncmp(cpt, "all", l) == 0) + xorriso->do_md5|= 31; + else if(l == 18 && strncmp(cpt, "stability_check_on", l) == 0) + xorriso->do_md5|= 8; + else if(l == 19 && strncmp(cpt, "stability_check_off", l) == 0) + xorriso->do_md5&= ~8; + else if(l == 13 && strncmp(cpt, "load_check_on", l) == 0) + xorriso->do_md5&= ~32; + else if(l == 14 && strncmp(cpt, "load_check_off", l) == 0) + xorriso->do_md5|= 32; + else { + sprintf(xorriso->info_text, "-md5: unknown mode "); + Text_shellsafe(cpt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + return(1); +} + + +/* Option -mkdir alias -mkdiri */ +int Xorriso_option_mkdiri(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, end_idx, ret, was_failure= 0, fret; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0); + + for(i= *idx; i<end_idx; i++) { + ret= Xorriso_mkdir(xorriso, argv[i], 0); + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Options -mount , -mount_cmd , -session_string */ +/* @param bit0= -mount_cmd: print mount command to result channel rather + than performing it + bit1= perform -session_string rather than -mount_cmd +*/ +int Xorriso_option_mount(struct XorrisO *xorriso, char *dev, char *adr_mode, + char *adr, char *cmd, int flag) +{ + int ret, entity_code= 0, m_flag; + char entity_id[81], *mnt; + + if(flag & 1) + mnt= "-mount_cmd"; + else if(flag & 2) + mnt= "-session_string"; + else { + mnt= "-mount"; + if(xorriso->allow_restore <= 0) { + sprintf(xorriso->info_text, + "-mount: image-to-disk features are not enabled by option -osirrox"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "%s: Image changes pending. -commit or -rollback first", mnt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + ret= Xorriso_decode_load_adr(xorriso, mnt, adr_mode, adr, + &entity_code, entity_id, 0); + if(ret <= 0) + return(ret); + if(flag & 2) + m_flag= 1 | 4; + else + m_flag= (flag & 1) | 2; + ret= Xorriso_mount(xorriso, dev, entity_code, entity_id, cmd, m_flag); + return(ret); +} + + +/* Option -mount_opts option[:...] */ +int Xorriso_option_mount_opts(struct XorrisO *xorriso, char *mode, int flag) +{ + int was, l; + char *cpt, *npt; + + was= xorriso->mount_opts_flag; + npt= cpt= mode; + for(cpt= mode; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l==0) + goto unknown_mode; + if(strncmp(cpt, "shared", l)==0) { + xorriso->mount_opts_flag|= 1; + } else if(strncmp(cpt, "exclusive", l)==0) { + xorriso->mount_opts_flag&= ~1; + } else { +unknown_mode:; + if(l<SfileadrL) + sprintf(xorriso->info_text, "-mount_opts: unknown option '%s'", cpt); + else + sprintf(xorriso->info_text, "-mount_opts: oversized parameter (%d)",l); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->mount_opts_flag= was; + return(0); + } + } + return(1); +} + + +/* Option -mv alias -mvi */ +int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, end_idx_dummy, ret, is_dir= 0, was_failure= 0, fret; + char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL; + char *leafname= NULL; + int optc= 0; + char **optv= NULL; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + Xorriso_alloc_meM(dest_dir, char, SfileadrL); + Xorriso_alloc_meM(leafname, char, SfileadrL); + + ret= Xorriso_cpmv_args(xorriso, "-mvi", argc, argv, idx, + &optc, &optv, eff_dest, 0); + if(ret<=0) + goto ex; + if(ret==2) { + is_dir= 1; + strcpy(dest_dir, eff_dest); + } + /* Perform movements */ + for(i= 0; i<optc; i++) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi,optv[i],eff_origin,0); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + if(is_dir) { + ret= Sfile_leafname(eff_origin, leafname, 0); + if(ret<=0) + goto problem_handler; + strcpy(eff_dest, dest_dir); + ret= Sfile_add_to_path(eff_dest, leafname, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", + (int) (strlen(eff_dest)+strlen(leafname)+1)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto problem_handler; + } + } + ret= Xorriso_rename(xorriso, NULL, eff_origin, eff_dest, 0); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + sprintf(xorriso->info_text, "Renamed in ISO image: "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + strcat(xorriso->info_text, " to "); + Text_shellsafe(eff_dest, xorriso->info_text, 1 | 2); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso, 0); + + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + ret= !was_failure; +ex:; + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + Xorriso_free_meM(dest_dir); + Xorriso_free_meM(leafname); + Xorriso_opt_args(xorriso, "-mvi", + argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256); + return(ret); +} + + +/* Option -no_rc */ +int Xorriso_option_no_rc(struct XorrisO *xorriso, int flag) +{ + xorriso->no_rc= 1; + return(1); +} + + +/* Option -not_leaf , (-hide_disk_leaf resp. -as mkisofs -hide) */ +/* @param flag bit0= add to iso_rr_hidings rather than disk_exclusions + bit1= add to joliet_hidings rather than disk_exclusions +*/ +int Xorriso_option_not_leaf(struct XorrisO *xorriso, char *pattern, int flag) +{ + regex_t re; + char *regexpr= NULL; + int ret= 0; + + Xorriso_alloc_meM(regexpr, char, 2 * SfileadrL + 2); + + if(pattern[0]==0) + {ret= 0; goto cannot_add;} + Xorriso__bourne_to_reg(pattern, regexpr, 0); + if(regcomp(&re, regexpr, 0)!=0) + {ret= 0; goto cannot_add;} + if(flag & 3) { + if(flag & 1) { + ret= Exclusions_add_not_leafs(xorriso->iso_rr_hidings, pattern, &re, 0); + if(ret<=0) + goto cannot_add; + } + if(flag & 2) { + ret= Exclusions_add_not_leafs(xorriso->joliet_hidings, pattern, &re, 0); + if(ret<=0) + goto cannot_add; + } + } else { + ret= Exclusions_add_not_leafs(xorriso->disk_exclusions, pattern, &re, 0); + } + if(ret<=0) { +cannot_add:; + sprintf(xorriso->info_text,"Cannot add pattern: %s ", + (flag & 3) ? "-hide_disk_leaf" : "-not_leaf"); + Text_shellsafe(pattern, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + ret= 1; +ex:; + Xorriso_free_meM(regexpr); + return(ret); +} + + +/* Option -not_list , -quoted_not_list */ +/* @param flag bit0= -quoted_not_list */ +int Xorriso_option_not_list(struct XorrisO *xorriso, char *adr, int flag) +{ + int ret, linecount= 0, insertcount= 0, null= 0, argc= 0, i; + FILE *fp= NULL; + char **argv= NULL; + + Xorriso_pacifier_reset(xorriso, 0); + if(adr[0]==0) { + sprintf(xorriso->info_text, "Empty file name given with %s", + (flag & 1) ? "-quoted_not_list" : "-not_list"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0); + if(ret <= 0) + return(0); + while(1) { + ret= Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, + 4 | (flag & 1) ); + if(ret <= 0) + goto ex; + if(ret == 2) + break; + for(i= 0; i < argc; i++) { + if(argv[i][0] == 0) + continue; + if(strchr(argv[i], '/')!=NULL) { + null= 0; + ret= Xorriso_option_not_paths(xorriso, 1, argv + i, &null, 0); + } else + ret= Xorriso_option_not_leaf(xorriso, argv[i], 0); + if(ret<=0) + goto ex; + insertcount++; + } + } + ret= 1; +ex:; + if(fp != NULL && fp != stdin) + fclose(fp); + Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, 2); + if(ret<=0) { + sprintf(xorriso->info_text, "Aborted reading of file "); + Text_shellsafe(adr, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " in line number %d", linecount); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + sprintf(xorriso->info_text, "Added %d exclusion list items from file ", + insertcount); + Text_shellsafe(adr, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso,0); + return(ret); +} + + +/* Option -not_mgt */ +int Xorriso_option_not_mgt(struct XorrisO *xorriso, char *setting, int flag) +{ + int ret; + char *what_data= NULL, *what, *what_next; + + Xorriso_alloc_meM(what_data, char, SfileadrL); + + if(Sfile_str(what_data, setting, 0)<=0) { + sprintf(xorriso->info_text, + "-not_mgt: setting string is much too long (%d)", + (int) strlen(setting)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + for(what= what_data; what!=NULL; what= what_next) { + what_next= strchr(what, ':'); + if(what_next!=NULL) { + *what_next= 0; + what_next++; + } + + if(strcmp(what, "reset")==0 || strcmp(what, "erase")==0) { + if(strcmp(what, "reset")==0) + xorriso->disk_excl_mode= 1; + Exclusions_destroy(&(xorriso->disk_exclusions), 0); + ret= Exclusions_new(&(xorriso->disk_exclusions), 0); + if(ret<=0) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + goto ex; + } + } else if(strcmp(what, "on")==0) { + xorriso->disk_excl_mode|= 1; + } else if(strcmp(what, "off")==0) { + xorriso->disk_excl_mode&= ~1; + } else if(strcmp(what, "param_on")==0) { + xorriso->disk_excl_mode|= 2; + } else if(strcmp(what, "param_off")==0) { + xorriso->disk_excl_mode&= ~2; + } else if(strcmp(what, "subtree_on")==0) { + xorriso->disk_excl_mode|= 4; + } else if(strcmp(what, "subtree_off")==0) { + xorriso->disk_excl_mode&= ~4; + } else if(strcmp(what, "ignore_on")==0) { + xorriso->disk_excl_mode|= 8; + } else if(strcmp(what, "ignore_off")==0) { + xorriso->disk_excl_mode&= ~8; + } else { + sprintf(xorriso->info_text, "-not_mgt: unknown setting '%s'", what); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + ret= 1; +ex:; + Xorriso_free_meM(what_data); + return(ret); +} + + +/* Option -not_paths , (-hide_disk_paths resp. -as mkisofs -hide) */ +/* @param flag bit0= add to iso_rr_hidings rather than disk_exclusions + bit1= add to joliet_hidings rather than disk_exclusions + bit2= enable disk pattern expansion regardless of -disk_pattern + +*/ +int Xorriso_option_not_paths(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int ret, end_idx, num_descr= 0, dummy, optc= 0, i; + char **descr= NULL, **optv= NULL, *eff_path= NULL; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, + (xorriso->do_disk_pattern == 1 || (flag & 4)) | 2); + if(end_idx<=0) + {ret= end_idx; goto ex;} + + num_descr= end_idx - *idx; + if(num_descr<=0) + {ret= 1; goto ex;} + + /* produce absolute patterns */ + Xorriso_alloc_meM(eff_path, char, SfileadrL); + descr= TSOB_FELD(char *, num_descr); + if(descr==NULL) { +no_memory:; + Xorriso_no_pattern_memory(xorriso, sizeof(char *) * (off_t) num_descr, 0); + ret= -1; goto ex; + } + for(i= 0; i<num_descr; i++) + descr[i]= NULL; + for(i= 0; i<num_descr; i++) { + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, argv[i+*idx], + eff_path, 2|4); + if(ret<=0) + goto ex; + descr[i]= strdup(eff_path); + if(descr[i]==NULL) + goto no_memory; + } + + ret= Xorriso_opt_args(xorriso, (flag & 3) ? "-hide_disk_paths" : "-not_paths", + num_descr, descr, 0, &dummy, &optc, &optv, + 2 | ((flag & 4) << 7)); + if(ret<=0) + goto ex; + if(flag & 3) { + if(flag & 1) { + ret= Exclusions_add_not_paths(xorriso->iso_rr_hidings, + num_descr, descr, optc, optv, 0); + if(ret<=0) { +no_hide:; + sprintf(xorriso->info_text, + "Cannot add path list: -hide_disk_paths %s ", + Xorriso__hide_mode_text(flag & 3, 0)); + Text_shellsafe(argv[*idx], xorriso->info_text, 1); + strcat(xorriso->info_text, num_descr > 1 ? " ... " : " "); + strcat(xorriso->info_text, xorriso->list_delimiter); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + } + if(flag & 2) { + ret= Exclusions_add_not_paths(xorriso->joliet_hidings, + num_descr, descr, optc, optv, 0); + if(ret<=0) + goto no_hide; + } + } else { + ret= Exclusions_add_not_paths(xorriso->disk_exclusions, + num_descr, descr, optc, optv, 0); + if(ret<=0) { + sprintf(xorriso->info_text,"Cannot add path list: -not_paths "); + Text_shellsafe(argv[*idx], xorriso->info_text, 1); + strcat(xorriso->info_text, num_descr > 1 ? " ... " : " "); + strcat(xorriso->info_text, xorriso->list_delimiter); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + } +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-not_paths", + num_descr, descr, 0, &dummy, &optc, &optv, 256); + if(descr!=NULL) { + for(i= 0; i<num_descr; i++) + if(descr[i]!=NULL) + free(descr[i]); + free((char *) descr); + descr= NULL; + } + Xorriso_free_meM(eff_path); + return(ret); +} + + +/* Option -options_from_file */ +int Xorriso_option_options_from_file(struct XorrisO *xorriso, char *adr, + int flag) +/* + bit0= called from Xorriso_prescan_args, + therefore execute via that same function +*/ +/* +return: + <=0 error , 1 = success , 3 = end program run +*/ +{ + int ret,linecount= 0, argc= 0, was_failure= 0, fret; + FILE *fp= NULL; + char **argv= NULL; + int linec= 0; + char *line= NULL, **linev= NULL; + + if(adr[0]==0) { + sprintf(xorriso->info_text,"Empty file name given with -options_from_file"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + if(xorriso->is_dialog) { + sprintf(xorriso->info_text,"+ performing command lines from file "); + Text_shellsafe(adr, xorriso->info_text, 1); + strcat(xorriso->info_text, " :\n"); + Xorriso_info(xorriso,1); + } + ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0); + if(ret <= 0) + return(0); + sprintf(xorriso->info_text, "Command file: "); + Text_shellsafe(adr, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + while(1) { + ret= Xorriso_read_lines(xorriso, fp, &linecount, &linec, &linev, 1 | 8); + if(ret <= 0) + goto ex; /* no problem_handler because there is no sense in going on */ + if(ret == 2) + break; + line= linev[0]; + if(line[0]==0 || line[0]=='#') + continue; + + if(flag&1) { + ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, + 4 | 8 | ((xorriso->bsl_interpretation & 3) << 5)); + if(ret<=0) + goto problem_handler; + ret= Xorriso_prescan_args(xorriso,argc,argv,1); + if(ret==0) + {ret= 3; goto ex;} + if(ret<0) + goto problem_handler; + } else { + if(xorriso->is_dialog) { + sprintf(xorriso->info_text,"+ %d: %s\n",linecount,line); + Xorriso_info(xorriso,1); + } + ret= Xorriso_execute_option(xorriso,line,1|(1<<16)); + if(ret==3) + goto ex; + if(ret<=0) + goto problem_handler; + } + + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1); + if(fret>=0) + continue; + goto ex; + } + ret= 1; +ex:; + Sfile_make_argv("", "", &argc, &argv, 2); /* release memory */ + Xorriso_read_lines(xorriso, fp, &linecount, &linec, &linev, 2); + Xorriso_reset_counters(xorriso,0); + if(fp != NULL && fp != stdin) + fclose(fp); + if(ret<=0) { + sprintf(xorriso->info_text, + "error triggered by line %d of file:\n ", linecount); + Text_shellsafe(adr, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 1); + } + sprintf(xorriso->info_text, "Command file end: "); + Text_shellsafe(adr, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + if(ret!=1) + return(ret); + return(!was_failure); +} + + +/* Option -osirrox "on"|"off" */ +int Xorriso_option_osirrox(struct XorrisO *xorriso, char *mode, int flag) +{ + int l, allow_restore; + char *npt, *cpt; + + allow_restore= xorriso->allow_restore; + + npt= cpt= mode; + for(cpt= mode; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l==0 && mode[0]!=0) + goto unknown_mode; + if(strncmp(cpt, "off", l)==0 && l >= 3) + allow_restore= 0; + else if(strncmp(cpt, "banned", l)==0 && l >= 5) + allow_restore= -1; + else if(strncmp(cpt, "device_files", l)==0 && l >= 12) + allow_restore= 2; + else if((strncmp(cpt, "on", l)==0 && l >= 2) || mode[0]==0) + allow_restore= 1; + else if(strncmp(cpt, "concat_split_on", l)==0 && l >= 15) + xorriso->do_concat_split= 1; + else if(strncmp(cpt, "concat_split_off", l)==0 && l >= 16) + xorriso->do_concat_split= 0; + else if(strncmp(cpt, "auto_chmod_on", l)==0 && l >= 13) + xorriso->do_auto_chmod= 1; + else if(strncmp(cpt, "auto_chmod_off", l)==0 && l >= 14) + xorriso->do_auto_chmod= 0; + else if(strncmp(cpt, "sort_lba_on", l)==0 && l >= 11) + xorriso->do_restore_sort_lba= 1; + else if(strncmp(cpt, "sort_lba_off", l)==0 && l >= 12) + xorriso->do_restore_sort_lba= 0; + else if(strncmp(cpt, "o_excl_on", l)==0 && l >= 9) + xorriso->drives_exclusive= 1; + else if(strncmp(cpt, "o_excl_off", l)==0 && l >= 10) + xorriso->drives_exclusive= 0; + else if(strncmp(cpt, "strict_acl_on", l)==0 && l >= 13) + xorriso->do_strict_acl|= 1; + else if(strncmp(cpt, "strict_acl_off", l)==0 && l >= 14) + xorriso->do_strict_acl&= ~1; + else { +unknown_mode:; + sprintf(xorriso->info_text, "-osirrox: unknown mode '%s'", cpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + if(allow_restore > 0 && xorriso->allow_restore == -1) { + sprintf(xorriso->info_text, + "-osirrox: was already permanently disabled by setting 'banned'"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(xorriso->allow_restore != -1) + xorriso->allow_restore= allow_restore; + sprintf(xorriso->info_text, + "Copying of file objects from ISO image to disk filesystem is: %s\n", + xorriso->allow_restore > 0 ? "Enabled" : "Disabled"); + Xorriso_info(xorriso, 0); + return(1); +} + + +/* Option -overwrite "on"|"nondir"|"off" */ +int Xorriso_option_overwrite(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->do_overwrite= 0; + else if(strcmp(mode, "on")==0) + xorriso->do_overwrite= 1; + else if(strcmp(mode, "nondir")==0) + xorriso->do_overwrite= 2; + else { + sprintf(xorriso->info_text, "-overwrite: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + diff --git a/libisoburn/branches/1.1.8/xorriso/opts_p_z.c b/libisoburn/branches/1.1.8/xorriso/opts_p_z.c new file mode 100644 index 00000000..f3dae8d0 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/opts_p_z.c @@ -0,0 +1,1985 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of options -p* to -z* as mentioned + in man page or info file derived from xorriso.texi. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* Option -pacifier */ +int Xorriso_option_pacifier(struct XorrisO *xorriso, char *style, int flag) +{ + if(strcmp(style, "xorriso")==0 || strcmp(style, "default")==0) + xorriso->pacifier_style= 0; + else if(strcmp(style, "mkisofs")==0 || strcmp(style, "genisofs")==0 || + strcmp(style, "genisoimage")==0 || strcmp(style, "xorrisofs")==0) + xorriso->pacifier_style= 1; + else if(strcmp(style, "cdrecord")==0 || strcmp(style, "cdrskin")==0 || + strcmp(style, "wodim")==0 || strcmp(style, "xorrecord")==0) + xorriso->pacifier_style= 2; + else { + sprintf(xorriso->info_text, "-pacifier: unknown behavior code '%s'", style); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + +/* Option -padding */ +int Xorriso_option_padding(struct XorrisO *xorriso, char *size, int flag) +{ + double num; + + if(strcmp(size, "included") == 0) { + xorriso->do_padding_by_libisofs= 1; + return(1); + } else if(strcmp(size, "excluded") == 0 || strcmp(size, "appended") == 0) { + xorriso->do_padding_by_libisofs= 0; + return(1); + } else if(size[0] < '0' || size[0] > '9') { + sprintf(xorriso->info_text, "-padding: unrecognized non-numerical mode "); + Text_shellsafe(size, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + num= Scanf_io_size(size, 0); + if(num < 0 || num > 1024.0 * 1024.0 * 1024.0) { + sprintf(xorriso->info_text, "-padding: wrong size %.f (allowed: %.f - %.f)", + num, 0.0, 1024.0 * 1024.0 * 1024.0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->padding= num; + if(xorriso->padding/2048 != num/2048.0) + xorriso->padding++; + return(1); +} + + +/* Option -page */ +int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag) +{ + if(len<0 || width<=0) { + sprintf(xorriso->info_text, + "Improper numeric value of arguments of -page: %d %d", + len, width); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->result_page_length= len; + xorriso->result_page_width= width; + return(1); +} + + +/* Option -paste_in */ +int Xorriso_option_paste_in(struct XorrisO *xorriso, char *iso_rr_path, + char *disk_path, char *start, char *count, int flag) +{ + int ret; + double num; + off_t startbyte, bytecount; + + num= Scanf_io_size(start, 0); + if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */ + sprintf(xorriso->info_text, + "-paste_in: startbyte address negative or much too large (%s)", start); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + startbyte= num; + num= Scanf_io_size(count, 0); + if(num<=0 || num > 1.0e18) { + sprintf(xorriso->info_text, + "-paste_in : bytecount zero, negative or much too large (%s)", count); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + bytecount= num; + sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f", + disk_path, iso_rr_path, + (double) startbyte, (double) (startbyte+bytecount)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount, + iso_rr_path, 0); + return(ret); +} + + +/* Option -path_list , -quoted_path_list */ +/* @param flag bit0= -quoted_path_list */ +int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag) +{ + int ret,linecount= 0, insertcount= 0, null= 0, was_failure= 0, fret= 0; + int was_ferror= 0, argc= 0, i; + FILE *fp= NULL; + char **argv= NULL; + + Xorriso_pacifier_reset(xorriso, 0); + if(adr[0]==0) { + sprintf(xorriso->info_text,"Empty file name given with %s", + flag & 1 ? "-quoted_path_list" : "-path_list"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(0); + } + ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0); + if(ret <= 0) + return(0); + while(1) { + ret= Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, + 4 | (flag & 1) ); + if(ret <= 0) + goto ex; + if(ret == 2) + break; + for(i= 0; i < argc; i++) { + if(argv[i][0] == 0) + continue; + null= 0; + ret= Xorriso_option_add(xorriso, 1, argv + i, &null, 1|2); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + insertcount++; + + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + if(ret > 0) + ret= 0; + goto ex; + } + } + ret= 1; +ex:; + if(flag & 1) + Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, 2); + + if(fp != NULL && fp != stdin) + fclose(fp); + Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, + xorriso->pacifier_total, "", 1); + if(ret<=0) { + sprintf(xorriso->info_text, "Aborted reading of file "); + Text_shellsafe(adr, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " in line number %d", linecount); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (fret==-2 ? "NOTE" : "FAILURE"), 0); + } else + ret= !was_ferror; + sprintf(xorriso->info_text, "Added %d items from file ", insertcount); + Text_shellsafe(adr, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso,0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -pathspecs */ +int Xorriso_option_pathspecs(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->allow_graft_points= 0; + else if(strcmp(mode, "on")==0) + xorriso->allow_graft_points= 1; + else { + sprintf(xorriso->info_text, "-pathspecs: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +/* Option -pkt_output */ +int Xorriso_option_pkt_output(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode,"off")==0) + xorriso->packet_output= 0; + else + xorriso->packet_output= 1; + return(1); +} + + +/* Option -preparer_id */ +int Xorriso_option_preparer_id(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, + (int) sizeof(xorriso->preparer_id), + "-preparer_id", 0) <= 0) + return(0); + if(strcmp(name, "@xorriso@") == 0) + Xorriso_preparer_string(xorriso, xorriso->preparer_id, 0); + else + strcpy(xorriso->preparer_id, name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Options -print , -print_info , -print_mark */ +/* @param flag bit0-1= channel: 0=result, 1=info, 2=mark */ +int Xorriso_option_print(struct XorrisO *xorriso, char *text, int flag) +{ + int maxl, l, mode; + + l= strlen(text); + mode= flag & 3; + if(mode == 1) + maxl= sizeof(xorriso->info_text); + else if(mode == 2) + maxl= sizeof(xorriso->mark_text); + else + maxl= sizeof(xorriso->result_line); + if(l >= maxl) { + sprintf(xorriso->info_text, "Output text too long for -print%s(%d > %d)", + mode == 1 ? "_info" : mode == 2 ? "_mark" : "", l, maxl); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(0); + } + if(mode == 1) { + sprintf(xorriso->info_text,"%s\n", text); + Xorriso_info(xorriso,0); + } else if(mode == 2) { + strcpy(xorriso->info_text, xorriso->mark_text); + strcpy(xorriso->mark_text, text); + Xorriso_mark(xorriso,0); + strcpy(xorriso->mark_text, xorriso->info_text); + } else { + sprintf(xorriso->result_line,"%s\n",text); + Xorriso_result(xorriso,1); + } + return(1); +} + + +/* Option -print_size + @param flag bit0= report in mkisofs compatible form on real stdout + (resp. on result channel if xorriso->packet_output) +*/ +int Xorriso_option_print_size(struct XorrisO *xorriso, int flag) +{ + int ret, fd; + + if(!xorriso->volset_change_pending) { + sprintf(xorriso->info_text,"-print_size: No image modifications pending"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + if(!(flag & 1)) { + sprintf(xorriso->result_line,"Image size : 0s\n"); + Xorriso_result(xorriso,0); + } + return(2); + } + ret= Xorriso_write_session(xorriso, 1); + if(ret<=0) { + sprintf(xorriso->info_text,"-print_size: Failed to set up virtual -commit"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + if(flag&1) { + sprintf(xorriso->result_line,"%d\n", ret); + if(xorriso->packet_output) { + Xorriso_result(xorriso,0); + } else { + fd= xorriso->dev_fd_1; + if(fd<0) + fd= 1; + ret= write(fd, xorriso->result_line, strlen(xorriso->result_line)); + /* (result of write intentionally ignored) */ + fsync(fd); + } + } else { + sprintf(xorriso->result_line,"Image size : %ds\n", ret); + Xorriso_result(xorriso,0); + } + return(1); +} + + +/* Option -prog */ +int Xorriso_option_prog(struct XorrisO *xorriso, char *name, int flag) +{ + if(strlen(name)>=sizeof(xorriso->progname)) { + sprintf(xorriso->info_text, + "Name too long with option -prog (%d > %d)", + (int) strlen(name), (int) sizeof(xorriso->progname)-1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + if(Sfile_str(xorriso->progname,name,0)<=0) + return(-1); + return(1); +} + + +/* Option -prog_help */ +int Xorriso_option_prog_help(struct XorrisO *xorriso, char *name, int flag) +{ + int ret; + + ret= Xorriso_option_prog(xorriso, name, 0); + if(ret<=0) + return(ret); + ret= Xorriso_option_help(xorriso, 0); + return(ret); +} + + +/* Option -prompt */ +int Xorriso_option_prompt(struct XorrisO *xorriso, char *text, int flag) +{ + int ret; + char line[80]; + + strncpy(xorriso->result_line,text,sizeof(xorriso->result_line)-1); + xorriso->result_line[sizeof(xorriso->result_line)-1]= 0; + Xorriso_result(xorriso,0); + ret= Xorriso_dialog_input(xorriso, line, sizeof(line),1); + return(ret); +} + + +/* Option -publisher */ +int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->publisher), + "-publisher", 0) <= 0) + return(0); + strcpy(xorriso->publisher,name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Option -pvd_info */ +int Xorriso_option_pvd_info(struct XorrisO *xorriso, int flag) +{ + return(Xorriso_pvd_info(xorriso, 0)); +} + + +/* Option -pwd alias -pwdi */ +int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag) +{ + sprintf(xorriso->info_text,"current working directory in ISO image:\n"); + Xorriso_info(xorriso,0); + Text_shellsafe(xorriso->wdi, xorriso->result_line, 0); + strcat(xorriso->result_line, "/\n"); + Xorriso_result(xorriso,0); + return(1); +} + + +/* Option -pwdx */ +int Xorriso_option_pwdx(struct XorrisO *xorriso, int flag) +{ + sprintf(xorriso->info_text,"current working directory on hard disk:\n"); + Xorriso_info(xorriso,0); + sprintf(xorriso->result_line,"%s/\n",xorriso->wdx); + Xorriso_result(xorriso,0); + return(1); +} + + +int Xorriso_option_read_mkisofsrc(struct XorrisO *xorriso, int flag) +{ + int ret; + + ret= Xorriso_read_mkisofsrc(xorriso, 0); + return(ret); +} + + +/* Option -reassure "on"|"tree"|"off" */ +int Xorriso_option_reassure(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "off")==0) + xorriso->do_reassure= 0; + else if(strcmp(mode, "on")==0) + xorriso->do_reassure= 1; + else if(strcmp(mode, "tree")==0) + xorriso->do_reassure= 2; + else { + sprintf(xorriso->info_text, "-reassure: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + +/* Option -unregister_filter */ +int Xorriso_option_unregister_filter(struct XorrisO *xorriso, char *name, + int flag) +{ + int ret; + + ret= Xorriso_external_filter(xorriso, name, "", "", 0, NULL, 1); + return(ret); +} + + +/* Option -report_about */ +int Xorriso_option_report_about(struct XorrisO *xorriso, char *in_severity, + int flag) +{ + int ret, sev; + char severity[20], *official; + + Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0); + ret= Xorriso__text_to_sev(severity, &sev, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "-report_about: Not a known severity name : "); + Text_shellsafe(in_severity, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(ret); + } + ret= Xorriso__sev_to_text(sev, &official, 0); + if(ret <= 0) + official= severity; + if(Sfile_str(xorriso->report_about_text, official, 0) <= 0) + return(-1); + xorriso->report_about_severity= sev; + return(1); +} + + +/* Option -return_with */ +int Xorriso_option_return_with(struct XorrisO *xorriso, char *in_severity, + int exit_value, int flag) +{ + int ret, sev; + char severity[20], *official; + + Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0); + ret= Xorriso__text_to_sev(severity, &sev, 0); + if(ret<=0) { + sprintf(xorriso->info_text, + "-return_with: Not a known severity name : "); + Text_shellsafe(in_severity, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(ret); + } + ret= Xorriso__sev_to_text(sev, &official, 0); + if(ret <= 0) + official= severity; + if(exit_value && (exit_value < 32 || exit_value > 63)) { + sprintf(xorriso->info_text, + "-return_with: Not an allowed exit_value. Use 0, or 32 to 63."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(Sfile_str(xorriso->return_with_text, official, 0) <= 0) + return(-1); + xorriso->return_with_severity= sev; + xorriso->return_with_value= exit_value; + return(1); +} + + +/* Options -rm alias -rmi , -rm_r alias -rm_ri , -rmdir alias -rmdiri */ +/* @param flag bit0=recursive , bit1= remove empty directory: rmdir */ +int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int i, ret, end_idx, was_failure= 0, fret; + char *path= NULL, *eff_path= NULL; + int optc= 0; + char **optv= NULL; + + ret= Xorriso_opt_args(xorriso, "-rm*i", + argc, argv, *idx, &end_idx, &optc, &optv, 0); + if(ret<=0) + goto ex; + Xorriso_alloc_meM(path, char, SfileadrL); + Xorriso_alloc_meM(eff_path, char, SfileadrL); + + for(i= 0; i<optc; i++) { + if(Sfile_str(path,optv[i],0)<=0) + {ret= -1; goto problem_handler;} + if(path[0]!='/') { + ret= Sfile_prepend_path(xorriso->wdi, path, 0); + if(ret<=0) + goto problem_handler; + } + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 1); + if(ret<0) + goto problem_handler; + if(ret==0) { + sprintf(xorriso->info_text, "Cannot find path "); + Text_shellsafe(path, xorriso->info_text, 1); + strcat(xorriso->info_text, " in loaded ISO image for removal"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + goto problem_handler; + } + strcpy(path, eff_path); + + ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, path, flag&(1|2)); + if(ret<=0 || xorriso->request_to_abort) + goto problem_handler; + if(ret<3) { + sprintf(xorriso->info_text, "Removed from ISO image: %s '%s'\n", + ((flag&2) ? "directory" : (ret>1 ? "subtree" : "file")), path); + Xorriso_info(xorriso, 0); + } + + continue; /* regular bottom of loop */ +problem_handler:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_free_meM(path); + Xorriso_free_meM(eff_path); + Xorriso_opt_args(xorriso, "-rm*i", + argc, argv, *idx, &end_idx, &optc, &optv, 256); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -rollback */ +/* @param flag bit0= do not -reassure + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_rollback(struct XorrisO *xorriso, int flag) +{ + int ret; + char *indev= NULL, *which_will; + + Xorriso_alloc_meM(indev, char, SfileadrL); + if(xorriso->volset_change_pending) + which_will= "revoke the pending image changes"; + else + which_will= "reload the image"; + if(!(flag&1)) { + ret= Xorriso_reassure(xorriso, "-rollback", which_will, 0); + if(ret<=0) + {ret= 2; goto ex;} + } + + if(Sfile_str(indev, xorriso->indev, 0)<=0) + {ret= -1; goto ex;} + ret= Xorriso_give_up_drive(xorriso, 1|8); + if(ret<=0) + goto ex; + xorriso->image_start_mode&= ~(1<<31); /* reactivate eventual -load address */ + ret= Xorriso_option_dev(xorriso, indev, 1|4); +ex:; + Xorriso_free_meM(indev); + return(ret); +} + + +/* Option -rom_toc_scan */ +int Xorriso_option_rom_toc_scan(struct XorrisO *xorriso, char *mode, int flag) +{ + int l; + char *cpt, *npt; + + xorriso->toc_emulation_flag= 0; + npt= cpt= mode; + for(cpt= mode; npt != NULL; cpt= npt + 1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l==0) + goto unknown_mode; + xorriso->toc_emulation_flag&= ~4; + if(strncmp(cpt, "off", l) == 0) + xorriso->toc_emulation_flag&= ~1; + else if(strncmp(cpt, "on", l) == 0) + xorriso->toc_emulation_flag|= 1; + else if(strncmp(cpt, "force", l) == 0) + xorriso->toc_emulation_flag|= 4; + else if(strncmp(cpt, "emul_off", l) == 0) + xorriso->toc_emulation_flag|= 2; + else if(strncmp(cpt, "emul_on", l) == 0) + xorriso->toc_emulation_flag&= ~2; + else { +unknown_mode:; + sprintf(xorriso->info_text, "-rom_toc_scan: unknown mode in '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + return(1); +} + + +/* Option -scdbackup_tag list_path record_name */ +int Xorriso_option_scdbackup_tag(struct XorrisO *xorriso, char *listname, + char *recname, int flag) +{ + if(strlen(recname) > 80) { + sprintf(xorriso->info_text, + "Unsuitable record name given with -scdbackup_tag"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + strcpy(xorriso->scdbackup_tag_name, recname); + xorriso->scdbackup_tag_time[0]= 0; + if(Sfile_str(xorriso->scdbackup_tag_listname, listname, 0) <= 0) + return(-1); + return(1); +} + + +/* Option -scsi_log */ +int Xorriso_option_scsi_log(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode, "on") == 0) + xorriso->scsi_log= 1; + else if(strcmp(mode, "off") == 0) + xorriso->scsi_log= 0; + else { + sprintf(xorriso->info_text, "-scsi_log: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + Xorriso_scsi_log(xorriso, !!xorriso->scsi_log); + return(1); +} + + +/* Option -session_log */ +int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag) +{ + if(Sfile_str(xorriso->session_logfile, path, 0)<=0) + return(-1); + return(1); +} + + +/* Option -setfacl_list alias -setfacl_listi */ +int Xorriso_option_setfacl_listi(struct XorrisO *xorriso, char *path, int flag) +{ + int ret, eaten, line_size; + size_t buf_size= 0, buf_add= 64 * 1024, l, linecount= 0; + char *line= NULL, *buf= NULL, *wpt, *new_buf, limit_text[80]; + char *file_path= NULL, *uid= NULL, *gid= NULL; + FILE *fp= NULL; + + line_size= SfileadrL * 4; + Xorriso_alloc_meM(line, char, line_size); + Xorriso_alloc_meM(file_path, char, SfileadrL); + Xorriso_alloc_meM(uid, char, 161); + Xorriso_alloc_meM(gid, char, 161); + + Xorriso_pacifier_reset(xorriso, 0); + if(path[0]==0) { + sprintf(xorriso->info_text, "Empty file name given with -setfacl_list"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= Xorriso_afile_fopen(xorriso, path, "rb", &fp, 0); + if(ret <= 0) + {ret= 0; goto ex;} + + buf_size= buf_add; + buf= calloc(buf_size, 1); + if(buf == NULL) + goto out_of_mem; + wpt= buf; + *wpt= 0; + uid[0]= gid[0]= 0; + + while(1) { + if(Sfile_fgets_n(line, line_size, fp, 0) == NULL) + break; + linecount++; + if(strncmp(line, "# file: ", 8) ==0) { + if(wpt != buf && file_path[0]) { + /* Commit previous list */ + ret= Xorriso_perform_acl_from_list(xorriso, file_path, + uid, gid, buf, 0); + if(ret<=0) + goto ex; + wpt= buf; + *wpt= 0; + file_path[0]= uid[0]= gid[0]= 0; + } + /* Unescape line and register as file path */ + Sfile_bsl_interpreter(line + 8, strlen(line + 8), &eaten, 0); + if(strlen(line + 8) >= SfileadrL) { + sprintf(xorriso->info_text, "-setfacl_list: Oversized file path"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + strcpy(file_path, line + 8); + continue; + } else if(strncmp(line, "# owner: ", 9) == 0) { + if(strlen(line + 9) > 160) { + sprintf(xorriso->info_text, "-setfacl_list: Oversized owner id"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + strcpy(uid, line + 9); + continue; + } else if(strncmp(line, "# group: ", 9) == 0) { + if(strlen(line + 9) > 160) { + sprintf(xorriso->info_text, "-setfacl_list: Oversized group id"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + strcpy(gid, line + 9); + continue; + } else if(line[0] == '#' || line[0] == 0) { + continue; + } else if(strcmp(line, "@") == 0) { + Xorriso_msgs_submit(xorriso, 0, + "-setfacl_list input ended by '@'", 0, "NOTE", 0); + break; + } else if(strcmp(line, "@@@") == 0) { + Xorriso_msgs_submit(xorriso, 0, + "-setfacl_list aborted by input line '@@@'", 0, "WARNING", 0); + ret= 0; goto ex; + } + + /* Register ACL entry */ + l= strlen(line); + if(wpt + l + 2 - buf > (int) buf_size) { + if((int) (buf_size + buf_add) > xorriso->temp_mem_limit) { + Sfile_scale((double) xorriso->temp_mem_limit, limit_text,5,1e4,1); + sprintf(xorriso->info_text, + "-setfacl_list: List entry for a single file exceeds -temp_mem_limit %s", + limit_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + buf_size+= buf_add; + new_buf= realloc(buf, buf_size); + if(new_buf == NULL) + goto out_of_mem; + buf= new_buf; + } + memcpy(wpt, line, l); + *(wpt + l)= '\n'; + wpt+= l + 1; + *wpt= 0; + } + if(wpt != buf && file_path[0]) { + /* Commit last list */ + ret= Xorriso_perform_acl_from_list(xorriso, file_path, uid, gid, buf, 0); + if(ret<=0) + goto ex; + } else { + sprintf(xorriso->info_text, "-setfacl_list: Unexpected end of file "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + ret= 1; +ex:; + if(buf != NULL) + free(buf); + if(fp != NULL && fp != stdin) + fclose(fp); + if(ret <= 0) { + sprintf(xorriso->info_text, "-setfacl_list "); + Text_shellsafe(path, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " aborted in line %.f\n", (double) linecount); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + Xorriso_free_meM(line); + Xorriso_free_meM(file_path); + Xorriso_free_meM(uid); + Xorriso_free_meM(gid); + return(ret); +out_of_mem:; + Xorriso_no_malloc_memory(xorriso, &buf, 0); + ret= -1; + goto ex; +} + + +/* Options -setfacl alias -setfacli, -setfacl_r alias -setfacl_ri */ +/* @param flag bit0=recursive -setfacl_r +*/ +int Xorriso_option_setfacli(struct XorrisO *xorriso, char *acl_text, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + int optc= 0; + char **optv= NULL, *access_acl_text= NULL, *default_acl_text= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-setfacl", argc, argv, *idx, &end_idx, &optc, + &optv, 0); + if(ret <= 0) + goto ex; + + ret= Xorriso_normalize_acl_text(xorriso, acl_text, + &access_acl_text, &default_acl_text, 0); + if(access_acl_text != NULL && default_acl_text != NULL) { + sprintf(xorriso->info_text, "Access-ACL :\n%s", access_acl_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + sprintf(xorriso->info_text, "Default-ACL :\n%s", default_acl_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } else if(access_acl_text == NULL && default_acl_text == NULL) { + sprintf(xorriso->info_text, "Will delete Access-ACL and Default-ACL"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + if(ret <= 0) + goto ex; + + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-setfacl_r", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_text_2(job, 25, access_acl_text, default_acl_text, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else { + ret= 1; + if(access_acl_text == NULL || access_acl_text[0] || + default_acl_text == NULL || default_acl_text[0]) + ret= Xorriso_setfacl(xorriso, NULL, optv[i], + access_acl_text, default_acl_text, 0); + } + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-setfacl", argc, argv, *idx, &end_idx, + &optc, &optv, 256); + Findjob_destroy(&job, 0); + if(access_acl_text != NULL) + free(access_acl_text); + if(default_acl_text != NULL) + free(default_acl_text); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Options -setfattr alias -setfattri, -setfattr_r alias -setfattr_ri */ +/* @param flag bit0=recursive -setfattr_r +*/ +int Xorriso_option_setfattri(struct XorrisO *xorriso, char *name, char *value, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + + ret= Xorriso_opt_args(xorriso, "-setfattr", argc, argv, *idx, &end_idx, &optc, + &optv, 0); + if(ret <= 0) + goto ex; + + /* check input */ + ret= Xorriso_path_setfattr(xorriso, NULL, "", name, strlen(value), value, 1); + if(ret <= 0) + goto ex; + + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, "-setfattr_r", 0); + {ret= -1; goto ex;} + } + Findjob_set_action_text_2(job, 27, name, value, 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else { + ret= 1; + ret= Xorriso_path_setfattr(xorriso, NULL, optv[i], + name, strlen(value), value, 0); + } + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, "-setfattr", argc, argv, *idx, &end_idx, + &optc, &optv, 256); + Findjob_destroy(&job, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -setfattr_list alias -setfattr_listi */ +int Xorriso_option_setfattr_listi(struct XorrisO *xorriso, char *path, + int flag) +{ + int ret, eaten, line_size= SfileadrL * 4; + size_t linecount= 0, mem_used= 0, num_attr= 0, v_len; + char *line= NULL, limit_text[80], *ept, *valuept; + char *file_path= NULL; + FILE *fp= NULL; + struct Xorriso_lsT *lst_curr= NULL, *lst_start= NULL; + + Xorriso_alloc_meM(line, char, line_size); + Xorriso_alloc_meM(file_path, char, SfileadrL); + + Xorriso_pacifier_reset(xorriso, 0); + if(path[0]==0) { + sprintf(xorriso->info_text, "Empty file name given with -setfattr_list"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= Xorriso_afile_fopen(xorriso, path, "rb", &fp, 0); + if(ret <= 0) + {ret= 0; goto ex;} + + while(1) { + if(Sfile_fgets_n(line, line_size, fp, 0) == NULL) + break; + linecount++; + if(strncmp(line, "# file: ", 8) ==0) { + if(num_attr > 0 && file_path[0]) { + /* Commit previous list */ + ret= Xorriso_perform_attr_from_list(xorriso, file_path, lst_start, 0); + if(ret<=0) + goto ex; + num_attr= 0; + file_path[0]= 0; + Xorriso_lst_destroy_all(&lst_start, 0); + lst_curr= NULL; + } + /* Unescape line and register as file path */ + Sfile_bsl_interpreter(line + 8, strlen(line + 8), &eaten, 0); + if(strlen(line + 8) >= SfileadrL) { + sprintf(xorriso->info_text, "-setfattr_list: Oversized file path"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + strcpy(file_path, line + 8); + continue; + } else if(line[0] == '#' || line[0] == 0) { + continue; + } else if(strcmp(line, "@") == 0) { + Xorriso_msgs_submit(xorriso, 0, + "-setfattr_list input ended by '@'", 0, "NOTE", 0); + break; + } else if(strcmp(line, "@@@") == 0) { + Xorriso_msgs_submit(xorriso, 0, + "-setfattr_list aborted by input line '@@@'", 0, "WARNING", 0); + ret= 1; goto ex; + } + mem_used+= strlen(line) + 1; + if(mem_used > (size_t) xorriso->temp_mem_limit) { + Sfile_scale((double) xorriso->temp_mem_limit, limit_text,5,1e4,1); + sprintf(xorriso->info_text, + "-setfattr_list: List entry for a single file exceeds -temp_mem_limit %s", + limit_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + /* Register attr pair */ + + ept= strchr(line, '='); + if(ept == NULL) { + sprintf(xorriso->info_text, "-setfattr_list: "); + Text_shellsafe(path, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " : Line %.f : No separator '=' found", + (double) linecount); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + continue; + } + valuept= ept + 1; + v_len= strlen(valuept); + for(ept= valuept + v_len - 1; ept > valuept; ept--) + if(isspace(*ept)) + *ept= 0; + else + break; + v_len= strlen(valuept); + if(v_len < 2 || *valuept != '"' || *(valuept + v_len -1) != '"') { + sprintf(xorriso->info_text, "-setfattr_list: "); + Text_shellsafe(path, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " : Line %.f : Value not enclosed in quotes", + (double) linecount); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + + continue; + } + + ret= Xorriso_lst_new(&lst_curr, line, lst_curr, 0); + if(ret <= 0) + goto out_of_mem; + if(lst_start == NULL) + lst_start= lst_curr; + num_attr++; + } + + if(file_path[0]) { + /* Commit last list */ + ret= Xorriso_perform_attr_from_list(xorriso, file_path, lst_start, 0); + if(ret<=0) + goto ex; + } else { + sprintf(xorriso->info_text, "-setfattr_list: Unexpected end of file "); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + ret= 1; +ex:; + if(fp != NULL && fp != stdin) + fclose(fp); + Xorriso_lst_destroy_all(&lst_start, 0); + Xorriso_free_meM(line); + Xorriso_free_meM(file_path); + if(ret <= 0) { + sprintf(xorriso->info_text, "-setfattr_list "); + Text_shellsafe(path, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " aborted in line %.f\n", (double) linecount); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + return(ret); +out_of_mem:; + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; + goto ex; +} + + +/* Options -set_filter , -set_filter_r , -show_stream , -show_stream_r */ +/* @param flag bit0=recursive -set_filter_r + bit1= do not reset pacifier, no final pacifier message + bit2= -show_stream rather than -set_filter +*/ +int Xorriso_option_set_filter(struct XorrisO *xorriso, char *name, + int argc, char **argv, int *idx, int flag) +{ + int i, ret, was_failure= 0, end_idx, fret; + int optc= 0; + char **optv= NULL; + struct FindjoB *job= NULL; + struct stat dir_stbuf; + char *cmd= "-set_filter"; + + switch(flag & 5) { + case 0: cmd= "-set_filter"; + break; case 1: cmd= "-set_filter_r"; + break; case 4: cmd= "-show_stream"; + break; case 5: cmd= "-show_stream_r"; + } + + ret= Xorriso_opt_args(xorriso, cmd, + argc, argv, *idx, &end_idx, &optc, &optv, 0); + if(ret <= 0) + goto ex; + if(!(flag&2)) + Xorriso_pacifier_reset(xorriso, 0); + + for(i= 0; i<optc; i++) { + if(flag&1) { + ret= Findjob_new(&job, optv[i], 0); + if(ret<=0) { + Xorriso_no_findjob(xorriso, cmd, 0); + {ret= -1; goto ex;} + } + Findjob_set_action_target(job, ((flag & 4) ? 29 : 28), name, 0); + Findjob_set_file_type(job, 'f', 0); + ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, + NULL, optv[i], &dir_stbuf, 0, 0); + Findjob_destroy(&job, 0); + } else { + ret= 1; + if(flag & 4) + ret= Xorriso_show_stream(xorriso, NULL, optv[i], 0); + else + ret= Xorriso_set_filter(xorriso, NULL, optv[i], name, 0); + } + if(ret>0 && !xorriso->request_to_abort) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + ret= 0; goto ex; + } + if(!(flag&2)) + Xorriso_pacifier_callback(xorriso, "file filters processed", + xorriso->pacifier_count, 0, "", 1); + ret= 1; +ex:; + (*idx)= end_idx; + Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, + &optc, &optv, 256); + Findjob_destroy(&job, 0); + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* Option -signal_handling */ +/* @param flag bit0= prescan mode: do not yet install the eventual handler + else: when switching from other modes to "off": + activate mode "sig_dfl" +*/ +int Xorriso_option_signal_handling(struct XorrisO *xorriso, char *mode, + int flag) +{ + int ret, behavior; + + if (strcmp(mode, "off") == 0) { + behavior= Xorriso__get_signal_behavior(0); + if(flag & 1) { + behavior= 0; + } else if(behavior != 0) { + sprintf(xorriso->info_text, + "Signal handling mode \"off\" comes too late. Defaulted to \"sig_dfl\"\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + behavior= 2; + } + } else if(strcmp(mode, "libburn") == 0 || strcmp(mode, "on") == 0) { + behavior= 1; + } else if (strcmp(mode, "sig_dfl") == 0) { + behavior= 2; + } else if (strcmp(mode, "sig_ign") == 0) { + behavior= 3; + } else { + sprintf(xorriso->info_text, "-signal_handling: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + Xorriso_msgs_submit(xorriso, 0, + "Use one of: \"off\",\"on\",\"sig_dfl\",\"sig_ign\"", 0, "HINT", 0); + return(0); + } + Xorriso__preset_signal_behavior(behavior, 0); + if(flag & 1) + return(1); + ret= Xorriso_set_signal_handling(xorriso, 0); + return(ret); +} + + +/* Option -sleep */ +int Xorriso_option_sleep(struct XorrisO *xorriso, char *duration, int flag) +{ + double dur= 0.0, start_time, end_time, todo, granularity= 0.01; + unsigned long usleep_time; + + sscanf(duration, "%lf", &dur); + start_time= Sfile_microtime(0); + end_time= start_time + dur; + Ftimetxt(time(NULL), xorriso->info_text, 6); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " : Will sleep for %f seconds", dur); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + while(1) { + todo= end_time - Sfile_microtime(0); + if(todo <= 0) + usleep_time= 0; + else if(todo > granularity) + usleep_time= granularity * 1.0e6; + else + usleep_time= todo * 1.0e6; + if(usleep_time == 0) + break; + usleep(usleep_time); + } + sprintf(xorriso->info_text, "Slept for %f seconds", + Sfile_microtime(0) - start_time); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + return(1); +} + + +/* Option -speed */ +int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag) +{ + int is_cd= 1, unit_found= 0, ret, profile_number; + double num; + char *cpt, profile_name[80]; + + if(speed[0]==0 || strcmp(speed, "any")==0) { + xorriso->speed= 0; /* full speed */ + return(1); + } + + sscanf(speed,"%lf",&num); + for(cpt= speed+strlen(speed)-1; cpt>=speed; cpt--) + if(isdigit(*cpt) || *cpt=='.') + break; + cpt++; + + if(*cpt=='k' || *cpt=='K') { + /* is merchand kilobyte, stays merchand kilobyte */ + unit_found= 1; + } else if(*cpt=='m' || *cpt=='M') { + num*= 1000; + unit_found= 1; + } else if(*cpt=='x' || *cpt=='X') + cpt++; + + if (unit_found) { + ; + } else if(*cpt=='c' || *cpt=='C') { +cd_speed:; + num*= 176.4; + } else if(*cpt=='d' || *cpt=='D') { +dvd_speed:; + num*= 1385; + } else if(*cpt=='b' || *cpt=='B') { +bd_speed:; + num*= 4495.625; + } else { + ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2); + is_cd= (ret==2); + if(is_cd) + goto cd_speed; + else if (ret == 3) + goto bd_speed; + else + goto dvd_speed; + } + + if(num> 2.0e9) { + sprintf(xorriso->info_text, + "-speed: Value too large or not recognizable: '%s'", speed); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->speed= num; + if(xorriso->speed<num) + xorriso->speed++; + return(1); +} + + +/* Option -split_size */ +int Xorriso_option_split_size(struct XorrisO *xorriso, char *size, int flag) +{ + double num; + + num= Scanf_io_size(size, 0); + if(num > xorriso->file_size_limit && xorriso->file_size_limit > 0) { + sprintf(xorriso->info_text, "-split_size: too large %.f (allowed: %.f)", + num, (double) xorriso->file_size_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } else if(num < 0) + num= 0.0; + xorriso->split_size= num; + return(1); +} + + +/* Option -status */ +int Xorriso_option_status(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode,"short")==0) + Xorriso_status(xorriso,NULL,NULL,1); + else if(strcmp(mode,"long")==0) + Xorriso_status(xorriso,NULL,NULL,0); + else if(strcmp(mode,"long_history")==0) + Xorriso_status(xorriso,NULL,NULL,8); + else if(mode[0]=='-') + Xorriso_status(xorriso,mode,NULL,8); + else + Xorriso_status(xorriso,NULL,NULL,1); + return(1); +} + + +/* Option -status_history_max */ +int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num, + int flag) +{ + if(num>=0 && num<1000000) + xorriso->status_history_max= num; + return(1); +} + + +/* Option -stdio_sync "on"|"off"|size */ +int Xorriso_option_stdio_sync(struct XorrisO *xorriso, char *rythm, int flag) +{ + double num; + + if(strcmp(rythm, "default") == 0 || strcmp(rythm, "on") == 0) + num= 0; + if(strcmp(rythm, "off") == 0) + num= -1; + else + num = Scanf_io_size(rythm, 0); + if(num > 0) + num /= 2048; + if(num != -1 && num != 0 && (num < 32 || num > 512 * 1024)) { + sprintf(xorriso->info_text, + "-stdio_sync : Bad size. Acceptable are -1, 0, 32k ... 1g"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } else + xorriso->stdio_sync= num; + return(1); +} + + +/* Option -stream_recording */ +int Xorriso_option_stream_recording(struct XorrisO *xorriso, char *mode, + int flag) +{ + double num; + + if(strcmp(mode,"on")==0 || mode[0]==0) + xorriso->do_stream_recording= 32; + else if(strcmp(mode,"full")==0) + xorriso->do_stream_recording= 1; + else if(strcmp(mode,"data")==0) + xorriso->do_stream_recording= 2; + else if(mode[0] >= '0' && mode[0] <= '9') { + num= Scanf_io_size(mode, 0); + num/= 2048.0; + if(num >= 16 && num <= 0x7FFFFFFF) + xorriso->do_stream_recording= num; + else + xorriso->do_stream_recording= 0; + } else + xorriso->do_stream_recording= 0; + return(1); +} + + +/* Option -system_id */ +int Xorriso_option_system_id(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->system_id), + "-system_id", 0) <= 0) + return(0); + strcpy(xorriso->system_id, name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Option -tell_media_space */ +int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag) +{ + int ret, free_space= 0, media_space= 0; + + ret= Xorriso_tell_media_space(xorriso, &media_space, &free_space, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "Cannot -tell_media_space"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + if(free_space<0) { + sprintf(xorriso->info_text, + "Pending image size larger than free space on medium"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + sprintf(xorriso->result_line, "Media space : %ds\n", media_space); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, "After commit : %ds\n", free_space); + Xorriso_result(xorriso, 0); + return(1); +} + + +/* Option -temp_mem_limit */ +int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size, + int flag) +{ + double num; + + num= Scanf_io_size(size, 0); + if(num < 64.0 * 1024.0 || num > 1024.0 * 1024.0 * 1024.0) { + sprintf(xorriso->info_text, + "-temp_mem_limit: wrong size %.f (allowed: %.f - %.f)", + num, 64.0 * 1024.0, 1024.0 * 1024.0 * 1024.0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->temp_mem_limit= num; + return(1); +} + + +/* Option -toc */ +int Xorriso_option_toc(struct XorrisO *xorriso, int flag) +{ + int ret, in_ret= 1000; + + if(strcmp(xorriso->indev,xorriso->outdev)==0) + ret= Xorriso_toc(xorriso, 0); + else { + if(xorriso->indev[0]!=0) + in_ret= Xorriso_toc(xorriso, 0); + if(xorriso->indev[0]!=0 && xorriso->outdev[0]!=0) { + strcpy(xorriso->result_line, "-------------: ---------------------------------------------------------------\n"); + Xorriso_result(xorriso,0); + } + ret= 1; + if(xorriso->outdev[0]!=0) + ret= Xorriso_toc(xorriso, 2); + if(in_ret<ret) + ret= in_ret; + } + return(ret); +} + + +/* Option -uid */ +int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag) +{ + int ret; + + xorriso->do_global_uid= 0; + if(uid[0]==0 || strcmp(uid,"-")==0) + return(1); + ret= Xorriso_convert_uidstring(xorriso, uid, &(xorriso->global_uid), 0); + if(ret>0) + xorriso->do_global_uid= 1; + return(ret); +} + + +/* Options -update and -update_r + @param flag bit0= issue start and summary message + bit1= do not reset pacifier, no final pacifier message + bit2= do not issue pacifier messages at all + bit3= recursive: -update_r + bit4= do not establish and dispose xorriso->di_array + bit5= do not delete files which are not found under + disk_path, but rather mark visited files and mark + files which were found. +*/ +int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag) +{ + int ret, mem_pci, zero= 0, result, uret, follow_links, do_register= 0; + int not_in_iso= 0, not_on_disk= 0; + double mem_lut= 0.0, start_time; + char *ipth, *argv[6]; + char *eff_origin= NULL, *eff_dest= NULL; + struct stat stbuf; + + Xorriso_alloc_meM(eff_origin, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + + start_time= Sfile_microtime(0); + + ipth= iso_path; + if(ipth[0]==0) + ipth= disk_path; + if(disk_path[0]==0) { + sprintf(xorriso->info_text, "-update: Empty disk_path given"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + {ret= 0; goto ex;} + } + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin, + 2|4|8); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2|8); + if(ret<=0) + goto ex; + + if(!(flag&2)) { + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + } + mem_pci= xorriso->pacifier_interval; + xorriso->pacifier_interval= 5.0; + + if(flag&1) { + sprintf(xorriso->info_text, "Updating "); + Text_shellsafe(eff_origin, xorriso->info_text, 1); + strcat(xorriso->info_text, " to "); + Text_shellsafe(eff_dest, xorriso->info_text, 1 | 2); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso,0); + } + if(xorriso->disk_excl_mode&8) + ret= Xorriso_path_is_excluded(xorriso, eff_origin, 1); + else + ret= 0; + if(ret!=0) + goto report_outcome; + + if(!(xorriso->ino_behavior & 2)) { + if(!(xorriso->di_array != NULL || (flag & 16))) { + /* Create all-image node array sorted by isofs.di */ + ret= Xorriso_make_di_array(xorriso, 0); + if(ret <= 0) + goto ex; + } + if(xorriso->di_array != NULL) { + do_register= 1; + if(!(flag & 8)) { + /* If directory with -update : do not register di_*_paths */ + ret= lstat(eff_origin, &stbuf); + if(ret != -1) + if(S_ISDIR(stbuf.st_mode)) + do_register= 0; + } + } + } + + if(flag&8) { + xorriso->find_compare_result= 1; + ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0); + if(ret >= 0) { + argv[0]= eff_dest; + argv[1]= "-exec"; + if(flag & 32) + argv[2]= "update_merge"; + else + argv[2]= "update"; + argv[3]= eff_origin; + zero= 0; + ret= Xorriso_option_find(xorriso, 4, argv, &zero, + 2 | (8 * !((xorriso->do_aaip & 96) == 96))); /* -findi */ + } else if(ret==-2) { /* severe error (e.g. lack of image) */ + ret= -1; + goto report_outcome; + } else { + not_in_iso= 1; + ret= 1; + } + if(ret>0) { + ret= lstat(eff_origin, &stbuf); + if(ret != -1) { + argv[0]= eff_origin; + argv[1]= "-exec"; + argv[2]= "add_missing"; + argv[3]= eff_dest; + zero= 0; + ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */ + if(ret>0 && (!xorriso->do_follow_mount) && !(flag & 32)) { + + /* >>> ??? what about mount points with (flag & 32) ? + empty_iso_dir shall delete those which already existed + and are freshly excluded. (E.g. by mounting at a non-empty + directory, or by new follow rules.) + This deletion does not match the idea of merging. + For determining the foreign files in a directory which is + target of a mount point, one would have to enter that mount + point directory. Somewhat contrary to do-not-follow. + */ + + argv[0]= eff_origin; + argv[1]= "-type"; + argv[2]= "m"; + argv[3]= "-exec"; + argv[4]= "empty_iso_dir"; + argv[5]= eff_dest; + zero= 0; + ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */ + } + if(ret>0) + ret= xorriso->find_compare_result; + else + ret= -1; + } else { + ret= xorriso->find_compare_result; + not_on_disk= 1; + } + } else + ret= -1; + if(not_on_disk && not_in_iso) { + sprintf(xorriso->info_text, "Missing on disk and in ISO: disk_path "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1); + ret= -1; + } + } else { + if(flag & 32) + xorriso->update_flags|= 1; /* Enter update_merge mode for node adding */ + /* compare ctime too, no filename reporting, eventually silent */ + follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) <<28; + ret= Xorriso_compare_2_files(xorriso, eff_origin, eff_dest, "", &result, + 2 | follow_links | ((flag&4)<<27) | (3<<30)); + if(ret == 0 || (ret > 0 && (flag & 32))) { + if(ret > 0) + result= 0; + uret= Xorriso_update_interpreter(xorriso, NULL, NULL, result, eff_origin, + eff_dest, (!!(flag & 32)) << 1); + if(uret<=0) + ret= -1; + if(uret==3) + ret= -1; + } + } + xorriso->pacifier_interval= mem_pci; + if(mem_lut!=xorriso->last_update_time && !(flag & (2 | 4))) + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 1); +report_outcome:; + if(ret>0) { + sprintf(xorriso->info_text, + "No file object needed update."); + do_register= 0; + } else if(ret==0) { + sprintf(xorriso->info_text, "Differences detected and updated."); + } else { + sprintf(xorriso->info_text, + "Not ok. Comparison or update failed due to error."); + do_register= 0; + } + + if(do_register) { + ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0); + if(ret < 0) + do_register= 0; + } + if(do_register) { + ret= Xorriso_lst_new(&(xorriso->di_disk_paths), eff_origin, + xorriso->di_disk_paths, 1); + if(ret <= 0) + goto ex; + ret= Xorriso_lst_new(&(xorriso->di_iso_paths), eff_dest, + xorriso->di_iso_paths, 1); + if(ret <= 0) + goto ex; + } + sprintf(xorriso->info_text+strlen(xorriso->info_text), + " (runtime %.1f s)\n", Sfile_microtime(0)-start_time); + if(flag&1) + Xorriso_info(xorriso,0); + +ex:; + Xorriso_free_meM(eff_origin); + Xorriso_free_meM(eff_dest); + if(ret < 0) + return(ret); + return(1); +} + + +/* Option -use_readline */ +int Xorriso_option_use_readline(struct XorrisO *xorriso, char *mode, int flag) +{ + if(strcmp(mode,"off")==0) + xorriso->use_stdin= 1; + else + xorriso->use_stdin= 0; + return(1); +} + + +/* Option -version */ +int Xorriso_option_version(struct XorrisO *xorriso, int flag) +{ + sprintf(xorriso->result_line, "%sxorriso %d.%d.%d%s\n", +#ifdef Xorriso_GNU_xorrisO + "GNU ", +#else + "", +#endif /* ! Xorriso_GNU_xorrisO */ + Xorriso_header_version_majoR, Xorriso_header_version_minoR, + Xorriso_header_version_micrO, Xorriso_program_patch_leveL); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, +"ISO 9660 Rock Ridge filesystem manipulator and CD/DVD/BD burn program\n"); + sprintf(xorriso->result_line+strlen(xorriso->result_line), +"Copyright (C) 2011, Thomas Schmitt <scdbackup@gmx.net>, libburnia project.\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, + "xorriso version : %d.%d.%d%s\n", + Xorriso_header_version_majoR, Xorriso_header_version_minoR, + Xorriso_header_version_micrO, Xorriso_program_patch_leveL); + sprintf(xorriso->result_line+strlen(xorriso->result_line), + "Version timestamp : %s\n",Xorriso_timestamP); + sprintf(xorriso->result_line+strlen(xorriso->result_line), + "Build timestamp : %s\n",Xorriso_build_timestamP); + Xorriso_result(xorriso, 0); + Xorriso_report_lib_versions(xorriso, 0); + +#ifdef Xorriso_GNU_xorrisO + sprintf(xorriso->result_line, +"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"); + Xorriso_result(xorriso, 0); + sprintf(xorriso->result_line, +"This is free software: you are free to change and redistribute it.\n"); + Xorriso_result(xorriso, 0); +#else + sprintf(xorriso->result_line, "Provided under GNU GPL version 2 or later.\n"); + Xorriso_result(xorriso, 0); +#endif /* ! Xorriso_GNU_xorrisO */ + + sprintf(xorriso->result_line, +"There is NO WARRANTY, to the extent permitted by law.\n"); + Xorriso_result(xorriso, 0); + return(1); +} + + +/* Option -volid */ +/* @param flag bit0= do not warn of problematic volid +*/ +int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag) +{ + int warn_shell= 0, warn_ecma= 0, i, ret; + static char shell_chars[]= { + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-+=:.,~@"}; + static char ecma_chars[]= {"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"}; + + for(i=0; volid[i]!=0; i++) { + if(strchr(shell_chars, volid[i])==NULL) + warn_shell= 1; + if(strchr(ecma_chars, volid[i])==NULL) + warn_ecma= 1; + } + if(i>32) { + sprintf(xorriso->info_text, "-volid: Text too long (%d > 32)", i); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(warn_shell && !(flag & 1)) { + sprintf(xorriso->info_text, + "-volid text problematic as automatic mount point name"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + if(xorriso->do_joliet && strlen(volid)>16 && !(flag & 1)) { + sprintf(xorriso->info_text, + "-volid text is too long for Joliet (%d > 16)",(int) strlen(volid)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + if(warn_ecma && !(flag & 1)) { + sprintf(xorriso->info_text, + "-volid text does not comply to ISO 9660 / ECMA 119 rules"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + strcpy(xorriso->volid, volid); + ret= Xorriso_set_volid(xorriso, volid, 0); + if(ret<=0) + return(ret); + xorriso->volid_default= (strcmp(xorriso->volid, "ISOIMAGE")==0 || + xorriso->volid[0]==0); + return(1); +} + + +/* Option -volset_id */ +int Xorriso_option_volset_id(struct XorrisO *xorriso, char *name, int flag) +{ + if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->volset_id), + "-volset_id", 0) <= 0) + return(0); + strcpy(xorriso->volset_id, name); + Xorriso_set_change_pending(xorriso, 1); + return(1); +} + + +/* Option -volume_date */ +int Xorriso_option_volume_date(struct XorrisO *xorriso, + char *time_type, char *timestring, int flag) +{ + int ret, t_type= 0; + time_t t; + struct tm erg; + + if(timestring[0] == 0 || strcmp(timestring, "default") == 0 || + strcmp(timestring, "overridden") == 0 ){ + t= 0; + } else if(strcmp(time_type, "uuid") == 0) { + t= time(NULL); /* Just to have some that is not 0 */ + } else { + ret= Xorriso_convert_datestring(xorriso, "-volume_date", + "m", timestring, &t_type, &t, 0); + if(ret<=0) + goto ex; + } + if(strcmp(time_type, "uuid") == 0) { + if(t == 0) { + xorriso->vol_uuid[0]= 0; + ret= 1; goto ex; + } + ret= Decode_ecma119_format(&erg, timestring, 0); + if(ret <= 0) { + sprintf(xorriso->info_text, "-volume_date uuid : Not an ECMA-119 time string. (16 decimal digits, range 1970... to 2999...)"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + strcpy(xorriso->vol_uuid, timestring); + if(erg.tm_year < 138) { + sprintf(xorriso->info_text, + "Understanding ECMA-119 timestring '%s' as: %s", + timestring, asctime(&erg)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + + } else if(strcmp(time_type, "c") == 0) { + xorriso->vol_creation_time= t; + } else if(strcmp(time_type, "m") == 0) { + xorriso->vol_modification_time= t; + } else if(strcmp(time_type, "x") == 0) { + xorriso->vol_expiration_time= t; + } else if(strcmp(time_type, "f") == 0) { + xorriso->vol_effective_time= t; + } else { + + /* >>> unknown time type */; + + ret= 0; goto ex; + } + ret= 1; +ex:; + return(ret); +} + + +/* Option -xattr "on"|"off" */ +int Xorriso_option_xattr(struct XorrisO *xorriso, char *mode, int flag) +{ + int ret; + + if(strcmp(mode, "off")==0) + xorriso->do_aaip&= ~12; + else if(strcmp(mode, "on")==0) + xorriso->do_aaip|= (4 | 8); + else { + sprintf(xorriso->info_text, "-xattr: unknown mode '%s'", mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + ret= Xorriso_set_ignore_aclea(xorriso, 0); + if(ret <= 0) + return(ret); + return(1); +} + + +/* Option -zisofs */ +int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag) +{ + int was_level, was_blocksize, ret, l; + double num; + char *cpt, *npt, text[16]; + + was_level= xorriso->zlib_level; + was_blocksize= xorriso->zisofs_block_size; + npt= cpt= mode; + for(cpt= mode; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l==0) + goto unknown_mode; + + if(strncmp(cpt, "level=", 6) == 0) { + sscanf(cpt + 6, "%lf", &num); + if(num < 0 || num > 9) { + sprintf(xorriso->info_text, + "-zisofs: Wrong zlib compression level '%s' (allowed 0...9)", + cpt + 6); + goto sorry_ex; + } + xorriso->zlib_level= num; + + } else if(strncmp(cpt, "ziso_used=", 10) == 0 || + strncmp(cpt, "osiz_used=", 10) == 0) { + /* (ignored info from -status) */; + + } else if(strncmp(cpt, "block_size=", 11)==0) { + num= 0.0; + if(l > 11 && l < 27) { + strncpy(text, cpt + 11, l - 11); + text[l - 11]= 0; + num= Scanf_io_size(text, 0); + } + if (num != (1 << 15) && num != (1 << 16) && num != (1 << 17)) { + sprintf(xorriso->info_text, + "-zisofs: Unsupported block size (allowed 32k, 64k, 128k)"); + goto sorry_ex; + } + xorriso->zisofs_block_size= num; + + } else if(strncmp(cpt, "by_magic=", 8)==0) { + if(strncmp(cpt + 9, "on", l - 9) == 0) + xorriso->zisofs_by_magic= 1; + else + xorriso->zisofs_by_magic= 0; + + } else if(strncmp(cpt, "default", l)==0) { + xorriso->zlib_level= xorriso->zlib_level_default; + xorriso->zisofs_block_size= xorriso->zisofs_block_size_default; + xorriso->zisofs_by_magic= 0; + + } else { +unknown_mode:; + if(l<SfileadrL) + sprintf(xorriso->info_text, "-zisofs: unknown mode '%s'", cpt); + else + sprintf(xorriso->info_text, "-zisofs: oversized mode parameter (%d)",l); +sorry_ex: + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->zlib_level= was_level; + xorriso->zisofs_block_size= was_blocksize; + return(0); + } + } + ret= Xorriso_set_zisofs_params(xorriso, 0); + return(ret); +} + + diff --git a/libisoburn/branches/1.1.8/xorriso/parse_exec.c b/libisoburn/branches/1.1.8/xorriso/parse_exec.c new file mode 100644 index 00000000..cac25df0 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/parse_exec.c @@ -0,0 +1,2416 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of functions which deal with parsing + and interpretation of command input. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <fcntl.h> +#include <errno.h> +#include <pwd.h> +#include <grp.h> +#include <sys/resource.h> +#include <sys/wait.h> + + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +/* @param flag bit0= do not warn of wildcards + bit1= these are disk_paths +*/ +int Xorriso_end_idx(struct XorrisO *xorriso, + int argc, char **argv, int idx, int flag) +{ + int i, warned= 0; + + for(i= idx; i<argc; i++) { + if(strcmp(argv[i], xorriso->list_delimiter)==0) + break; + if(!((flag&1) || warned)) + warned= Xorriso_warn_of_wildcards(xorriso, argv[i], flag&2); + } + return(i); +} + + +/* Returns a vector of strings which belong to an open ended arg list. + If expansion is enabled, the vector might be allocated, else it is + a pointer into the argv input vector. + Thus the release of that memory is an expert task to be done by this + function only. Use bit8 for that. With bit8 parameter argc MUST be the + same value as with the call which might have allocated memory. + @param xorriso The environment object + @param argc Length of argv + @param argv The vector with arguments, eventual list_delimiter ("--") + and then eventual unrelated words + @param idx Start index in argv of the argument list + @param optc Length of the effective possibly expanded option vector + @param optv The option vector. Maybe a pointer into argv or maybe + an own allocated vector. + @param flag bit0= do not warn of wildcards + bit1= these are disk_paths + bit2= never expand wildcards + bit3= do not expand last argument + bit4= ignore last argument + bit5= demand exactly one match + bit6= with bit5 allow 0 matches if pattern is a constant + bit7= silently tolerate empty argument list + bit8= free the eventually allocated sub_vector + bit9= always expand wildcards +*/ +int Xorriso_opt_args(struct XorrisO *xorriso, char *cmd, + int argc, char **argv, int idx, + int *end_idx, int *optc, char ***optv, int flag) +{ + int i, do_expand, nump, was_empty= 0, filec= 0, ret; + char **filev= NULL, **patterns= NULL; + off_t mem= 0; + + if(flag&2) + do_expand= (xorriso->do_disk_pattern==1 && !(flag&4)) || (flag & 512); + else + do_expand= (xorriso->do_iso_rr_pattern==1 && !(flag&4)) || (flag & 512); + if(flag&256) { + if(*optv<argv || *optv>=argv+argc) + Sfile_destroy_argv(optc, optv, 0); + return(1); + } + if(idx>=argc) { + *end_idx= argc; + *optc= 0; + *optv= NULL; + sprintf(xorriso->info_text, "%s : Not enough arguments given", cmd); + if((flag & 128)) + return(1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + *end_idx= Xorriso_end_idx(xorriso, argc, argv, idx, + ((flag&1) || do_expand) | (flag&2)); + if(*end_idx<0) + return(*end_idx); + if((flag&16) && (*end_idx)>idx) + (*end_idx)--; + *optc= *end_idx - idx; + *optv= argv+idx; + if(*optc<=0 || !do_expand) + return(1); + patterns= calloc(*optc, sizeof(char *)); + if(patterns==NULL) { +no_memory:; + sprintf(xorriso->info_text, + "%s : Cannot allocate enough memory for pattern expansion", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + nump= 0; + if(flag&8) { + was_empty= 1; + mem+= strlen(argv[idx + *optc - 1])+1+sizeof(char *); + } + for(i= 0; i<*optc-!!(flag&8); i++) { + if(argv[i + idx][0]==0) { + was_empty++; + mem+= sizeof(char *); /* as upper limit for size of an empty string */ + continue; + } + patterns[nump++]= argv[i + idx]; + } + if(nump<=0) { /* Only empty texts. May the caller get happy with them. */ + free(patterns); + return(1); + } + if(flag&2) + ret= Xorriso_expand_disk_pattern(xorriso, nump, patterns, was_empty, + &filec, &filev, &mem, (flag>>5)&3); + else + ret= Xorriso_expand_pattern(xorriso, nump, patterns, was_empty, + &filec, &filev, &mem, (flag>>5)&3); + if(ret<=0) + {ret= 0; goto ex;} + for(i= 0; i<was_empty; i++) { + if(i==was_empty-1 && (flag&8)) + filev[filec++]= strdup(argv[idx + *optc - 1]); + else + filev[filec++]= strdup(""); + if(filev[filec-1]==NULL) + goto no_memory; + } + +#ifdef Xorriso_verbous_pattern_expansioN +{ int l; + sprintf(xorriso->info_text, "Pattern expansion yields %d items:", filec); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + l= 0; + xorriso->info_text[0]= 0; + for(i= 0; i<filec; i++) { + l= strlen(xorriso->info_text); + if(l>0 && l+1+strlen(filev[i])>60) { + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + xorriso->info_text[0]= 0; + l= 0; + } + sprintf(xorriso->info_text+l, " %s", filev[i]); + } + l= strlen(xorriso->info_text); + if(l>0) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); +} +#endif /* Xorriso_verbous_pattern_expansioN */ + + ret= 1; +ex:; + if(patterns!=NULL) + free((char *) patterns); + if(ret<=0) { + Sfile_destroy_argv(&filec, &filev, 0); + } else { + *optc= filec; + *optv= filev; + } + return(ret); +} + + +int Xorriso_get_problem_status(struct XorrisO *xorriso, char severity[80], + int flag) +{ + strcpy(severity, xorriso->problem_status_text); + return(xorriso->problem_status); +} + + +int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, + int flag) +{ + char *sev_text= "ALL"; + int sev, ret; + + if(severity[0]) + sev_text= severity; + ret= Xorriso__text_to_sev(sev_text, &sev, 0); + if(ret<=0) + return(0); + xorriso->problem_status= sev; + strcpy(xorriso->problem_status_text, sev_text); + if(sev > xorriso->eternal_problem_status) { + xorriso->eternal_problem_status= sev; + strcpy(xorriso->eternal_problem_status_text, sev_text); + } + return(1); +} + + +/** + @param flag bit0= do not issue own event messages + bit1= take xorriso->request_to_abort as reason for abort + @return Gives the advice: + 2= pardon was given, go on + 1= no problem, go on + 0= function failed but xorriso would not abort, go on + <0= do abort + -1 = due to problem_status + -2 = due to xorriso->request_to_abort +*/ +int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag) +{ + static int sev= 0; + if(sev==0) + Xorriso__text_to_sev("SORRY", &sev, 0); + + if((flag&2) && xorriso->request_to_abort) + return(-2); + + Xorriso_process_msg_queues(xorriso, 0); + if(ret>0 && xorriso->problem_status <= 0) + return(1); + + if(xorriso->problem_status < xorriso->abort_on_severity && + xorriso->problem_status > 0) { + if(xorriso->problem_status >= sev && !(flag&1)) { + sprintf(xorriso->info_text, + "xorriso : NOTE : Tolerated problem event of severity '%s'\n", + xorriso->problem_status_text); + Xorriso_info(xorriso, 0);/* submit not as problem event */ + } + ret= 2; + } else if(xorriso->problem_status > 0) { + sprintf(xorriso->info_text, + "xorriso : aborting : -abort_on '%s' encountered '%s'\n", + xorriso->abort_on_text, xorriso->problem_status_text); + if(!(flag&1)) + Xorriso_info(xorriso, 0);/* submit not as problem event */ + ret= -1; + } else if(ret>0) + ret= 1; + else + ret= 2; + return(ret); +} + + +/* @param flag bit0= a non-existing target of multiple sources is a directory + bit1= all paths except the last one are disk_paths + bit2= the last path is a disk_path + @return <=0 is error, 1= leaf file object, 2= directory +*/ +int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd, + int argc, char **argv, int *idx, + int *optc, char ***optv, char eff_dest[SfileadrL], + int flag) +{ + int destc= 0, is_dir=0, end_idx, ret, i; + char **destv= NULL; + + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, + (xorriso->do_iso_rr_pattern==1)|(flag&2)); + if(end_idx - *idx < 2) { + sprintf(xorriso->info_text, "%s: not enough arguments", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + + ret= Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, optc, optv, + (flag&2)|16); /* ignore last argument */ + if(ret<=0) + goto ex; + /* demand one match, or 0 with a constant */ + ret= Xorriso_opt_args(xorriso, cmd, argc, argv, end_idx, &end_idx, &destc, + &destv, ((flag&4)>>1) | 32 | 64); + if(ret<=0) + goto ex; + + /* Evaluate target address */ + if(flag&4) + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, destv[0], eff_dest, + 2|4|16); + else + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, destv[0], eff_dest, + 1); + if(ret<0) + {ret= 0; goto ex;} + if(ret==2 || ((flag&1) && *optc > 1 && ret==0)) { + is_dir= 1; + } else if(*optc > 1) { + if(flag & 2) + for(i= 0; i<*optc; i++) + Xorriso_msgs_submit(xorriso, 0, (*optv)[i], 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "%s: more than one origin given, destination is a non-directory: ", + cmd); + Text_shellsafe(destv[0], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(ret==0) { /* compute complete eff_dest */ + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, destv[0], eff_dest, + 2 | (flag&4)); + if(ret<0) + {ret= 0; goto ex;} + } + + ret= 1+is_dir; +ex:; + Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &destc, &destv, + 256); + (*idx)= end_idx; + return(ret); +} + + +/* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high +*/ +int Xorriso_decode_load_adr(struct XorrisO *xorriso, char *cmd, + char *adr_mode, char *adr_value, + int *entity_code, char entity_id[81], + int flag) +{ + double num; + int l; + + if(strcmp(adr_mode, "auto")==0) + *entity_code= 0; + else if(strcmp(adr_mode, "session")==0) + *entity_code= 1; + else if(strcmp(adr_mode, "track")==0) + *entity_code= 2; + else if(strcmp(adr_mode, "lba")==0 || strcmp(adr_mode, "sbsector")==0) + *entity_code= 3 | ((flag&1) << 16); + else if(strcmp(adr_mode, "volid")==0) + *entity_code= 4; + else { + sprintf(xorriso->info_text, "%s: unknown address mode '%s'", cmd, adr_mode); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + l= strlen(adr_value); + if(l==0) + *entity_code= 0; + + if(*entity_code>=1 && *entity_code<= 3) { + num= Scanf_io_size(adr_value, 0); + if(*entity_code==3 && + (adr_value[l-1]<'0' || adr_value[l-1]>'9')) + num/= 2048.0; + sprintf(entity_id, "%.f", num); + } else { + if(strlen(adr_value)>80) { + sprintf(xorriso->info_text, "%s: address value too long (80 < %d)", + cmd, (int) strlen(adr_value)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + strcpy(entity_id, adr_value); + } + return(1); +} + + +int Xorriso_check_name_len(struct XorrisO *xorriso, char *name, int size, + char *cmd, int flag) +{ + if((int) strlen(name) >= size) { + sprintf(xorriso->info_text, + "Name too long with option %s (%d > %d)", cmd, + (int) strlen(name), size - 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + return(1); +} + + + +/* @return <0 error , >=0 number of skipped dashes +*/ +int Xorriso_normalize_command(struct XorrisO *xorriso, char *original_cmd, + int argno, char *cmd_data, int sizeof_cmd_data, + char **cmd, int flag) +{ + int was_dashed= 0; + char *dash_pt; + + if((int) strlen(original_cmd) >= sizeof_cmd_data) { + if(argno>=0) + sprintf(xorriso->info_text, "Oversized argument #%d (length %d)\n", + argno, (int) strlen(original_cmd)); + else + sprintf(xorriso->info_text, "Oversized option (length %d)\n", + (int) strlen(original_cmd)); + return(-1); + } + strcpy(cmd_data, original_cmd); + *cmd= cmd_data; + if(strcmp(*cmd, xorriso->list_delimiter)==0) + return(1); + while((*cmd)[0]=='-') { + if((*cmd)[1]==0) + break; + was_dashed++; + (*cmd)++; + } + for(dash_pt= *cmd; *dash_pt!=0; dash_pt++) + if(*dash_pt=='-') + *dash_pt= '_'; + return(was_dashed); +} + + +/* @param flag bit0= do not warn of unknown option + @return <=0 error, + 1=count is valid, 2=dashed unknown, 3=undashed unknown +*/ +int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, + int *count, int flag) +{ + int ret, was_dashed= 0, i, cmd_data_size= 2 * SfileadrL; + char *cmd, *cmd_data= NULL; + static char arg0_commands[][40]= { + "ban_stdio_write","close_filter_list","commit", + "device_links","devices","end", + "for_backup", "help", + "list_formats","list_speeds", + "no_rc","print_size","pvd_info","pwd","pwdi","pwdx", + "read_mkisofsrc","rollback","rollback_end", + "tell_media_space","toc","version", + "" + }; + static char arg1_commands[][40]= { + "abort_on","acl","add_plainly","application_id","auto_charset", + "abstract_file", + "backslash_codes","blank","biblio_file", + "calm_drive","cd","cdi","cdx","charset","close","close_damaged", + "commit_eject","compliance","copyright_file", + "dev","dialog","disk_dev_ino","disk_pattern","displacement", + "dummy","dvd_obs","early_stdio_test", "eject", + "iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks", + "history","indev","in_charset","joliet", + "list_delimiter","list_extras","list_profiles","local_charset", + "mark","md5","mount_opts","not_leaf","not_list","not_mgt", + "options_from_file","osirrox","outdev","out_charset","overwrite", + "pacifier","padding","path_list","pathspecs","pkt_output", + "preparer_id","print","print_info","print_mark","prompt", + "prog","prog_help","publisher","quoted_not_list","quoted_path_list", + "reassure","report_about","rom_toc_scan","scsi_log", + "session_log","signal_handling","sleep", + "speed","split_size","status","status_history_max", + "stdio_sync","stream_recording","system_id","temp_mem_limit", + "uid","unregister_filter","use_readline","volid","volset_id", + "xattr","zisofs", + "" + }; + static char arg2_commands[][40]= { + "assert_volid","boot_image","clone","compare","compare_r","drive_class", + "errfile_log","error_behavior","extract","extract_single", + "jigdo","load","logfile", + "map","map_single","page","return_with", + "scdbackup_tag","update","update_r","volume_date", + "" + }; + static char arg3_commands[][40]= { + "append_partition", + "" + }; + static char arg4_commands[][40]= { + "cut_out","extract_cut","mount","mount_cmd","paste_in","session_string", + "" + }; + static char argn_commands[][40]= { + "add","alter_date","alter_date_r","as", + "check_md5","check_md5_r","check_media","check_media_defaults", + "chgrp","chgrpi","chgrp_r","chgrp_ri","chmod","chmodi", + "chmod_r","chmod_ri","chown","chowni","chown_r","chown_ri", + "compare_l","cp_clone","cp_rax","cp_rx","cpr","cpri", "cpax","cpx", + "du","dui","dus","dusi","dux","dusx","external_filter","extract_l", + "file_size_limit","find","findi","finds","findx", + "getfacl","getfacli","getfacl_r","getfacl_ri", + "getfattr","getfattri","getfattr_r","getfattr_ri","hide", + "ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli", + "lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri", + "not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l", + "setfacl","setfacli","setfacl_list","setfacl_listi", + "setfacl_r","setfacl_ri","setfattr","setfattri", + "setfattr_list","setfattr_listi","setfattr_r","setfattr_ri", + "set_filter","set_filter_r","show_stream","show_stream_r", + "" + }; + + Xorriso_alloc_meM(cmd_data, char, cmd_data_size); + + *count= 0; + if(argc<=0) + {ret= -1; goto ex;} + ret= Xorriso_normalize_command(xorriso, argv[0], -1, + cmd_data, cmd_data_size, &cmd, 0); + if(ret<0) + goto ex; + was_dashed= (ret>0); + if(cmd[0]=='#' || cmd[0]==0 || strcmp(cmd, xorriso->list_delimiter) == 0) { + /* ignore: comment line , empty option , orphaned list delimiter */ + {ret= 1; goto ex;} + } + for(i=0; arg0_commands[i][0]!=0; i++) + if(strcmp(arg0_commands[i], cmd)==0) + {ret= 1; goto ex;} + *count= 1; + for(i=0; arg1_commands[i][0]!=0; i++) + if(strcmp(arg1_commands[i], cmd)==0) + {ret= 1; goto ex;} + *count= 2; + for(i=0; arg2_commands[i][0]!=0; i++) + if(strcmp(arg2_commands[i], cmd)==0) + {ret= 1; goto ex;} + *count= 3; + for(i=0; arg3_commands[i][0]!=0; i++) + if(strcmp(arg3_commands[i], cmd)==0) + {ret= 1; goto ex;} + *count= 4; + for(i=0; arg4_commands[i][0]!=0; i++) + if(strcmp(arg4_commands[i], cmd)==0) + {ret= 1; goto ex;} + *count= 0; + for(i=0; argn_commands[i][0]!=0; i++) + if(strcmp(argn_commands[i], cmd)==0) { + ret= Xorriso_end_idx(xorriso, argc, argv, 1, 1); + if(ret<1) + goto ex; + *count= ret-1; + {ret= 1; goto ex;} + } + + if(!(flag&1)) { + sprintf(xorriso->info_text, "Unknown option : '%s'", argv[0]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + + ret= 2 + !was_dashed; +ex: + Xorriso_free_meM(cmd_data); + return(ret); +} + + +/* @param flag bit0= recursion + bit1= these are command line arguments + (for xorriso->argument_emulation) +*/ +int Xorriso_interpreter(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) +/* +return: + <=0 error , 1 = success , 2 = problem event ignored , 3 = end program run +*/ +{ + int ret, was_dashed, end_ret, num1, num2, cmd_data_size= 2 * SfileadrL; + int mem_idx, arg_count, i; + char *cmd, *original_cmd, *cmd_data= NULL, *arg1, *arg2; + + Xorriso_alloc_meM(cmd_data, char, cmd_data_size); + + if(xorriso==NULL) + {ret= 0; goto ex;} + if(xorriso->is_dialog) { + xorriso->result_line_counter= xorriso->result_page_counter= 0; + if(xorriso->result_page_length<0) + xorriso->result_page_length= -xorriso->result_page_length; + } + +next_command:; + if(flag&2) { + ret= 1; + if(xorriso->argument_emulation==1) + ret= Xorriso_as_genisofs(xorriso, argc, argv, idx, 0); + else if(xorriso->argument_emulation==2) + ret= Xorriso_as_cdrskin(xorriso, argc, argv, idx, 0); + if(xorriso->argument_emulation>0) { + xorriso->argument_emulation= 0; + if(ret<=0) + goto eval_any_problems; + if((*idx)>=argc) + {ret= 1; goto ex;} + } + } + + ret= Xorriso_count_args(xorriso, argc - *idx, argv + *idx, &arg_count, 1); + if((ret == 1 || ret == 2) && + strcmp(argv[*idx], xorriso->list_delimiter) != 0) { + sprintf(xorriso->info_text, "Command: %s", argv[*idx]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + for(i= 1; i <= arg_count && *idx + i < argc; i++) { + sprintf(xorriso->info_text, "Argument: %s", argv[*idx + i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + if(*idx + arg_count >= argc) { + sprintf(xorriso->info_text, "Missing arguments: %d", + *idx + arg_count + 1 - argc); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + } + + xorriso->prepended_wd= 0; + xorriso->request_to_abort= xorriso->request_not_to_ask= 0; + Xorriso_set_problem_status(xorriso, "", 0); + if((*idx)<argc) + original_cmd= cmd= argv[*idx]; + else + original_cmd= cmd= ""; + if(xorriso->add_plainly==3 && cmd[0] && !xorriso->is_dialog) { + (*idx)++; + goto add_plain_argument; + } + was_dashed= 0; + ret= Xorriso_normalize_command(xorriso, original_cmd, -1, + cmd_data, cmd_data_size, &cmd, 0); + if(ret<0) + goto eval_any_problems; + was_dashed= ret; + + (*idx)++; + if((*idx)<argc) + arg1= argv[(*idx)]; + else + arg1= ""; + if((*idx)+1<argc) + arg2= argv[(*idx)+1]; + else + arg2= ""; + + ret= 1; + if(cmd[0]=='#' || cmd[0]==0) { + /* ignore comment line and empty option */; + + } else if(strcmp(cmd,"abort_on")==0) { + (*idx)++; + ret= Xorriso_option_abort_on(xorriso, arg1, 0); + + } else if(strcmp(cmd,"abstract_file")==0) { + (*idx)++; + Xorriso_option_abstract_file(xorriso, arg1, 0); + + } else if(strcmp(cmd,"acl")==0) { + (*idx)++; + ret= Xorriso_option_acl(xorriso, arg1, 0); + + } else if(strcmp(cmd,"add")==0) { + ret= Xorriso_option_add(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"add_plainly")==0) { + (*idx)++; + ret= Xorriso_option_add_plainly(xorriso, arg1, 0); + + } else if(strcmp(cmd,"alter_date")==0 || strcmp(cmd,"alter_date_r")==0) { + (*idx)+= 2; + ret= Xorriso_option_alter_date(xorriso, arg1, arg2, argc, argv, idx, + strlen(cmd)>10); + + } else if(strcmp(cmd,"append_partition")==0) { + (*idx)+= 3; + ret= Xorriso_option_append_partition(xorriso, arg1, arg2, argv[*idx - 1], + 0); + + } else if(strcmp(cmd,"application_id")==0) { + (*idx)++; + ret= Xorriso_option_application_id(xorriso, arg1, 0); + + } else if(strcmp(cmd,"as")==0) { + ret= Xorriso_option_as(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"assert_volid")==0) { + (*idx)+= 2; + ret= Xorriso_option_assert_volid(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"auto_charset")==0) { + (*idx)++; + ret= Xorriso_option_auto_charset(xorriso, arg1, 0); + + } else if(strcmp(cmd,"backslash_codes")==0) { + (*idx)++; + ret= Xorriso_option_backslash_codes(xorriso, arg1, 0); + + } else if(strcmp(cmd,"ban_stdio_write")==0) { + ret= Xorriso_option_ban_stdio_write(xorriso, 0); + + } else if(strcmp(cmd,"biblio_file")==0) { + (*idx)++; + Xorriso_option_biblio_file(xorriso, arg1, 0); + + } else if(strcmp(cmd,"blank")==0) { + (*idx)++; + ret= Xorriso_option_blank(xorriso, arg1, 0); + + } else if(strcmp(cmd,"boot_image")==0) { + (*idx)+= 2; + ret= Xorriso_option_boot_image(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"calm_drive")==0) { + (*idx)++; + ret= Xorriso_option_calm_drive(xorriso, arg1, 0); + + } else if(strcmp(cmd,"cd")==0 || strcmp(cmd,"cdi")==0) { + (*idx)++; + ret= Xorriso_option_cdi(xorriso, arg1, 0); + + } else if(strcmp(cmd,"cdx")==0) { + (*idx)++; + ret= Xorriso_option_cdx(xorriso, arg1, 0); + + } else if(strcmp(cmd,"charset")==0) { + (*idx)++; + ret= Xorriso_option_charset(xorriso, arg1, 3); + + } else if(strcmp(cmd,"check_md5")==0) { + ret= Xorriso_option_check_md5(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"check_md5_r")==0) { + ret= Xorriso_option_check_md5(xorriso, argc, argv, idx, 8); + + } else if(strcmp(cmd,"check_media")==0) { + ret= Xorriso_option_check_media(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"check_media_defaults")==0) { + ret= Xorriso_option_check_media_defaults(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"chgrp")==0 || strcmp(cmd,"chgrpi")==0) { + (*idx)+= 1; + ret= Xorriso_option_chgrpi(xorriso, arg1, argc, argv, idx, 0); + + } else if(strcmp(cmd,"chgrp_r")==0 || strcmp(cmd,"chgrp_ri")==0) { + (*idx)+= 1; + ret= Xorriso_option_chgrpi(xorriso, arg1, argc, argv, idx, 1); + + } else if(strcmp(cmd,"chmod")==0 || strcmp(cmd,"chmodi")==0) { + (*idx)+= 1; + ret= Xorriso_option_chmodi(xorriso, arg1, argc, argv, idx, 0); + + } else if(strcmp(cmd,"chmod_r")==0 || strcmp(cmd,"chmod_ri")==0) { + (*idx)+= 1; + ret= Xorriso_option_chmodi(xorriso, arg1, argc, argv, idx, 1); + + } else if(strcmp(cmd,"chown_r")==0 || strcmp(cmd,"chown_ri")==0) { + (*idx)+= 1; + ret= Xorriso_option_chowni(xorriso, arg1, argc, argv, idx, 1); + + } else if(strcmp(cmd,"chown")==0 || strcmp(cmd,"chowni")==0) { + (*idx)+= 1; + ret= Xorriso_option_chowni(xorriso, arg1, argc, argv, idx, 0); + + } else if(strcmp(cmd,"clone")==0) { + (*idx)+= 2; + ret= Xorriso_option_clone(xorriso, arg1, arg2, 1); + + } else if(strcmp(cmd,"close")==0) { + (*idx)++; + ret= Xorriso_option_close(xorriso, arg1, 0); + + } else if(strcmp(cmd,"close_damaged")==0) { + (*idx)++; + ret= Xorriso_option_close_damaged(xorriso, arg1, 0); + + } else if(strcmp(cmd,"close_filter_list")==0) { + ret= Xorriso_option_close_filter_list(xorriso, 0); + + } else if(strcmp(cmd,"commit")==0) { + ret= Xorriso_option_commit(xorriso, 0); + + } else if(strcmp(cmd,"commit_eject")==0) { + (*idx)++; + ret= Xorriso_option_commit_eject(xorriso, arg1, 0); + + } else if(strcmp(cmd,"compare")==0) { + (*idx)+= 2; + ret= Xorriso_option_compare(xorriso, arg1, arg2, 1); + + } else if(strcmp(cmd,"compare_l")==0) { + ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 1<<8); + + } else if(strcmp(cmd,"compare_r")==0) { + (*idx)+= 2; + ret= Xorriso_option_compare(xorriso, arg1, arg2, 1|8); + + } else if(strcmp(cmd,"compliance")==0) { + (*idx)++; + Xorriso_option_compliance(xorriso, arg1, 0); + + } else if(strcmp(cmd,"copyright_file")==0) { + (*idx)++; + Xorriso_option_copyright_file(xorriso, arg1, 0); + + } else if(strcmp(cmd,"cp_clone") == 0) { + ret= Xorriso_option_cp_clone(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"cp_rx")==0 || strcmp(cmd,"cp_rax")==0) { + ret= Xorriso_option_cpx(xorriso, argc, argv, idx, + 1|((strcmp(cmd,"cp_rax")==0)<<1)); + + } else if(strcmp(cmd,"cpr")==0 || strcmp(cmd,"cpri")==0) { + ret= Xorriso_option_cpri(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"cpx")==0 || strcmp(cmd,"cpax")==0) { + ret= Xorriso_option_cpx(xorriso, argc, argv, idx, + (strcmp(cmd,"cpax")==0)<<1); + + } else if(strcmp(cmd,"cut_out")==0) { + (*idx)+= 4; + if((*idx)>argc) { + sprintf(xorriso->info_text, + "-cut_out: Not enough arguments. Needed are: disk_path start count so_rr_path"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; + } else + ret= Xorriso_option_cut_out(xorriso, arg1, arg2, + argv[(*idx)-2], argv[(*idx)-1], 0); + + } else if(strcmp(cmd,"dev")==0) { + (*idx)++; + ret= Xorriso_option_dev(xorriso, arg1, 3); + + } else if(strcmp(cmd,"device_links")==0) { + ret= Xorriso_option_devices(xorriso, 1); + + } else if(strcmp(cmd,"devices")==0) { + ret= Xorriso_option_devices(xorriso, 0); + + } else if(strcmp(cmd,"dialog")==0) { + (*idx)++; + ret= Xorriso_option_dialog(xorriso, arg1, 0); + + } else if(strcmp(cmd,"disk_dev_ino")==0) { + (*idx)++; + ret= Xorriso_option_disk_dev_ino(xorriso, arg1, 0); + + } else if(strcmp(cmd,"displacement")==0) { + (*idx)++; + ret= Xorriso_option_displacement(xorriso, arg1, 0); + + } else if(strcmp(cmd,"disk_pattern")==0) { + (*idx)++; + ret= Xorriso_option_disk_pattern(xorriso, arg1, 0); + + } else if(strcmp(cmd,"drive_class")==0) { + (*idx)+= 2; + ret= Xorriso_option_drive_class(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"du")==0 || strcmp(cmd,"dui")==0 || + strcmp(cmd,"dus")==0 || strcmp(cmd,"dusi")==0) { + ret= Xorriso_option_lsi(xorriso, argc, argv, idx, (cmd[2]!='s')|4); + + } else if(strcmp(cmd,"dummy")==0) { + (*idx)++; + ret= Xorriso_option_dummy(xorriso, arg1, 0); + + } else if(strcmp(cmd,"dvd_obs")==0) { + (*idx)++; + ret= Xorriso_option_dvd_obs(xorriso, arg1, 0); + + } else if(strcmp(cmd,"dux")==0 || strcmp(cmd,"dusx")==0) { + ret= Xorriso_option_lsx(xorriso, argc, argv, idx, (cmd[2]!='s')|4); + + } else if(strcmp(cmd,"early_stdio_test")==0) { + (*idx)++; + ret= Xorriso_option_early_stdio_test(xorriso, arg1, 0); + + } else if(strcmp(cmd,"eject")==0) { + (*idx)++; + ret= Xorriso_option_eject(xorriso, arg1, 0); + + } else if(strcmp(cmd,"end")==0) { + end_ret= Xorriso_option_end(xorriso, 0); + ret= Xorriso_eval_problem_status(xorriso, ret, 0); + if(ret<0) + goto ex; + if(end_ret!=2) + {ret= 3; goto ex;} + + } else if(strcmp(cmd,"errfile_log")==0) { + (*idx)+= 2; + ret= Xorriso_option_errfile_log(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"error_behavior")==0) { + (*idx)+= 2; + ret= Xorriso_option_error_behavior(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"external_filter")==0) { + ret= Xorriso_option_external_filter(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"extract")==0) { + (*idx)+= 2; + ret= Xorriso_option_extract(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"extract_cut")==0) { + (*idx)+= 4; + if((*idx)>argc) { + sprintf(xorriso->info_text, + "-extract_cut: Not enough arguments. Needed are: disk_path start count so_rr_path"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; + } else + ret= Xorriso_option_extract_cut(xorriso, arg1, arg2, + argv[(*idx)-2], argv[(*idx)-1], 0); + + } else if(strcmp(cmd,"extract_l")==0) { + ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 3<<8); + + } else if(strcmp(cmd,"extract_single")==0) { + (*idx)+= 2; + ret= Xorriso_option_extract(xorriso, arg1, arg2, 32); + + } else if(strcmp(cmd,"file_size_limit")==0) { + ret= Xorriso_option_file_size_limit(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"find")==0 || strcmp(cmd,"findi")==0) { + ret= Xorriso_option_find(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"findx")==0) { + ret= Xorriso_option_find(xorriso, argc, argv, idx, 1); + + } else if(strcmp(cmd,"follow")==0) { + (*idx)++; + ret= Xorriso_option_follow(xorriso, arg1, 0); + + } else if(strcmp(cmd,"for_backup")==0) { + Xorriso_option_hardlinks(xorriso, "on", 0); + Xorriso_option_acl(xorriso, "on", 0); + Xorriso_option_xattr(xorriso, "on", 0); + Xorriso_option_md5(xorriso, "on", 0); + ret= 1; + + } else if(strcmp(cmd,"format")==0) { + (*idx)++; + ret= Xorriso_option_blank(xorriso, arg1, 1); + + } else if(strcmp(cmd,"fs")==0) { + (*idx)++; + ret= Xorriso_option_fs(xorriso, arg1, 0); + + } else if(strcmp(cmd,"getfacl")==0 || strcmp(cmd,"getfacli")==0) { + ret= Xorriso_option_getfacli(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"getfacl_r")==0 || strcmp(cmd,"getfacl_ri")==0) { + ret= Xorriso_option_getfacli(xorriso, argc, argv, idx, 1); + + } else if(strcmp(cmd,"getfattr")==0 || strcmp(cmd,"getfattri")==0) { + ret= Xorriso_option_getfacli(xorriso, argc, argv, idx, 2); + + } else if(strcmp(cmd,"getfattr_r")==0 || strcmp(cmd,"getfattr_ri")==0) { + ret= Xorriso_option_getfacli(xorriso, argc, argv, idx, 1 | 2); + + } else if(strcmp(cmd,"gid")==0) { + (*idx)++; + ret= Xorriso_option_gid(xorriso,arg1,0); + + } else if(strcmp(cmd,"grow_blindly")==0) { + (*idx)++; + ret= Xorriso_option_grow_blindly(xorriso,arg1,0); + + } else if(strcmp(cmd,"hardlinks")==0) { + (*idx)++; + ret= Xorriso_option_hardlinks(xorriso, arg1, 0); + + } else if(strcmp(cmd,"help")==0) { + Xorriso_option_help(xorriso,0); + + } else if(strcmp(cmd,"hide")==0) { + (*idx)+= 1; + ret= Xorriso_option_hide(xorriso, arg1, argc, argv, idx, 1); + + } else if(strcmp(cmd,"history")==0) { + /* add to readline history */ + (*idx)++; + ret= Xorriso_option_history(xorriso, arg1, 0); + + } else if(strcmp(cmd,"indev")==0) { + (*idx)++; + ret= Xorriso_option_dev(xorriso, arg1, 1); + + } else if(strcmp(cmd,"in_charset")==0) { + (*idx)++; + ret= Xorriso_option_charset(xorriso, arg1, 1); + + } else if(strcmp(cmd,"iso_rr_pattern")==0) { + (*idx)++; + ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0); + + } else if(strcmp(cmd,"jigdo")==0) { + (*idx)+= 2; + ret= Xorriso_option_jigdo(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"joliet")==0) { + (*idx)++; + ret= Xorriso_option_joliet(xorriso, arg1, 0); + + } else if(strcmp(cmd, "list_delimiter") == 0) { + (*idx)++; + ret= Xorriso_option_list_delimiter(xorriso, arg1, 0); + + } else if(strcmp(cmd, "list_extras") == 0) { + (*idx)++; + ret= Xorriso_option_list_extras(xorriso, arg1, 0); + + } else if(strcmp(cmd,"list_formats")==0) { + ret= Xorriso_option_list_formats(xorriso, 0); + + } else if(strcmp(cmd,"list_profiles")==0) { + (*idx)++; + ret= Xorriso_option_list_profiles(xorriso, arg1, 0); + + } else if(strcmp(cmd,"list_speeds")==0) { + ret= Xorriso_option_list_speeds(xorriso, 0); + + } else if(strcmp(cmd,"load")==0) { + (*idx)+= 2; + ret= Xorriso_option_load(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"local_charset")==0) { + (*idx)++; + ret= Xorriso_option_charset(xorriso, arg1, 4); + + } else if(strcmp(cmd,"logfile")==0) { + (*idx)+= 2; + ret= Xorriso_option_logfile(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"ls")==0 || strcmp(cmd,"lsi")==0 || + strcmp(cmd,"lsl")==0 || strcmp(cmd,"lsli")==0) { + ret= Xorriso_option_lsi(xorriso, argc, argv, idx, (cmd[2]=='l')); + + } else if(strcmp(cmd,"lsd")==0 || strcmp(cmd,"lsdi")==0 || + strcmp(cmd,"lsdl")==0 || strcmp(cmd,"lsdli")==0) { + ret= Xorriso_option_lsi(xorriso, argc, argv, idx, (cmd[3]=='l')|8); + + } else if(strcmp(cmd,"lsdx")==0 || strcmp(cmd,"lsdlx")==0) { + ret= Xorriso_option_lsx(xorriso, argc, argv, idx, (cmd[3]=='l')|8); + + } else if(strcmp(cmd,"lsx")==0 || strcmp(cmd,"lslx")==0) { + ret= Xorriso_option_lsx(xorriso, argc, argv, idx, (cmd[2]=='l')); + + } else if(strcmp(cmd,"map")==0) { + (*idx)+= 2; + ret= Xorriso_option_map(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"map_l")==0) { + ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"map_single")==0) { + (*idx)+= 2; + ret= Xorriso_option_map(xorriso, arg1, arg2, 32); + + } else if(strcmp(cmd,"mark")==0) { + (*idx)++; + ret= Xorriso_option_mark(xorriso, arg1, 0); + + } else if(strcmp(cmd, "md5")==0) { + (*idx)++; + ret= Xorriso_option_md5(xorriso, arg1, 0); + + } else if(strcmp(cmd, "mount") == 0 || strcmp(cmd, "mount_cmd") == 0) { + (*idx)+= 4; + if((*idx)>argc) { + sprintf(xorriso->info_text, + "-%s: Not enough arguments. Needed are: device entity id command", + cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; + } else + ret= Xorriso_option_mount(xorriso, arg1, arg2, + argv[(*idx)-2], argv[(*idx)-1], + (strcmp(cmd, "mount_cmd") == 0)); + + } else if(strcmp(cmd, "mount_opts")==0) { + (*idx)++; + ret= Xorriso_option_mount_opts(xorriso, arg1, 0); + + } else if(strcmp(cmd,"mv")==0 || strcmp(cmd,"mvi")==0) { + ret= Xorriso_option_mvi(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"mkdir")==0 || strcmp(cmd,"mkdiri")==0) { + ret= Xorriso_option_mkdiri(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"no_rc")==0) { + ret= Xorriso_option_no_rc(xorriso, 0); + + } else if(strcmp(cmd,"not_leaf")==0) { + (*idx)++; + ret= Xorriso_option_not_leaf(xorriso, arg1, 0); + + } else if(strcmp(cmd,"not_list")==0) { + (*idx)++; + ret= Xorriso_option_not_list(xorriso, arg1, 0); + + } else if(strcmp(cmd,"not_mgt")==0) { + (*idx)++; + ret= Xorriso_option_not_mgt(xorriso, arg1, 0); + + } else if(strcmp(cmd,"not_paths")==0) { + ret= Xorriso_option_not_paths(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"options_from_file")==0) { + (*idx)++; + ret= Xorriso_option_options_from_file(xorriso,arg1,0); + if(ret==3) + goto ex; + + } else if(strcmp(cmd,"osirrox")==0) { + (*idx)++; + ret= Xorriso_option_osirrox(xorriso,arg1,0); + + } else if(strcmp(cmd,"outdev")==0) { + (*idx)++; + ret= Xorriso_option_dev(xorriso, arg1, 2); + + } else if(strcmp(cmd,"out_charset")==0) { + (*idx)++; + ret= Xorriso_option_charset(xorriso, arg1, 2); + + } else if(strcmp(cmd,"overwrite")==0) { + (*idx)++; + ret= Xorriso_option_overwrite(xorriso,arg1,0); + + } else if(strcmp(cmd,"pacifier")==0) { + (*idx)++; + ret= Xorriso_option_pacifier(xorriso, arg1, 0); + + } else if(strcmp(cmd,"padding")==0) { + (*idx)++; + ret= Xorriso_option_padding(xorriso, arg1, 0); + + } else if(strcmp(cmd,"page")==0) { + (*idx)+= 2; + num1= num2= 0; + sscanf(arg1,"%d",&num1); + sscanf(arg2,"%d",&num2); + if(num1<0) + num1= 0; + if(arg1[0]==0) + num1= 16; + if(num2<=0) + num2= 80; + ret= Xorriso_option_page(xorriso, num1, num2, 0); + + } else if(strcmp(cmd,"paste_in")==0) { + (*idx)+= 4; + if((*idx)>argc) { + sprintf(xorriso->info_text, + "-paste_in: Not enough arguments. Needed are: disk_path start count so_rr_path"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; + } else + ret= Xorriso_option_paste_in(xorriso, arg1, arg2, + argv[(*idx)-2], argv[(*idx)-1], 0); + + } else if(strcmp(cmd,"path-list")==0 || strcmp(cmd,"path_list")==0) { + (*idx)++; + ret= Xorriso_option_path_list(xorriso, arg1, 0); + + } else if(strcmp(cmd,"pathspecs")==0) { + (*idx)++; + ret= Xorriso_option_pathspecs(xorriso, arg1, 0); + + } else if(strcmp(cmd,"pkt_output")==0) { + (*idx)++; + ret= Xorriso_option_pkt_output(xorriso, arg1, 0); + + } else if(strcmp(cmd,"preparer_id")==0) { + (*idx)++; + ret= Xorriso_option_preparer_id(xorriso, arg1, 0); + + } else if(strcmp(cmd,"print")==0) { + (*idx)++; + ret= Xorriso_option_print(xorriso, arg1, 0); + + } else if(strcmp(cmd,"print_info")==0) { + (*idx)++; + ret= Xorriso_option_print(xorriso, arg1, 1); + + } else if(strcmp(cmd,"print_mark")==0) { + (*idx)++; + ret= Xorriso_option_print(xorriso, arg1, 2); + + } else if(strcmp(cmd,"print_size")==0) { + Xorriso_option_print_size(xorriso, 0); + + } else if(strcmp(cmd,"prompt")==0) { + (*idx)++; + ret= Xorriso_option_prompt(xorriso, arg1, 0); + + } else if(strcmp(cmd,"prog")==0) { + (*idx)++; + ret= Xorriso_option_prog(xorriso, arg1, 0); + + } else if(strcmp(cmd,"publisher")==0) { + (*idx)++; + Xorriso_option_publisher(xorriso, arg1, 0); + + } else if(strcmp(cmd,"pvd_info")==0) { + Xorriso_option_pvd_info(xorriso, 0); + + } else if(strcmp(cmd,"pwd")==0 || strcmp(cmd,"pwdi")==0) { + Xorriso_option_pwdi(xorriso, 0); + + } else if(strcmp(cmd,"pwdx")==0) { + Xorriso_option_pwdx(xorriso, 0); + + } else if(strcmp(cmd,"quoted_not_list")==0) { + (*idx)++; + ret= Xorriso_option_not_list(xorriso, arg1, 1); + + } else if(strcmp(cmd,"quoted_path_list")==0) { + (*idx)++; + ret= Xorriso_option_path_list(xorriso, arg1, 1); + + } else if(strcmp(cmd,"read_mkisofsrc")==0) { + ret= Xorriso_option_read_mkisofsrc(xorriso, 0); + + } else if(strcmp(cmd,"reassure")==0) { + (*idx)++; + ret= Xorriso_option_reassure(xorriso, arg1, 0); + + } else if(strcmp(cmd,"report_about")==0) { + (*idx)++; + ret= Xorriso_option_report_about(xorriso, arg1, 0); + + } else if(strcmp(cmd,"return_with")==0) { + (*idx)+= 2; + num2= 0; + sscanf(arg2,"%d",&num2); + ret= Xorriso_option_return_with(xorriso, arg1, num2, 0); + + } else if(strcmp(cmd,"rm")==0 || strcmp(cmd,"rmi")==0) { + ret= Xorriso_option_rmi(xorriso, argc, argv, idx, 0); + + } else if(strcmp(cmd,"rm_r")==0 || strcmp(cmd,"rm_ri")==0) { + ret= Xorriso_option_rmi(xorriso, argc, argv, idx, 1); + + } else if(strcmp(cmd,"rmdir")==0 || strcmp(cmd,"rmdiri")==0) { + ret= Xorriso_option_rmi(xorriso, argc, argv, idx, 2); + + } else if(strcmp(cmd,"rollback")==0) { + ret= Xorriso_option_rollback(xorriso, 0); + + } else if(strcmp(cmd,"rollback_end")==0) { + end_ret= Xorriso_option_end(xorriso, 1); + ret= Xorriso_eval_problem_status(xorriso, ret, 0); + if(ret<0) + goto ex; + if(end_ret!=2) + {ret= 3; goto ex;} + + } else if(strcmp(cmd,"rom_toc_scan")==0) { + (*idx)++; + Xorriso_option_rom_toc_scan(xorriso, arg1, 0); + + } else if(strcmp(cmd,"scdbackup_tag")==0) { + (*idx)+= 2; + ret= Xorriso_option_scdbackup_tag(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd, "scsi_log") == 0) { + (*idx)++; + ret= Xorriso_option_scsi_log(xorriso, arg1, 0); + + } else if(strcmp(cmd,"session_log")==0) { + (*idx)++; + ret= Xorriso_option_session_log(xorriso, arg1, 0); + + } else if(strcmp(cmd, "session_string") == 0) { + (*idx)+= 4; + if((*idx)>argc) { + sprintf(xorriso->info_text, + "-%s: Not enough arguments. Needed are: device entity id command", + cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; + } else + ret= Xorriso_option_mount(xorriso, arg1, arg2, + argv[(*idx)-2], argv[(*idx)-1], 2); + + } else if(strcmp(cmd,"setfacl")==0 || strcmp(cmd,"setfacli")==0) { + (*idx)+= 1; + ret= Xorriso_option_setfacli(xorriso, arg1, argc, argv, idx, 0); + + } else if(strcmp(cmd,"setfacl_list")==0 || strcmp(cmd,"setfacl_listi")==0) { + (*idx)+= 1; + ret= Xorriso_option_setfacl_listi(xorriso, arg1, 0); + + } else if(strcmp(cmd,"setfacl_r")==0 || strcmp(cmd,"setfacl_ri")==0) { + (*idx)+= 1; + ret= Xorriso_option_setfacli(xorriso, arg1, argc, argv, idx, 1); + + } else if(strcmp(cmd,"setfattr")==0 || strcmp(cmd,"setfattri")==0) { + (*idx)+= 2; + ret= Xorriso_option_setfattri(xorriso, arg1, arg2, argc, argv, idx, 0); + + } else if(strcmp(cmd,"setfattr_list")==0 || strcmp(cmd,"setfattr_listi")==0) { + (*idx)+= 1; + ret= Xorriso_option_setfattr_listi(xorriso, arg1, 0); + + } else if(strcmp(cmd,"setfattr_r")==0 || strcmp(cmd,"setfattr_ri")==0) { + (*idx)+= 2; + ret= Xorriso_option_setfattri(xorriso, arg1, arg2, argc, argv, idx, 1); + + } else if(strcmp(cmd,"set_filter")==0 || strcmp(cmd,"set_filter_r")==0) { + (*idx)+= 1; + ret= Xorriso_option_set_filter(xorriso, arg1, argc, argv, idx, + strcmp(cmd,"set_filter_r")==0); + + } else if(strcmp(cmd,"show_stream")==0 || strcmp(cmd,"show_stream_r")==0) { + ret= Xorriso_option_set_filter(xorriso, "", argc, argv, idx, + (strcmp(cmd,"show_stream_r")==0) | 2 | 4); + + } else if(strcmp(cmd,"signal_handling")==0) { + (*idx)++; + ret= Xorriso_option_signal_handling(xorriso, arg1, 0); + + } else if(strcmp(cmd,"sleep")==0) { + (*idx)++; + ret= Xorriso_option_sleep(xorriso, arg1, 0); + + } else if(strcmp(cmd,"speed")==0) { + (*idx)++; + ret= Xorriso_option_speed(xorriso, arg1, 0); + + } else if(strcmp(cmd,"split_size")==0) { + (*idx)++; + ret= Xorriso_option_split_size(xorriso, arg1, 0); + + } else if(strcmp(cmd,"status")==0) { + (*idx)++; + ret= Xorriso_option_status(xorriso, arg1, 0); + + } else if(strcmp(cmd,"status_history_max")==0) { + (*idx)++; + sscanf(arg1,"%d",&num1); + ret= Xorriso_option_status_history_max(xorriso, num1, 0); + + } else if(strcmp(cmd,"stdio_sync")==0) { + (*idx)++; + ret= Xorriso_option_stdio_sync(xorriso, arg1, 0); + + } else if(strcmp(cmd,"stream_recording")==0) { + (*idx)++; + ret= Xorriso_option_stream_recording(xorriso, arg1, 0); + + } else if(strcmp(cmd,"system_id")==0) { + (*idx)++; + ret= Xorriso_option_system_id(xorriso, arg1, 0); + + } else if(strcmp(cmd,"tell_media_space")==0) { + Xorriso_option_tell_media_space(xorriso, 0); + + } else if(strcmp(cmd,"temp_mem_limit")==0) { + (*idx)++; + ret= Xorriso_option_temp_mem_limit(xorriso, arg1, 0); + + } else if(strcmp(cmd,"test")==0) { /* This option does not exist. */ + /* install temporary test code here */; + + } else if(strcmp(cmd,"toc")==0) { + Xorriso_option_toc(xorriso, 0); + + } else if(strcmp(cmd,"uid")==0) { + (*idx)++; + ret= Xorriso_option_uid(xorriso,arg1,0); + + } else if(strcmp(cmd,"unregister_filter")==0) { + (*idx)++; + ret= Xorriso_option_unregister_filter(xorriso, arg1, 0); + + } else if(strcmp(cmd,"update")==0) { + (*idx)+= 2; + ret= Xorriso_option_update(xorriso, arg1, arg2, 1); + + } else if(strcmp(cmd,"update_l")==0) { + ret= Xorriso_option_map_l(xorriso, argc, argv, idx, 2<<8); + + } else if(strcmp(cmd,"update_r")==0) { + (*idx)+= 2; + ret= Xorriso_option_update(xorriso, arg1, arg2, 1|8); + + } else if(strcmp(cmd,"use_readline")==0) { + (*idx)++; + ret= Xorriso_option_use_readline(xorriso, arg1, 0); + + } else if(strcmp(cmd,"version")==0){ + ret= Xorriso_option_version(xorriso, 0); + + } else if(strcmp(cmd,"volset_id")==0) { + (*idx)++; + ret= Xorriso_option_volset_id(xorriso, arg1, 0); + + } else if(strcmp(cmd,"volid")==0) { + (*idx)++; + ret= Xorriso_option_volid(xorriso,arg1,0); + + } else if(strcmp(cmd,"volume_date")==0) { + (*idx)+= 2; + ret= Xorriso_option_volume_date(xorriso, arg1, arg2, 0); + + } else if(strcmp(cmd,"xattr")==0) { + (*idx)++; + ret= Xorriso_option_xattr(xorriso, arg1, 0); + + } else if(strcmp(cmd,"zisofs")==0) { + (*idx)++; + ret= Xorriso_option_zisofs(xorriso, arg1, 0); + + } else if(strcmp(cmd, xorriso->list_delimiter)==0){ + /* tis ok */; + + } else if(was_dashed) { + if(xorriso->add_plainly>1) + goto add_plain_argument; +unknown_option:; + sprintf(xorriso->info_text, "Not a known option: '%s'\n", + original_cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto eval_any_problems;} + + } else { + if(xorriso->add_plainly<=0) + goto unknown_option; +add_plain_argument:; + mem_idx= *idx; + (*idx)--; + ret= Xorriso_option_add(xorriso, (*idx)+1, argv, idx, 0); + (*idx)= mem_idx; + + } + +eval_any_problems: + ret= Xorriso_eval_problem_status(xorriso, ret, 0); + if(ret<0) + goto ex; + + if(*idx<argc) + goto next_command; + +ex:; + fflush(stdout); + Xorriso_free_meM(cmd_data); + return(ret); +} + + +int Xorriso_execute_option(struct XorrisO *xorriso, char *line, int flag) +/* + bit0-bit15 are forwarded to Xorriso_interpreter + + bit16= no pageing of info lines + bit17= print === bar even if xorriso->found<0 +*/ +{ + int ret,argc= 0, idx= 1; + char **argv= NULL; + double tdiff; + struct timeval tv; + struct timezone tz; + + gettimeofday(&tv,&tz); + Xorriso_reset_counters(xorriso,0); + xorriso->idle_time= 0.0; + tdiff= tv.tv_sec+(1.e-6*(double) tv.tv_usec); + + /* parse line into args */ + ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, + 4 | ((xorriso->bsl_interpretation & 3) << 5)); + if(ret < 0) { + Xorriso_msgs_submit(xorriso, 0, + "Severe lack of resources during command line parsing", 0, "FATAL", 0); + goto ex; + } + if(ret == 0) { + sprintf(xorriso->info_text, "Incomplete quotation in command line: %s", + line); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + if(argc<2) + {ret= 1; goto ex;} + if(argv[1][0]=='#') + {ret= 1; goto ex;} + + ret= Xorriso_interpreter(xorriso, argc, argv, &idx, flag&0xffff); + if(ret<0) + goto ex; + gettimeofday(&tv,&tz); + tdiff= tv.tv_sec+(1.e-6*(double) tv.tv_usec)-tdiff-xorriso->idle_time; + if(tdiff<0.001) + tdiff= 0.001; + if(xorriso->error_count>0) { + sprintf(xorriso->info_text, + "----------------------------- %7.f errors encountered\n", + xorriso->error_count); + Xorriso_info(xorriso,!(flag&(1<<16))); + } + + /* ??? >>> print elapsed time tdiff ? */; + + if((flag&(1<<17)) && !xorriso->bar_is_fresh) { + sprintf(xorriso->info_text,"============================\n"); + Xorriso_info(xorriso,0); + xorriso->bar_is_fresh= 1; + } + Xorriso_reset_counters(xorriso,0); +ex:; + Sfile_make_argv("", "", &argc, &argv, 2); /* release memory */ + return(ret); +} + + +int Xorriso_dialog(struct XorrisO *xorriso, int flag) +{ + int ret, line_size= 2 * SfileadrL; + char *line= NULL; + + Xorriso_alloc_meM(line, char, line_size); + + if(!xorriso->dialog) + {ret= 1; goto ex;} + if(xorriso->abort_on_is_default) + Xorriso_option_abort_on(xorriso, "NEVER", 0); + xorriso->is_dialog= 1; + while(1) { + if(xorriso->pending_option[0]!=0) { + Xorriso_mark(xorriso,0); + strcpy(line,xorriso->pending_option); + xorriso->pending_option[0]= 0; + } else { + if(!xorriso->bar_is_fresh) { + sprintf(xorriso->info_text,"============================\n"); + Xorriso_info(xorriso,0); + xorriso->bar_is_fresh= 1; + } + sprintf(xorriso->info_text,"enter option and arguments :\n"); + Xorriso_info(xorriso,0); + Xorriso_mark(xorriso,0); + ret= Xorriso_dialog_input(xorriso,line, line_size, 4); + if(ret<=0) + break; + } + sprintf(xorriso->info_text, + "==============================================================\n"); + Xorriso_info(xorriso,0); + + ret= Xorriso_execute_option(xorriso,line,1<<17); + if(ret<0) + goto ex; + if(ret==3) + goto ex; + xorriso->did_something_useful= 1; + xorriso->no_volset_present= 0; /* Re-enable "No ISO image present." */ + } + ret= 1; +ex:; + xorriso->is_dialog= 0; + Xorriso_free_meM(line); + return(ret); +} + + +int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv, + int flag) +/* + bit0= do not interpret argv[1] +*/ +/* + return: + <0 error + 0 end program + 1 ok, go on +*/ +{ + int i, ret, was_dashed, num2, arg_count; + int advice, mem_add_plainly, error_seen= 0; + int was_report_about= 0, was_abort_on= 0, was_return_with= 0; + int was_signal_handling= 0, was_scsi_log= 0, cmd_data_size= 5 * SfileadrL; + char *cmd, *original_cmd, *cmd_data= NULL, *arg1, *arg2; + char mem_list_delimiter[81]; + + strcpy(mem_list_delimiter, xorriso->list_delimiter); + mem_add_plainly= xorriso->add_plainly; + + Xorriso_alloc_meM(cmd_data, char, cmd_data_size); + + for(i=1+(flag&1);i<argc;i++) { + original_cmd= cmd= argv[i]; + was_dashed= 0; + + was_dashed= Xorriso_normalize_command(xorriso, original_cmd, i, + cmd_data, cmd_data_size, &cmd, 0); + if(was_dashed<0) + {ret= -1; goto ex;} + + arg1= ""; + if(i+1<argc) + arg1= argv[i+1]; + arg2= ""; + if(i+2<argc) + arg2= argv[2+1]; + if(i>1) + xorriso->did_something_useful= 1; + if(i==1 && argc==2) { + if(strcmp(cmd,"prog_help")==0) { + i++; + Xorriso_option_prog_help(xorriso,arg1,0); + xorriso->did_something_useful= 1; + {ret= 0; goto ex;} + } else if(strcmp(cmd,"help")==0) { + if(xorriso->argument_emulation == 1) { + Xorriso_genisofs_help(xorriso, 0); + } else if(xorriso->argument_emulation == 2) { + Xorriso_cdrskin_help(xorriso, 0); + } else { + Xorriso_option_help(xorriso,0); + } + xorriso->did_something_useful= 1; + {ret= 0; goto ex;} + } + } else if(i==1 && strcmp(cmd,"no_rc")==0) { + ret= Xorriso_option_no_rc(xorriso, 0); + if(ret<=0) + error_seen= 1; + {ret= 1; goto ex;} + } else if(xorriso->argument_emulation == 1) { /* mkisofs emulation */ + if(xorriso->dev_fd_1 < 0) + goto protect_stdout; + {ret= 1; goto ex;} + + } else if(xorriso->argument_emulation == 2) { /* cdrecord emulation */ + if(xorriso->dev_fd_1 < 0) + if(Xorriso_cdrskin_uses_stdout(xorriso, argc - 1 - (flag & 1), + argv + 1 + (flag & 1), 0)) + goto protect_stdout; + {ret= 1; goto ex;} + + } else if((strcmp(cmd,"dev")==0 || strcmp(cmd,"outdev")==0 || + strcmp(cmd,"indev")==0) && + (strcmp(arg1,"stdio:/dev/fd/1")==0 || strcmp(arg1,"-")==0) && + xorriso->dev_fd_1<0) { + /* Detach fd 1 from externally perceived stdout and attach it to stderr. + Keep dev_fd_1 connected to external stdout. dev_fd_1 is to be used when + "stdio:/dev/fd/1" is interpreted as drive address. + */ +protect_stdout:; + ret= Xorriso_protect_stdout(xorriso, 0); + if(ret == 1) { + sprintf(xorriso->info_text, + "Encountered - or stdio:/dev/fd/1 as possible write target."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + sprintf(xorriso->info_text, + "Redirecting nearly all text message output to stderr."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + sprintf(xorriso->info_text, "Disabling use of libreadline."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + if(xorriso->argument_emulation >= 1 && xorriso->argument_emulation <=2) + {ret= 1; goto ex;} + + } else if(strcmp(cmd,"abort_on")==0 && was_dashed == 1) { + i++; + if(!was_abort_on) + Xorriso_option_abort_on(xorriso, arg1, 0); + was_abort_on= 1; + + } else if(strcmp(cmd,"report_about")==0 && was_dashed == 1) { + i++; + if(!was_report_about) + Xorriso_option_report_about(xorriso, arg1, 0); + was_report_about= 1; + + } else if(strcmp(cmd,"return_with")==0 && was_dashed == 1) { + i+= 2; + num2= 0; + sscanf(arg2,"%d",&num2); + if(!was_return_with) + Xorriso_option_return_with(xorriso, arg1, num2, 0); + was_return_with= 1; + + } else if(strcmp(cmd,"as")==0 && was_dashed == 1) { + ret= Xorriso_count_args(xorriso, argc - i, argv + i, &arg_count, 1); + if(ret == 1) { + i+= arg_count; + + if((strcmp(arg1, "cdrecord")==0 || strcmp(arg1, "wodim")==0 || + strcmp(arg1, "cdrskin")==0 || strcmp(arg1, "xorrecord")==0) && + xorriso->dev_fd_1 < 0) + if(Xorriso_cdrskin_uses_stdout(xorriso, arg_count - 1, + argv + i - arg_count + 2, 0)) + goto protect_stdout; + } + if(was_dashed == 1) { + if((strcmp(arg1, "mkisofs")==0 || strcmp(arg1, "genisoimage")==0 || + strcmp(arg1, "genisofs")==0 || strcmp(arg1, "xorrisofs")==0) && + xorriso->dev_fd_1 < 0) + goto protect_stdout; + } + + } else if(strcmp(cmd, "list_delimiter") == 0) { + /* Needed for interpreting other args. Gets reset after prescan. */ + i++; + ret= Xorriso_option_list_delimiter(xorriso, arg1, 0); + if(ret <= 0) + error_seen= 1; + + } else if(strcmp(cmd, "add_plainly") == 0) { + i++; + ret= Xorriso_option_add_plainly(xorriso, arg1, 0); + if(ret <= 0) + error_seen= 1; + if(xorriso->add_plainly == 3) { + /* All further arguments count as pathspecs */ + {ret= 1; goto ex;} + } + } else if(strcmp(cmd, "scsi_log") == 0 && was_dashed == 1) { + i++; + if(!was_scsi_log) + Xorriso_option_scsi_log(xorriso, arg1, 0); + was_scsi_log= 1; + + } else if(strcmp(cmd, "signal_handling") == 0 && was_dashed == 1) { + i++; + if(!was_signal_handling) + Xorriso_option_signal_handling(xorriso, arg1, 1); /* no install */ + was_signal_handling= 1; + + } else { + ret= Xorriso_count_args(xorriso, argc - i, argv + i, &arg_count, 1); + if(ret == 1) { + i+= arg_count; + } else if((flag & 2) && ((was_dashed && xorriso->add_plainly <= 1) || + xorriso->add_plainly <= 0)) { + sprintf(xorriso->info_text, "Not a known option: '%s'\n", + original_cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + error_seen= 1; + } + } + } + ret= 1; +ex:; + strcpy(xorriso->list_delimiter, mem_list_delimiter); + xorriso->add_plainly= mem_add_plainly; + Xorriso_free_meM(cmd_data); + if(error_seen && ret > 0) { + advice= Xorriso_eval_problem_status(xorriso, 0, 0); + if(advice < 0) + ret= -1; + } + return(ret); +} + + +int Xorriso_read_as_mkisofsrc(struct XorrisO *xorriso, char *path, int flag) +{ + int ret, linecount= 0; + FILE *fp= NULL; + char *sret, *line= NULL, *cpt, *wpt; + + Xorriso_alloc_meM(line, char, SfileadrL); + + ret= Xorriso_afile_fopen(xorriso, path, "rb", &fp, 1 | 2); + if(ret <= 0) + {ret= 0; goto ex;} + while(1) { + sret= Sfile_fgets_n(line, SfileadrL - 1, fp, 0); + if(sret == NULL) { + if(ferror(fp)) + {ret= 0; goto ex;} + break; + } + linecount++; + + /* Interpret line */ + if(line[0] == 0 || line[0] == '#') + continue; + cpt= strchr(line, '='); + if(cpt == NULL) { + + /* >>> ??? complain ? abort reading ? */; + + continue; + } + *cpt= 0; + /* Names are not case sensitive */ + for(wpt= line; wpt < cpt; wpt++) + if(*wpt >= 'a' && *wpt <= 'z') + *wpt= toupper(*wpt); + /* Remove trailing whitespace from name */ + for(wpt= cpt - 1; wpt >= line ; wpt--) + if(*wpt == ' ' || *wpt == '\t') + *wpt= 0; + else + break; + /* Remove trailing whitespace from value */ + for(wpt= cpt + 1 + strlen(cpt + 1) - 1; wpt >= cpt; wpt--) + if(*wpt == ' ' || *wpt == '\t') + *wpt= 0; + else + break; + /* Remove leading whitespace from value */ + for(cpt++; *cpt == ' ' || *cpt == '\t'; cpt++); + + if(strcmp(line, "APPI") == 0) { + ret= Xorriso_option_application_id(xorriso, cpt, 0); + } else if(strcmp(line, "COPY") == 0) { + ret= Xorriso_option_copyright_file(xorriso, cpt, 0); + } else if(strcmp(line, "ABST") == 0) { + ret= Xorriso_option_abstract_file(xorriso, cpt, 0); + } else if(strcmp(line, "BIBL") == 0) { + ret= Xorriso_option_biblio_file(xorriso, cpt, 0); + } else if(strcmp(line, "PREP") == 0) { + /* Not planned to be implemented. Preparer is xorriso. */ + ret= 1; + } else if(strcmp(line, "PUBL") == 0) { + ret= Xorriso_option_publisher(xorriso, cpt, 0); + } else if(strcmp(line, "SYSI") == 0) { + ret= Xorriso_option_system_id(xorriso, cpt, 0); + } else if(strcmp(line, "VOLI") == 0) { + ret= Xorriso_option_volid(xorriso, cpt, 1); + } else if(strcmp(line, "VOLS") == 0) { + ret= Xorriso_option_volset_id(xorriso, cpt, 0); + } else if(strcmp(line, "HFS_TYPE") == 0) { + /* Not planned to be implemented */ + ret= 1; + } else if(strcmp(line, "HFS_CREATOR") == 0) { + /* Not planned to be implemented */ + ret= 1; + } else { + + /* >>> ??? complain ? abort reading ? */; + + } + } + xorriso->mkisofsrc_done= 1; + ret= 1; +ex: + if(fp != NULL) + fclose(fp); + Xorriso_free_meM(line); + return(ret); +} + + +/* ./.mkisofsrc , getenv("MKISOFSRC") , + $HOME/.mkisofsrc , $(basename $0)/.mkisofsrc + */ +int Xorriso_read_mkisofsrc(struct XorrisO *xorriso, int flag) +{ + char *path= NULL, *cpt; + int ret; + + Xorriso_alloc_meM(path, char, SfileadrL); + + ret= Xorriso_read_as_mkisofsrc(xorriso, "./.mkisofsrc", 0); + if(ret > 0) + goto ex; + cpt= getenv("MKISOFSRC"); + if(cpt != NULL) { + strncpy(path, cpt, SfileadrL - 1); + path[SfileadrL - 1]= 0; + ret= Xorriso_read_as_mkisofsrc(xorriso, path, 0); + if(ret > 0) + goto ex; + } + cpt= getenv("HOME"); + if(cpt != NULL) { + strncpy(path, cpt, SfileadrL - 1 - 11); + path[SfileadrL - 1 - 11]= 0; + strcat(path, "/.mkisofsrc"); + ret= Xorriso_read_as_mkisofsrc(xorriso, path, 0); + if(ret > 0) + goto ex; + } + strcpy(path, xorriso->progname); + cpt= strrchr(path, '/'); + if(cpt != NULL) { + strcpy(cpt + 1, ".mkisofsrc"); + ret= Xorriso_read_as_mkisofsrc(xorriso, path, 0); + if(ret > 0) + goto ex; + } + /* no .mkisofsrc file found */ + ret= 2; +ex:; + Xorriso_free_meM(path); + return(ret); +} + + +int Xorriso_read_rc(struct XorrisO *xorriso, int flag) +{ + int ret,i,was_failure= 0,fret; + + if(xorriso->no_rc) + return(1); + i= xorriso->rc_filename_count-1; + Sfile_home_adr_s(".xorrisorc", xorriso->rc_filenames[i], + sizeof(xorriso->rc_filenames[i]),0); + for(i=0;i<xorriso->rc_filename_count;i++) { + ret= Sfile_type(xorriso->rc_filenames[i],1|8); + if(ret!=1) + continue; + ret= Xorriso_option_options_from_file(xorriso,xorriso->rc_filenames[i],0); + if(ret>1) + return(ret); + if(ret==1) + continue; /* regular bottom of loop */ + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1); + if(fret>=0) + continue; + return(ret); + } + if(xorriso->argument_emulation == 1 && !xorriso->mkisofsrc_done) { + ret= Xorriso_read_mkisofsrc(xorriso, 0); + if(ret <= 0) + was_failure= 1; + } + return(!was_failure); +} + + +int Xorriso_make_return_value(struct XorrisO *xorriso, int flag) +{ + int exit_value= 0; + + if(xorriso->eternal_problem_status >= xorriso->return_with_severity) + exit_value= xorriso->return_with_value; + if(exit_value) { + sprintf(xorriso->info_text, + "-return_with %s %d triggered by problem severity %s", + xorriso->return_with_text, exit_value, + xorriso->eternal_problem_status_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + return(exit_value); +} + + +int Xorriso_program_arg_bsl(struct XorrisO *xorriso, int argc, char ***argv, + int flag) +{ + int ret; + + if(!(xorriso->bsl_interpretation & 16)) + return(1); + ret= Sfile_argv_bsl(argc, argv, 0); + return(ret); +} + + +/* @param flag bit0= prepend wd only if name does not begin by '/' + bit1= normalize image path + bit2= prepend wd (automatically done if wd[0]!=0) + bit3= (with bit1) this is an address in the disk world +*/ +int Xorriso_make_abs_adr(struct XorrisO *xorriso, char *wd, char *name, + char adr[], int flag) +{ + char *norm_adr= NULL; + int ret; + + Xorriso_alloc_meM(norm_adr, char, SfileadrL); + + if((wd[0]!=0 || (flag&4)) && !((flag&1) && name[0]=='/')) { + if(strlen(wd)+1>=SfileadrL) + goto much_too_long; + strcpy(adr, wd); + if(name[0]) + if(Sfile_add_to_path(adr, name, 0)<=0) { +much_too_long:; + Xorriso_much_too_long(xorriso, (int) (strlen(adr)+strlen(name)+1), 2); + {ret= 0; goto ex;} + } + } else { + if(strlen(name)+1>=SfileadrL) + goto much_too_long; + strcpy(adr, name); + } + if(flag&2) { + ret= Xorriso_normalize_img_path(xorriso, "", adr, norm_adr, + 1|2|((flag&8)>>1)); + if(ret<=0) + goto ex; + if(norm_adr[0]==0) + strcpy(norm_adr, "/"); + strcpy(adr, norm_adr); + } + ret= 1; +ex:; + Xorriso_free_meM(norm_adr); + return(ret); +} + + +/* @param flag bit0= do not complain in case of error, but set info_text */ +int Xorriso_convert_datestring(struct XorrisO *xorriso, char *cmd, + char *time_type, char *timestring, + int *t_type, time_t *t, int flag) +{ + int ret; + + if(strcmp(time_type, "a")==0) + (*t_type)|= 1; + else if(strcmp(time_type, "m")==0) + (*t_type)|= 4; + else if(strcmp(time_type, "b")==0) + (*t_type)|= 5; + else { + sprintf(xorriso->info_text, "%s: Unrecognized type '%s'", cmd, time_type); + if(!(flag & 1)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + ret= Decode_timestring(timestring, t, 0); + if(ret<=0) { + sprintf(xorriso->info_text, "%s: Cannot decode timestring '%s'", cmd, + timestring); + if(!(flag & 1)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + sprintf(xorriso->info_text, "Understanding timestring '%s' as: %s", + timestring, ctime(t)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + return(1); +} + + +/* @param flag bit1= do not report memory usage as DEBUG +*/ +int Xorriso_check_temp_mem_limit(struct XorrisO *xorriso, off_t mem, int flag) +{ + char mem_text[80], limit_text[80]; + + Sfile_scale((double) mem, mem_text,5,1e4,0); + if(!(flag&2)) { + sprintf(xorriso->info_text, + "Temporary memory needed for result sorting : %s", mem_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + if(mem > xorriso->temp_mem_limit) { + Sfile_scale((double) xorriso->temp_mem_limit,limit_text,5,1e4,1); + sprintf(xorriso->info_text, + "Cannot sort. List of matching files exceeds -temp_mem_limit (%s > %s)", + mem_text, limit_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + return(0); + } + return(1); +} + + +/* + @param flag bit0= use env_path to find the desired program +return: + <=0 : error + 1 : done +*/ +int Xorriso_execv(struct XorrisO *xorriso, char *cmd, char *env_path, + int *status, int flag) +{ + int ret, argc= 0; + char **argv= NULL, *pathlist= NULL, *cpt, *npt, *prog= NULL; + pid_t child_pid; + struct stat stbuf; + + Xorriso_alloc_meM(prog, char, 5 * SfileadrL); + + wait3(NULL,WNOHANG,NULL); /* just to remove any old dead child */ + + ret= Sfile_make_argv("", cmd, &argc, &argv, 1|4|128); + if(ret <= 0) + goto ex; + if(argc < 1) + {ret= 0; goto ex;} + + strcpy(prog, argv[0]); + if((flag & 1) && strchr(argv[0], '/') == NULL) { + if(env_path == NULL) + env_path= "/bin:/sbin"; + else if(env_path[0] == 0) + env_path= "/bin:/sbin"; + if(Sregex_string(&pathlist, env_path, 0) <= 0) + {ret= -1; goto ex;} + for(cpt= npt= pathlist; npt != NULL; cpt= npt + 1) { + npt= strchr(cpt, ':'); + if(npt != NULL) + *npt= 0; + if(strlen(cpt) + strlen(argv[0]) + 1 >= SfileadrL) + {ret= -1; goto ex;} + sprintf(prog, "%s/%s", cpt, argv[0]); + ret= stat(prog, &stbuf); + if(ret != -1) + break; + prog[0]= 0; + } + if(prog[0] == 0) { + sprintf(xorriso->info_text, "Cannot find external program "); + Text_shellsafe(argv[0], xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + + child_pid= fork(); + if(child_pid==-1) + return(-1); + + if(child_pid==0) { + /* this is the child process */ + + sprintf(xorriso->info_text, "Executing external program "); + Text_shellsafe(prog, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + Xorriso_destroy(&xorriso, 0); /* reduce memory foot print */ + + execv(prog, argv); /* should never come back */ + fprintf(stderr,"--- execution of shell command failed:\n"); + fprintf(stderr," %s\n",cmd); + exit(127); + } + + + /* this is the original process waiting for child to exit */ + do { + /* try to read and print the reply */; + ret= waitpid(child_pid,status,WNOHANG); + if(ret==-1) { + if(errno!=EINTR) + ret= 0; goto ex; + } else if(ret==0) { + +#ifdef NIX + + /* >>> An interrupt key would be nice. */ + + if((flag&4)) { + ret= Asqueue_event_is_pending(agent->queue,0,0); + if(ret>0) { + Asagent_stderr(agent,"--- shell command interrupted",1); + kill(child_pid,SIGTERM); + ret= 2; goto ex; + } + } +#endif /* NIX */ + + continue; + } else { + break; + } + } while(1); + ret= 1; +ex: + Sfile_make_argv("", "", &argc, &argv, 2); + Sregex_string(&pathlist, NULL, 0); + Xorriso_free_meM(prog); + return(ret); +} + + +/* @param flag bit0= path is a command parameter +*/ +int Xorriso_path_is_excluded(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + + if(!(xorriso->disk_excl_mode&1)) /* exclusion is off */ + return(0); + if((flag&1) && !(xorriso->disk_excl_mode&2)) /* params are exempted */ + return(0); + ret= Exclusions_match(xorriso->disk_exclusions, path, + !!(xorriso->disk_excl_mode&4)); + if(ret<0) { + sprintf(xorriso->info_text, + "Error during disk file exclusion decision"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + } + if(ret>0 && (flag&1)) { + sprintf(xorriso->info_text, "Disk path parameter excluded by %s : ", + (ret==1 ? "-not_paths" : "-not_leaf")); + Text_shellsafe(path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + return(ret); +} + + +int Xorriso_path_is_hidden(struct XorrisO *xorriso, char *path, int flag) +{ + int ret, hide_attrs= 0; + + ret= Exclusions_match(xorriso->iso_rr_hidings, path, 0); + if(ret < 0) { +failure:; + sprintf(xorriso->info_text, "Error during disk file hiding decision"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(-1); + } + if(ret > 0) + hide_attrs|= 1; + ret= Exclusions_match(xorriso->joliet_hidings, path, 0); + if(ret < 0) + goto failure; + if(ret > 0) + hide_attrs|= 2; + return(hide_attrs); +} + + +/* Normalize ACL and sort apart "access" ACL from "default" ACL. + */ +int Xorriso_normalize_acl_text(struct XorrisO *xorriso, char *in_text, + char **access_acl_text, char **default_acl_text, int flag) +{ + int ret, access_count= 0, default_count= 0, pass, is_default, line_len; + int was_error= 0, line_count= 0, perms; + char *acl_text= NULL, *cpt, *npt, *access_wpt= NULL, *default_wpt= NULL; + char *dpt= NULL, *ddpt= NULL, **wpt, *ppt; + + if(in_text[0] == 0 || strcmp(in_text, "clear") == 0 || + strcmp(in_text, "--remove-all") == 0) { + *access_acl_text= *default_acl_text= NULL; + return(1); + } else if (strcmp(in_text, "--remove-default") == 0) { + + /* >>> protect Access-ACL and delete Default-ACL */; + + /* <<< */ + return(0); + + } + + acl_text= strdup(in_text); + if(acl_text == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + {ret= -1; goto ex;} + } + + /* From comma to newline */ + for(cpt= strchr(acl_text, ','); cpt != NULL; cpt= strchr(cpt + 1, ',')) + *cpt= '\n'; + + /* Normalize to long text form + and sort apart "access" ACL from "default" ACL */; + for(pass= 0; pass < 2; pass++) { + line_count= 0; + for(cpt= acl_text; cpt != NULL; cpt= npt) { + line_count++; + npt= strchr(cpt, '\n'); + if(npt != NULL) + npt++; + if(*cpt == '#' || *cpt == '\n' || *cpt == 0) + continue; + + is_default= 0; + wpt= &access_wpt; + if(*cpt == 'd') { + is_default= 1; + if(pass == 1) + wpt= &default_wpt; + cpt= strchr(cpt, ':'); + if(cpt == NULL) { + was_error= line_count; + continue; + } + cpt++; + } + + line_len= 0; + dpt= strchr(cpt, ':'); + if(dpt != NULL) + ddpt= strchr(dpt + 1, ':'); + if(dpt == NULL || ddpt == NULL) { + was_error= line_count; + continue; + } + if(*cpt == 'u') { + if(pass == 0) { + line_len+= 5; + line_len+= ddpt - dpt; + } else { + strcpy(*wpt, "user:"); + strncpy(*wpt + 5, dpt + 1, ddpt - dpt); + (*wpt)+= 5 + (ddpt - dpt); + } + } else if(*cpt == 'g') { + if(pass == 0) { + line_len+= 6 + (ddpt - dpt); + } else { + strcpy(*wpt, "group:"); + strncpy(*wpt + 6, dpt + 1, ddpt - dpt); + (*wpt)+= 6 + (ddpt - dpt); + } + } else if(*cpt == 'o') { + if(pass == 0) { + if(ddpt - dpt > 1) { + was_error= line_count; + continue; + } + line_len+= 6 + (ddpt - dpt); + } else { + strcpy(*wpt, "other:"); + strncpy(*wpt + 6, dpt + 1, ddpt - dpt); + (*wpt)+= 6 + (ddpt - dpt); + } + } else if(*cpt == 'm') { + if(pass == 0) { + if(ddpt - dpt > 1) { + was_error= line_count; + continue; + } + line_len+= 5 + (ddpt - dpt); + } else { + strcpy(*wpt, "mask:"); + strncpy(*wpt + 5, dpt + 1, ddpt - dpt); + (*wpt)+= 5 + (ddpt - dpt); + } + + } else { + /* Unknown tag type */ + was_error= line_count; + continue; + } + + /* Examine permissions at ddpt + 1 */; + perms= 0; + for(ppt= ddpt + 1; *ppt != 0 && *ppt != '\n'; ppt++) { + if(*ppt == 'r') + perms|= 4; + else if(*ppt == 'w') + perms|= 2; + else if(*ppt == 'x') + perms|= 1; + else if(*ppt == '-' || *ppt == ' ' || *ppt == '\t') + ; + else if(*ppt == '#') + break; + else { + was_error= line_count; + break; + } + } + if(pass == 0) { + line_len+= 4; + } else { + sprintf(*wpt, "%c%c%c\n", + perms & 4 ? 'r' : '-', perms & 2 ? 'w' : '-', perms & 1 ? 'x' : '-'); + (*wpt)+= 4; + } + + if(pass == 0) { + if(is_default) + default_count+= line_len; + else + access_count+= line_len; + } + } + + if(pass == 0) { + *access_acl_text= calloc(access_count + 1, 1); + *default_acl_text= calloc(default_count + 1, 1); + if(access_acl_text == NULL || *default_acl_text == NULL) { + Xorriso_no_malloc_memory(xorriso, access_acl_text, 0); + {ret= -1; goto ex;} + } + access_wpt= *access_acl_text; + default_wpt= *default_acl_text; + } else { + *access_wpt= 0; + *default_wpt= 0; + } + } + + ret= 1; +ex:; + if(acl_text != NULL) + free(acl_text); + if(was_error) { + sprintf(xorriso->info_text, + "Malformed ACL entries encountered. Last one in line number %d.", + was_error); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/parse_exec.h b/libisoburn/branches/1.1.8/xorriso/parse_exec.h new file mode 100644 index 00000000..c67311a6 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/parse_exec.h @@ -0,0 +1,92 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of functions which deal with parsing + and interpretation of command input. +*/ + + +#ifndef Xorriso_pvt_cmd_includeD +#define Xorriso_pvt_cmd_includeD yes + + +/* @param flag bit0= do not warn of wildcards + bit1= these are disk_paths +*/ +int Xorriso_end_idx(struct XorrisO *xorriso, + int argc, char **argv, int idx, int flag); + +int Xorriso_opt_args(struct XorrisO *xorriso, char *cmd, + int argc, char **argv, int idx, + int *end_idx, int *optc, char ***optv, int flag); + +int Xorriso_get_problem_status(struct XorrisO *xorriso, char severity[80], + int flag); + +int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, + int flag); + +/** + @param flag bit0= do not issue own event messages + bit1= take xorriso->request_to_abort as reason for abort + @return Gives the advice: + 2= pardon was given, go on + 1= no problem, go on + 0= function failed but xorriso would not abort, go on + <0= do abort + -1 = due to problem_status + -2 = due to xorriso->request_to_abort +*/ +int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag); + +int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd, + int argc, char **argv, int *idx, + int *optc, char ***optv, char eff_dest[SfileadrL], + int flag); + +/* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high +*/ +int Xorriso_decode_load_adr(struct XorrisO *xorriso, char *cmd, + char *adr_mode, char *adr_value, + int *entity_code, char entity_id[81], + int flag); + +int Xorriso_check_name_len(struct XorrisO *xorriso, char *name, int size, + char *cmd, int flag); + +/* @param flag bit0= prepend wd only if name does not begin by '/' + bit2= prepend wd (automatically done if wd[0]!=0) +*/ +int Xorriso_make_abs_adr(struct XorrisO *xorriso, char *wd, char *name, + char adr[], int flag); + +/* @param flag bit0= do not complain in case of error, but set info_text */ +int Xorriso_convert_datestring(struct XorrisO *xorriso, char *cmd, + char *time_type, char *timestring, + int *t_type, time_t *t, int flag); + +int Xorriso_check_temp_mem_limit(struct XorrisO *xorriso, off_t mem, int flag); + +/* @param flag bit0= use env_path to find the desired program +*/ +int Xorriso_execv(struct XorrisO *xorriso, char *cmd, char *env_path, + int *status, int flag); + +int Xorriso_path_is_excluded(struct XorrisO *xorriso, char *path, int flag); + +int Xorriso_path_is_hidden(struct XorrisO *xorriso, char *path, int flag); + + +/* Normalize ACL and sort apart "access" ACL from "default" ACL. + */ +int Xorriso_normalize_acl_text(struct XorrisO *xorriso, char *in_text, + char **access_acl_text, char **default_acl_text, int flag); + +int Xorriso_read_mkisofsrc(struct XorrisO *xorriso, int flag); + +#endif /* ! Xorriso_pvt_cmd_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/read_run.c b/libisoburn/branches/1.1.8/xorriso/read_run.c new file mode 100644 index 00000000..f1192a14 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/read_run.c @@ -0,0 +1,2143 @@ + + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains functions which are needed to read data + from ISO image. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + +#include <fcntl.h> +#include <utime.h> + + +#include "lib_mgt.h" +#include "drive_mgt.h" +#include "iso_img.h" +#include "iso_tree.h" +#include "iso_manip.h" +#include "read_run.h" +#include "sort_cmp.h" + + +int Xorriso__read_pacifier(IsoImage *image, IsoFileSource *filesource) +{ + struct XorrisO *xorriso; + + xorriso= (struct XorrisO *) iso_image_get_attached_data(image); + if(xorriso==NULL) + return(1); + Xorriso_process_msg_queues(xorriso,0); + xorriso->pacifier_count++; + if(xorriso->pacifier_count%10) + return(1); + Xorriso_pacifier_callback(xorriso, "nodes read", xorriso->pacifier_count, 0, + "", 0); + return(1); +} + + +int Xorriso_iso_file_open(struct XorrisO *xorriso, char *pathname, + void *node_pt, void **stream, int flag) +{ + int ret; + char *eff_path= NULL; + IsoNode *node= NULL; + IsoFile *filenode= NULL; + IsoStream *iso_stream= NULL, *input_stream; + + Xorriso_alloc_meM(eff_path, char, SfileadrL); + + *stream= NULL; + if(flag&1) { + node= (IsoNode *) node_pt; + } else { + ret= Xorriso_get_node_by_path(xorriso, pathname, eff_path, &node, 0); + if(ret<=0) + goto ex; + } + if(!LIBISO_ISREG(node)) { + sprintf(xorriso->info_text, + "Given path does not lead to a regular data file in the image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + filenode= (IsoFile *) node; + iso_stream= iso_file_get_stream(filenode); + if(iso_stream==NULL) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Could not obtain source stream of file in the image for reading"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(flag & 2) { + /* Dig out the most original stream */ + while(1) { + input_stream= iso_stream_get_input_stream(iso_stream, 0); + if(input_stream == NULL) + break; + iso_stream= input_stream; + } + } + if(!iso_stream_is_repeatable(iso_stream)) { + sprintf(xorriso->info_text, + "The data production of the file in the image is one-time only"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= iso_stream_open(iso_stream); + if(ret<0) { + sprintf(xorriso->info_text, + "Could not open data file in the image for reading"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + Xorriso_process_msg_queues(xorriso,0); + *stream= iso_stream; + +#ifdef NIX + /* <<< */ + { + unsigned int fs_id; + dev_t dev_id; + ino_t ino; + + iso_stream_get_id(iso_stream, &fs_id, &dev_id, &ino); + fprintf(stderr, "xorriso_debug: iso_ino= %ld\n", (long int) ino); + } +#endif + + ret= 1; +ex:; + Xorriso_free_meM(eff_path); + return(ret); +} + + +int Xorriso_iso_file_read(struct XorrisO *xorriso, void *stream, char *buf, + int count, int flag) +{ + int ret, rcnt= 0; + IsoStream *stream_pt; + + stream_pt= (IsoStream *) stream; + + while(rcnt<count) { + ret= iso_stream_read(stream_pt, (void *) (buf+rcnt), (size_t) (count-rcnt)); + if(ret==0) /* EOF */ + break; + if(ret<0) { /* error */ + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, "Error on read", + 0, "FAILURE", 1 | ((ret == -1)<<2) ); + return(-1); + } + rcnt+= ret; + } + return(rcnt); +} + + +int Xorriso_iso_file_close(struct XorrisO *xorriso, void **stream, int flag) +{ + int ret; + + if(*stream==NULL) + return(0); + ret= iso_stream_close(*stream); + if(ret==1) + *stream= NULL; + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* @param flag bit0= in_node is valid, do not resolve img_path + bit1= test mode: print DEBUG messages + @return <0 = error, + 0 = surely not identical regular files , + 1 = surely identical + 2 = potentially depending on unknown disk file (e.g. -cut_out) +*/ +int Xorriso_restore_is_identical(struct XorrisO *xorriso, void *in_node, + char *img_path, char *disk_path, + char type_text[5], int flag) +{ + int ret; + unsigned int fs_id; + dev_t dev_id; + ino_t ino_id; + IsoStream *stream; + IsoImage *volume; + IsoNode *node; + struct stat stbuf; + int dummy; + + memset(type_text, 0, 5); + if(!xorriso->volset_change_pending) + return(0); + if(flag&1) { + node= (IsoNode *) in_node; + } else { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(-1); + ret= Xorriso_node_from_path(xorriso, volume, img_path, &node, 1); + if(ret<=0) + return(-1); + } + ret= Xorriso__file_start_lba(node, &dummy, 0); + if(ret != 0) { + Xorriso_process_msg_queues(xorriso, 0); + return(0); + } + if(!LIBISO_ISREG(node)) + return(0); + stream= iso_file_get_stream((IsoFile *) node); + memcpy(type_text, stream->class->type, 4); + iso_stream_get_id(stream, &fs_id, &dev_id, &ino_id); + if(flag&2) { + sprintf(xorriso->info_text, "%s : fs=%d dev=%.f ino=%.f (%s)", + img_path, fs_id, (double) dev_id, (double) ino_id, type_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + ret= stat(disk_path, &stbuf); + if(ret==-1) + return(0); + if(flag&2) { + sprintf(xorriso->info_text, "%s : dev=%.f ino=%.f", + disk_path, (double) stbuf.st_dev, (double) stbuf.st_ino); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + if(fs_id!=1) + return(2); + + /* >>> obtain underlying dev_t ino_t of type "cout" */; + + if(strcmp(type_text, "fsrc")!=0) + return(2); + if(stbuf.st_dev==dev_id && stbuf.st_ino==ino_id) + return(1); + return(0); +} + + +/* @param flag bit0= minimal transfer: access permissions only + bit1= keep directory open: keep owner, allow rwx for owner + and push directory onto xorriso->perm_stack +*/ +int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path, + IsoNode *node, int flag) +{ + int ret, is_dir= 0, errno_copy= 0; + mode_t mode; + uid_t uid; + gid_t gid; + struct utimbuf utime_buffer; + struct stat stbuf; + size_t num_attrs= 0, *value_lengths= NULL; + char **names= NULL, **values= NULL; + + ret= lstat(disk_path, &stbuf); + if(ret==-1) { + sprintf(xorriso->info_text, + "Cannot obtain properties of disk file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + uid= stbuf.st_uid; + + is_dir= S_ISDIR(stbuf.st_mode); + + mode= iso_node_get_permissions(node); + + if(xorriso->do_aaip & (2 | 8 | 16)) { + ret= iso_node_get_attrs(node, &num_attrs, &names, &value_lengths, &values, + (!!(xorriso->do_aaip & 2)) | (!(xorriso->do_aaip & (8 | 16))) << 2); + if (ret < 0) { + strcpy(xorriso->info_text, "Error with obtaining ACL and xattr for "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(num_attrs > 0) { + ret= iso_local_set_attrs(disk_path, num_attrs, names, value_lengths, + values, (!(xorriso->do_strict_acl & 1)) << 6); + if(ret < 0) { + errno_copy= errno; + if(ret != (int) ISO_AAIP_NO_SET_LOCAL) + errno_copy= 0; + Xorriso_report_iso_error(xorriso, "", ret, + "Error on iso_local_set_attrs", + 0, "FAILURE", 1 | ((ret == -1)<<2) ); + sprintf(xorriso->info_text, + "Cannot change ACL or xattr of disk file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno_copy, + "FAILURE",0); + {ret= 0; goto ex;} + } + } + Xorriso_process_msg_queues(xorriso,0); + } + if(!(xorriso->do_aaip & 2)) + mode= iso_node_get_perms_wo_acl(node); + + if(is_dir && (flag&2)) { + ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, + 1 | ((!!(xorriso->do_aaip & 2)) << 3)); + if(ret<=0) + {ret= 0; goto ex;} + ret= Permstack_push(&(xorriso->perm_stack), disk_path, &stbuf, 0); + if(ret<=0) { + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + strcpy(xorriso->info_text, + "Cannot memorize permissions for disk directory"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + mode|= S_IRUSR|S_IWUSR|S_IXUSR; + } + ret= chmod(disk_path, mode); + if(ret==-1) { + sprintf(xorriso->info_text, + "Cannot change access permissions of disk file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + + if(flag&1) + {ret= 1; goto ex;} + + gid= iso_node_get_gid(node); + if(!(S_ISDIR(stbuf.st_mode) && (flag&2))) + uid= iso_node_get_uid(node); + ret= chown(disk_path, uid, gid); /* don't complain if it fails */ + utime_buffer.actime= iso_node_get_atime(node); + utime_buffer.modtime= iso_node_get_mtime(node); + ret= utime(disk_path,&utime_buffer); + if(ret==-1) { + sprintf(xorriso->info_text, + "Cannot change atime, mtime of disk file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= 1; +ex:; + iso_node_get_attrs(node, &num_attrs, &names, &value_lengths, &values,1 << 15); + return(ret); +} + + +/* @param flag + bit1= minimal transfer: access permissions only + bit2= keep directory open: keep owner, allow rwx for owner + push to xorriso->perm_stack +*/ +int Xorriso_restore_implicit_properties(struct XorrisO *xorriso, + char *full_disk_path, char *disk_path, char *full_img_path, int flag) +{ + int ret, nfic, ndc, nfdc, d, i; + char *nfi= NULL, *nd= NULL, *nfd= NULL, *cpt; + struct stat stbuf; + IsoNode *node; + + Xorriso_alloc_meM(nfi, char, SfileadrL); + Xorriso_alloc_meM(nd, char, SfileadrL); + Xorriso_alloc_meM(nfd, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, full_disk_path, nfd, + 1|2|4); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, nd, 1|2); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, full_img_path, nfi, + 1|2); + if(ret<=0) + goto ex; + nfdc= Sfile_count_components(nfd, 0); + ndc= Sfile_count_components(nd, 0); + nfic= Sfile_count_components(nfi, 0); + d= nfdc-ndc; + if(d<0) + {ret= -1; goto ex;} + if(d>nfic) + {ret= 0; goto ex;} + for(i= 0; i<d; i++) { + cpt= strrchr(nfi, '/'); + if(cpt==NULL) + {ret= -1; goto ex;} /* should not happen */ + *cpt= 0; + } + if(nfi[0]==0) + strcpy(nfi, "/"); + ret= Xorriso_fake_stbuf(xorriso, nfi, &stbuf, &node, 0); + if(ret<=0) + {ret= 0; goto ex;} + ret= Xorriso_restore_properties(xorriso, nd, node, ((flag>>1)&3)); + if(ret<=0) + goto ex; + sprintf(xorriso->info_text, "Restored properties for "); + Text_shellsafe(nd, xorriso->info_text, 1); + strcat(xorriso->info_text, " from "); + Text_shellsafe(nfi, xorriso->info_text, 1 | 2); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + ret= 1; +ex:; + Xorriso_free_meM(nfi); + Xorriso_free_meM(nd); + Xorriso_free_meM(nfd); + return(ret); +} + + +/* @param flag bit0= Minimal transfer: access permissions only + bit1= *_offset and bytes are valid for writing to regular file + bit2= This is not a parameter. Do not report if ignored + bit3= do not restore properties + bit4= issue pacifier messages with long lasting copying + bit7= return 4 if restore fails from denied permission + do not issue error message + @return <0 severe error , 0 failure , 1 success , + 2 regularly not installed (disallowed device, UNIX domain socket) + 4 with bit7: permission to restore was denied +*/ +int Xorriso_tree_restore_node(struct XorrisO *xorriso, IsoNode *node, + char *img_path, off_t img_offset, + char *disk_path, off_t disk_offset, off_t bytes, + int flag) +{ + int ret= 0, write_fd= -1, wanted, wret, open_flags, l_errno= 0; + int target_deleted= 0, buf_size= 32 * 1024; + char *what= "[unknown filetype]"; + char *buf= NULL, type_text[5], *temp_path= NULL, *buf_pt; + char *link_target, *open_path_pt= NULL; + off_t todo= 0, size, seek_ret, last_p_count= 0, already_done, read_count= 0; + void *data_stream= NULL; + mode_t mode; + dev_t dev= 0; + struct stat stbuf; + struct utimbuf utime_buffer; + IsoImage *volume; + IsoBoot *bootcat; + uint32_t lba; + char *catcontent = NULL; + off_t catsize; + + Xorriso_alloc_meM(buf, char, buf_size); + Xorriso_alloc_meM(temp_path, char, SfileadrL); + + if(LIBISO_ISDIR(node)) { + what= "directory"; + ret= mkdir(disk_path, 0777); + l_errno= errno; + + } else if(LIBISO_ISREG(node) || ISO_NODE_IS_BOOTCAT(node)) { + if(ISO_NODE_IS_BOOTCAT(node)) { + what= "boot catalog"; + } else { + what= "regular file"; + ret= Xorriso_iso_file_open(xorriso, img_path, (void *) node, &data_stream, + 1); + if(ret<=0) + goto ex; + } + open_path_pt= disk_path; + ret= stat(open_path_pt, &stbuf); + if(ret == -1 && errno == EACCES && (flag & 128)) + {ret= 4; goto ex;} + if(flag&2) { + if(ret!=-1 && !S_ISREG(stbuf.st_mode)) { + sprintf(xorriso->info_text, + "Restore offset demanded. But filesystem path leads to non-data file "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + l_errno= 0; + goto cannot_restore; + } + } else { + /* If source and target are the same disk file then do not copy content */ + ret= Xorriso_restore_is_identical(xorriso, (void *) node, img_path, + disk_path, type_text, 1); + if(ret<0) + goto ex; + if(ret==1) { + /* preliminarily emulate touch (might get overridden later) */ + utime_buffer.actime= stbuf.st_atime; + utime_buffer.modtime= time(0); + utime(disk_path,&utime_buffer); + goto restore_properties; + } + if(ret==2) { + /* Extract to temporary file and rename only after copying */ + ret= Xorriso_make_tmp_path(xorriso, disk_path, temp_path, &write_fd, + 128); + if(ret <= 0 || ret == 4) + goto ex; + open_path_pt= temp_path; + } + } + if(write_fd==-1) { + open_flags= O_WRONLY|O_CREAT; + if(disk_offset==0 || !(flag&2)) + open_flags|= O_EXCL; + write_fd= open(open_path_pt, open_flags, S_IRUSR|S_IWUSR); + l_errno= errno; + if(write_fd == -1 && errno == EACCES && (flag & 128)) + {ret= 4; goto ex;} + if(write_fd==-1) + goto cannot_restore; + } + if(ISO_NODE_IS_BOOTCAT(node)) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + ret= iso_image_get_bootcat(volume, &bootcat, &lba, &catcontent, &catsize); + if(ret < 0) + goto ex; + todo= size= catsize; + } else { + todo= size= iso_file_get_size((IsoFile *) node); + } + if(flag&2) { + if(bytes<size) + todo= size= bytes; + seek_ret= lseek(write_fd, disk_offset, SEEK_SET); + l_errno= errno; + if(seek_ret == -1) { + sprintf(xorriso->info_text, + "Cannot address byte %.f in filesystem path ", + (double) disk_offset); + Text_shellsafe(open_path_pt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + goto cannot_restore; + } + } + while(todo>0) { + wanted= buf_size; + if(wanted>todo) + wanted= todo; + if(ISO_NODE_IS_BOOTCAT(node)) { + ret= todo; + buf_pt= catcontent; + } else { + ret= Xorriso_iso_file_read(xorriso, data_stream, buf, wanted, 0); + buf_pt= buf; + } + if(ret<=0) { + if(xorriso->extract_error_mode == 0 && + Xorriso_is_plain_image_file(xorriso, node, "", 0)) { + close(write_fd); + write_fd= -1; + already_done= (size - todo) / (off_t) 2048; + already_done*= (off_t) 2048; + sprintf(xorriso->info_text, + "Starting best_effort handling on ISO file "); + Text_shellsafe(img_path, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " at byte %.f", (double) already_done); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= Xorriso_read_file_data(xorriso, node, img_path, open_path_pt, + already_done, already_done, size - already_done, 2); + if(ret >= 0) + xorriso->pacifier_byte_count+= todo; + if(ret > 0) + todo= 0; + else + todo= -1; + } + if(ret <= 0) { + sprintf(xorriso->info_text, "Cannot read all bytes from ISO file "); + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + break; + } + read_count+= ret; + + if(img_offset > read_count - ret) { + /* skip the desired amount of bytes */ + if(read_count <= img_offset) + continue; + buf_pt= buf_pt + (img_offset - (read_count - ret)); + ret= read_count - img_offset; + } + + wret= write(write_fd, buf_pt, ret); + if(wret>=0) { + todo-= wret; + xorriso->pacifier_byte_count+= wret; + if((flag&16) && + xorriso->pacifier_byte_count - last_p_count >= 128*1024) { + Xorriso_pacifier_callback(xorriso, "files restored", + xorriso->pacifier_count, + xorriso->pacifier_total, "", 2|4); + last_p_count= xorriso->pacifier_byte_count; + } + } + if(wret != ret) { + sprintf(xorriso->info_text, + "Cannot write all bytes to disk filesystem path "); + Text_shellsafe(open_path_pt, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + break; + } + } + if(write_fd > 0) + close(write_fd); + write_fd= -1; + if(todo > 0 && xorriso->extract_error_mode == 2 && open_path_pt != NULL) { + unlink(open_path_pt); + target_deleted= 1; + } + if(! ISO_NODE_IS_BOOTCAT(node)) + Xorriso_iso_file_close(xorriso, &data_stream, 0); + data_stream= NULL; + if(temp_path==open_path_pt && !target_deleted) { + ret= rename(temp_path, disk_path); + if(ret==-1) { + sprintf(xorriso->info_text, "Cannot rename temporary path "); + Text_shellsafe(temp_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " to final disk path "); + Text_shellsafe(disk_path, xorriso->info_text, 1 | 2); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + unlink(temp_path); + ret= 0; goto ex; + } + } + ret= -(todo > 0); + l_errno= 0; + + } else if(LIBISO_ISLNK(node)) { + what= "symbolic link"; + link_target= (char *) iso_symlink_get_dest((IsoSymlink *) node); + ret= symlink(link_target, disk_path); + l_errno= errno; + + } else if(LIBISO_ISCHR(node)) { + what= "character device"; + if(xorriso->allow_restore!=2) { +ignored:; + if(!(flag&4)) { + sprintf(xorriso->info_text, "Ignored file type: %s ", what); + Text_shellsafe(img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " = "); + Text_shellsafe(disk_path, xorriso->info_text, 1 | 2); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + {ret= 2; goto ex;} + } + mode= S_IFCHR | 0777; + ret= Xorriso_node_get_dev(xorriso, node, img_path, &dev, 0); + if(ret<=0) + goto ex; + if(dev == (dev_t) 1) { +probably_damaged:; + sprintf(xorriso->info_text, + "Most probably damaged device file not restored: mknod "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + sprintf(xorriso->info_text + strlen(xorriso->info_text), + " %s 0 1", LIBISO_ISCHR(node) ? "c" : "b"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto ex; + } + ret= mknod(disk_path, mode, dev); + l_errno= errno; + + } else if(LIBISO_ISBLK(node)) { + what= "block device"; + if(xorriso->allow_restore!=2) + goto ignored; + mode= S_IFBLK | 0777; + ret= Xorriso_node_get_dev(xorriso, node, img_path, &dev, 0); + if(ret<=0) + goto ex; + if(dev == (dev_t) 1) + goto probably_damaged; + ret= mknod(disk_path, mode, dev); + l_errno= errno; + + } else if(LIBISO_ISFIFO(node)) { + what= "named pipe"; + mode= S_IFIFO | 0777; + ret= mknod(disk_path, mode, dev); + l_errno= errno; + + } else if(LIBISO_ISSOCK(node)) { + what= "unix socket"; + /* Restoring a socket file is not possible. One rather needs to restart + the service which temporarily created the socket. */ + goto ignored; + + } else { + sprintf(xorriso->info_text, "Cannot restore file type '%s'", what); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + ret= 0; goto ex; + + } + if(ret == -1 && l_errno == EACCES && (flag & 128)) + {ret= 4; goto ex;} + if(ret==-1) { +cannot_restore:; + sprintf(xorriso->info_text, + "Cannot restore %s to disk filesystem: ", what); + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, l_errno, "FAILURE", 0); + ret= 0; goto ex; + } + +restore_properties:; + if((flag&8) || LIBISO_ISLNK(node)) + ret= 1; + else + ret= Xorriso_restore_properties(xorriso, disk_path, node, flag&1); + if(todo < 0) + ret= 0; +ex:; + if(write_fd >= 0) { + close(write_fd); + if(ret <= 0 && xorriso->extract_error_mode == 2 && open_path_pt != NULL) + unlink(open_path_pt); + } + Xorriso_free_meM(buf); + Xorriso_free_meM(temp_path); + if(catcontent != NULL) + free(catcontent); + if(data_stream!=NULL) + Xorriso_iso_file_close(xorriso, &data_stream, 0); + Xorriso_process_msg_queues(xorriso,0); + return(ret); +} + + +/* Handle overwrite situation in disk filesystem. + @param node intended source of overwriting or NULL + @param flag + bit4= return 3 on rejection by exclusion or user + bit6= permission to call Xorriso_make_accessible() +*/ +int Xorriso_restore_overwrite(struct XorrisO *xorriso, + IsoNode *node, char *img_path, + char *path, char *nominal_path, + struct stat *stbuf, int flag) +{ + int ret; + char type_text[5]; + + Xorriso_process_msg_queues(xorriso,0); + if(xorriso->do_overwrite==1 || + (xorriso->do_overwrite==2 && !S_ISDIR(stbuf->st_mode))) { + + ret= Xorriso_restore_is_identical(xorriso, (void *) node, img_path, + path, type_text, (node!=NULL)); + if(ret<0) + return(ret); + if(ret>0) /* will be handled properly by restore functions */ + ret= Xorriso_reassure_restore(xorriso, path, 8); + else + ret= Xorriso_rmx(xorriso, (off_t) 0, path, 8 | (flag & 64)); + if(ret<=0) + return(ret); + if(ret==3) { + sprintf(xorriso->info_text, "User revoked restoring of (ISO) file: "); + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(3*!!(flag&16)); + } + return(1); + } + Xorriso_msgs_submit(xorriso, 0, nominal_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "While restoring "); + Text_shellsafe(nominal_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " : "); + if(strcmp(nominal_path, path) == 0) + strcat(xorriso->info_text, "file object"); + else + Text_shellsafe(path, xorriso->info_text, 1 | 2); + strcat(xorriso->info_text, " exists and may not be overwritten"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); +} + + +/* + @return <0 error, + bit0= hardlink created + bit1= siblings with target NULL found + bit2= siblings with non-NULL target found +*/ +int Xorriso_restore_target_hl(struct XorrisO *xorriso, IsoNode *node, + char *disk_path, int *node_idx, int flag) +{ + int ret, min_hl, max_hl, i, null_target_sibling= 0, link_sibling= 0; + + if(xorriso->hln_targets == NULL) + return(0); + ret= Xorriso_search_hardlinks(xorriso, node, node_idx, &min_hl, &max_hl, 1); + if(ret < 0) + return(ret); + if(ret == 0 || *node_idx < 0 || min_hl == max_hl) + return(0); + for(i= min_hl; i <= max_hl; i++) { + if(xorriso->hln_targets[i] == NULL) { + if(i != *node_idx) + null_target_sibling= 1; + continue; + } + link_sibling= 1; + ret= Xorriso_restore_make_hl(xorriso, xorriso->hln_targets[i], disk_path, + !!xorriso->do_auto_chmod); + if(ret > 0) + return(1); + } + return((null_target_sibling << 1) | (link_sibling << 2)); +} + + +/* + @return <0 error, + bit0= hardlink created + bit2= siblings lower index found +*/ +int Xorriso_restore_prefix_hl(struct XorrisO *xorriso, IsoNode *node, + char *disk_path, int node_idx, int flag) +{ + int ret, min_hl, max_hl, i, link_sibling= 0, hflag; + char *old_path= NULL, *img_path= NULL; + struct Xorriso_lsT *img_prefixes= NULL, *disk_prefixes= NULL; + + Xorriso_alloc_meM(old_path, char, SfileadrL); + Xorriso_alloc_meM(img_path, char, SfileadrL); + + ret= Xorriso_search_hardlinks(xorriso, node, &node_idx, &min_hl, &max_hl, + 2 | 4); + if(ret < 0) + goto ex; + if(ret == 0 || min_hl == max_hl) + {ret= 0; goto ex;} + + for(i= min_hl; i < node_idx; i++) { + link_sibling= 1; + ret= Xorriso_path_from_node(xorriso, xorriso->node_array[i], img_path, 0); + if(ret < 0) + goto ex; + if(ret == 0) + continue; /* Node is deleted from tree (Should not happen here) */ + hflag= 1; + if(i == min_hl) { + hflag= 0; + } else if(xorriso->node_array[i] != xorriso->node_array[i - 1]) { + hflag= 0; + } + if(hflag == 0) { + img_prefixes= xorriso->node_img_prefixes; + disk_prefixes= xorriso->node_disk_prefixes; + } + ret= Xorriso_make_restore_path(xorriso, &img_prefixes, &disk_prefixes, + img_path, old_path, hflag); + if(ret <= 0) + goto ex; + ret= Xorriso_restore_make_hl(xorriso, old_path, disk_path, + !!xorriso->do_auto_chmod); + if(ret > 0) + {ret= 1; goto ex;} + } + ret= link_sibling << 2; +ex:; + Xorriso_free_meM(old_path); + Xorriso_free_meM(img_path); + return(ret); +} + + +/* @return <0 = error , 0 = availmem exhausted first time , 1 = ok + 2 = availmem exhausted repeated +*/ +int Xorriso_register_node_target(struct XorrisO *xorriso, int node_idx, + char *disk_path, int flag) +{ + int l; + + if(xorriso->node_targets_availmem == 0) + return(2); + if(xorriso->hln_targets == NULL || node_idx < 0 || + node_idx >= xorriso->hln_count) + return(0); + if(xorriso->hln_targets[node_idx] != NULL) { + xorriso->node_targets_availmem+= strlen(xorriso->hln_targets[node_idx]) +1; + free(xorriso->hln_targets[node_idx]); + } + l= strlen(disk_path); + if(xorriso->node_targets_availmem <= l + 1) { + sprintf(xorriso->info_text, + "Hardlink target buffer exceeds -temp_mem_limit. Hardlinks may get divided."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->node_targets_availmem= 0; + return(0); + } + xorriso->hln_targets[node_idx]= strdup(disk_path); + if(xorriso->hln_targets[node_idx] == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + return(-1); + } + xorriso->node_targets_availmem-= (l + 1); + return(1); +} + + +/* + @param flag bit0= offset and bytes is valid for writing to regular file + bit1= do not report copied files + bit2= -follow, -not_*: this is not a command parameter + bit3= keep directory open: keep owner, allow rwx for owner + bit4= do not look for hardlinks even if enabled + bit6= this is a copy action: do not fake times and ownership + bit7= return 4 if restore fails from denied permission + do not issue error message + @return <=0 = error , 1 = added leaf file object , 2 = added directory , + 3= regularly not installed (disallowed device, UNIX domain socket) + 4 = with bit7: permission to restore was denied +*/ +int Xorriso_restore_disk_object(struct XorrisO *xorriso, + char *img_path, IsoNode *node, + char *disk_path, + off_t offset, off_t bytes, int flag) +{ + int ret, i, split_count= 0, partno, total_parts, leaf_is_split= 0; + int record_hl_path= 0, node_idx, cannot_register= 0; + off_t total_bytes; + char *part_name, *part_path= NULL, *img_path_pt; + IsoImage *volume; + IsoNode *part_node, *first_part_node= NULL; + struct SplitparT *split_parts= NULL; + struct stat stbuf; + + Xorriso_alloc_meM(part_path, char, SfileadrL); + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + if(LIBISO_ISDIR(node) && xorriso->do_concat_split) + leaf_is_split= Xorriso_identify_split(xorriso, img_path, node, + &split_parts, &split_count, &stbuf, 1|2); + if(leaf_is_split) { + /* map all files in directory img_path into regular file disk_path */ + + for(i=0 ; i<split_count; i++) { + Splitparts_get(split_parts, i, &part_name, &partno, &total_parts, + &offset, &bytes, &total_bytes, 0); + + strcpy(part_path, img_path); + if(Sfile_add_to_path(part_path, part_name, 0)<=0) { + Xorriso_much_too_long(xorriso, strlen(img_path)+strlen(part_name)+1, 2); + goto restoring_failed; + } + ret= Xorriso_node_from_path(xorriso, volume, part_path, &part_node, 0); + if(ret<=0) + goto restoring_failed; + if(i==0) + first_part_node= part_node; + if(offset+bytes>total_bytes) + bytes= total_bytes-offset; + ret= Xorriso_tree_restore_node(xorriso, part_node, part_path, (off_t) 0, + disk_path, offset, bytes, + (!!(flag&64)) | 2 | (flag & (4 | 128)) | 8 | ( 16 * !(flag&2))); + if(ret<=0) + goto restoring_failed; + if(ret == 4) + goto ex; + } + if(first_part_node!=NULL) + Xorriso_restore_properties(xorriso, disk_path, first_part_node, + !!(flag&64)); + goto went_well; + } + +#ifdef Osirrox_not_yeT + + if(resolve_link) { + ret= Xorriso_resolve_link(xorriso, disk_path, resolved_disk_path, 0); + if(ret<=0) + goto ex; + disk_path_pt= resolved_disk_path; + } else + +#endif /* Osirrox_not_yeT */ + + img_path_pt= img_path; + + if(!((xorriso->ino_behavior & 4) || (flag & (1 | 16)) || LIBISO_ISDIR(node))){ + /* Try to restore as hardlink */ + ret= Xorriso_restore_target_hl(xorriso, node, disk_path, &node_idx, + !!xorriso->do_auto_chmod); + if(ret < 0) { + goto ex; + } else if(ret & 1) { + /* Success, hardlink was created */ + goto went_well; + } else if(ret & 2) { + /* Did not establish hardlink. Hardlink siblings with target NULL found.*/ + record_hl_path= 1; + } + if(ret & 4) { + /* Found siblings with non-NULL target, but did not link. */ + ret= Xorriso_eval_problem_status(xorriso, 1, 1 | 2); + if(ret < 0) + {ret= 0; goto ex;} + } + } + + ret= Xorriso_tree_restore_node(xorriso, node, img_path_pt, (off_t) 0, + disk_path, offset, bytes, + (flag&(4 | 8 | 128)) | (!!(flag&64)) | ((flag&1)<<1) | ( 16 * !(flag&2))); + if(ret == 4) + goto ex; + if(ret>0 && (flag&8)) + ret= Xorriso_restore_properties(xorriso, disk_path, node, 2 | !!(flag&64)); + if(ret<=0) { +restoring_failed:; + sprintf(xorriso->info_text, "Restoring failed: "); + Text_shellsafe(img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " = "); + Text_shellsafe(disk_path, xorriso->info_text, 1 | 2); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + {ret= 0; goto ex;} + } + if(ret==2) + {ret= 3; goto ex;} + if(record_hl_path) { /* Start of a disk hardlink family */ + ret= Xorriso_register_node_target(xorriso, node_idx, disk_path, 0); + if(ret < 0) + goto ex; + if(ret == 0) + cannot_register= 1; + } + +went_well:; + xorriso->pacifier_count++; + if(!(flag&2)) + Xorriso_pacifier_callback(xorriso, "files restored", + xorriso->pacifier_count, + xorriso->pacifier_total, "", 4); + ret= 1; +ex:; + if(split_parts!=NULL) + Splitparts_destroy(&split_parts, split_count, 0); + Xorriso_free_meM(part_path); + if(ret > 0 && cannot_register) + ret= 0; + return(ret); +} + + +/* @param flag bit0= source is a directory and not to be restored as split file + >>> bit6= permission to call Xorriso_make_accessible() + @return <=0 error , 1=collision handled , 2=no collision , 3=revoked by user +*/ +int Xorriso_handle_collision(struct XorrisO *xorriso, + IsoNode *node, char *img_path, + char *disk_path, char *nominal_disk_path, + int *stbuf_ret, int flag) +{ + int ret, target_is_dir= 0, target_is_link= 0, stat_ret, made_accessible= 0; + struct stat target_stbuf, lt_stbuf; + struct PermiteM *perm_stack_mem; + + perm_stack_mem= xorriso->perm_stack; + + /* does a disk file exist with this name ? */ + *stbuf_ret= lstat(disk_path, &target_stbuf); + if(*stbuf_ret==-1) { + if((flag & 64) && errno == EACCES) { + ret= Xorriso_make_accessible(xorriso, disk_path, 0); + if(ret < 0) + goto ex; + made_accessible= 1; + *stbuf_ret= lstat(disk_path, &target_stbuf); + } + if(*stbuf_ret==-1) + {ret= 2; goto ex;} + } + target_is_link= S_ISLNK(target_stbuf.st_mode); + if(target_is_link) { + stat_ret= stat(disk_path, <_stbuf); + if(stat_ret == -1) { + if((flag & 64) && errno == EACCES && !made_accessible) { + ret= Xorriso_make_accessible(xorriso, disk_path, 0); + if(ret < 0) + goto ex; + made_accessible= 1; + stat_ret= stat(disk_path, <_stbuf); + } + } + if(stat_ret != -1) + target_is_dir= S_ISDIR(lt_stbuf.st_mode); + } else { + target_is_dir= S_ISDIR(target_stbuf.st_mode); + } + if(target_is_dir && (!target_is_link) && !(flag&1)) { + strcpy(xorriso->info_text, "Attempt to replace DISK directory "); + Text_shellsafe(nominal_disk_path, + xorriso->info_text+strlen(xorriso->info_text), 0); + strcat(xorriso->info_text, " by ISO file "); + Text_shellsafe(img_path, xorriso->info_text+strlen(xorriso->info_text), 0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + if(!(target_is_dir && (flag&1))) { + Xorriso_process_msg_queues(xorriso,0); + ret= Xorriso_restore_overwrite(xorriso, node, img_path, disk_path, + nominal_disk_path, &target_stbuf, 16 | (flag & 64)); + if(ret==3) + {ret= 3; goto ex;} + if(ret<=0) + goto ex; + *stbuf_ret= -1; /* It might still exist but will be handled properly */ + } + ret= 1; +ex:; + if(made_accessible) + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + return(ret); +} + + +/* @param flag bit0= recursion is active + bit1= do not report restored files + bit6= this is a copy action: do not fake times and ownership + bit8= only register non-directory nodes in xorriso->node_array + bit7+8= + 0= direct operation + 1= create only directories, + count nodes in xorriso->node_counter + 2= only register non-directory nodes in + xorriso->node_array + 3= count nodes in xorriso->node_counter, + create no directory +*/ +int Xorriso_restore_tree(struct XorrisO *xorriso, IsoDir *dir, + char *img_dir_path, char *disk_dir_path, + off_t boss_mem, + struct LinkiteM *link_stack, int flag) +{ + IsoImage *volume; + IsoNode *node; + IsoDirIter *iter= NULL; + IsoNode **node_array= NULL; + int node_count, node_idx; + int ret, source_is_dir, fret, was_failure= 0; + int do_not_dive, source_is_split= 0, len_dp, len_ip, stbuf_ret, hflag, hret; + char *name, *disk_name, *leaf_name, *srcpt, *stbuf_src= ""; + struct LinkiteM *own_link_stack; + char *sfe= NULL, *sfe2= NULL; + char *disk_path= NULL, *img_path= NULL, *link_target= NULL; + off_t mem; + struct PermiteM *perm_stack_mem; + struct stat stbuf; + int dir_create= 0, node_register= 0, do_node_count= 0, normal_mode= 0; + + perm_stack_mem= xorriso->perm_stack; + switch((flag >> 7) & 3) { + case 0: normal_mode= 1; + break; case 1: dir_create= 1; + break; case 2: node_register= 1; + break; case 3: do_node_count= 1; + } + + /* Avoiding large local memory objects in order to save stack space */ + sfe= malloc(5*SfileadrL); + sfe2= malloc(5*SfileadrL); + disk_path= malloc(2*SfileadrL); + img_path= malloc(2*SfileadrL); + link_target= malloc(SfileadrL); + if(sfe==NULL || sfe2==NULL || disk_path==NULL || img_path==NULL || + link_target==NULL) { + Xorriso_no_malloc_memory(xorriso, &sfe, 0); + {ret= -1; goto ex;} + } + + own_link_stack= link_stack; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + stbuf_src= img_dir_path; + node= (IsoNode *) dir; + ret= Xorriso_fake_stbuf(xorriso, stbuf_src, &stbuf, &node, 1); + if(ret<=0) { + Xorriso_msgs_submit(xorriso, 0, disk_dir_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text,"Cannot open as (ISO) source directory: %s", + Text_shellsafe(img_dir_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + +#ifdef Osirrox_not_yeT + + dev_t dir_dev; + dir_dev= stbuf.st_dev; + + if(S_ISLNK(stbuf.st_mode)) { + if(!(xorriso->do_follow_links || (xorriso->do_follow_param && !(flag&1)))) + {ret= 2; goto ex;} + stbuf_src= disk_dir_path; + if(stat(disk_dir_path, &stbuf)==-1) + goto cannot_open_dir; + if(dir_dev != stbuf.st_dev && + !(xorriso->do_follow_mount || (xorriso->do_follow_param && !(flag&1)))) + {ret= 2; goto ex;} + } + +#endif /* Osirrox_not_yeT */ + + if(!S_ISDIR(stbuf.st_mode)) { + Xorriso_msgs_submit(xorriso, 0, disk_dir_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text,"Is not a directory in ISO image: %s", + Text_shellsafe(img_dir_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + mem= boss_mem; + ret= Xorriso_findi_iter(xorriso, dir, &mem, &iter, &node_array, &node_count, + &node_idx, &node, + 1 | 4 * (normal_mode && (xorriso->ino_behavior & 4))); + if(ret<=0) + goto ex; + + if(Sfile_str(img_path, img_dir_path,0)<=0) { +much_too_long:; + Xorriso_much_too_long(xorriso, SfileadrL, 2); + {ret= 0; goto ex;} + } + if(img_path[0]==0 || img_path[strlen(img_path)-1]!='/') + strcat(img_path,"/"); + name= img_path+strlen(img_path); + if(Sfile_str(disk_path, disk_dir_path, 0)<=0) + goto much_too_long; + if(disk_path[0]==0 || disk_path[strlen(disk_path)-1]!='/') + strcat(disk_path,"/"); + disk_name= disk_path+strlen(disk_path); + + len_dp= strlen(disk_path); + len_ip= strlen(img_path); + + while(1) { /* loop over ISO directory content */ + stbuf_src= ""; + +#ifdef Osirrox_not_yeT + + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + +#endif + + srcpt= img_path; + Xorriso_process_msg_queues(xorriso,0); + ret= Xorriso_findi_iter(xorriso, dir, &mem, &iter, &node_array, &node_count, + &node_idx, &node, 0); + if(ret<0) + goto ex; + if(ret==0 || xorriso->request_to_abort) + break; + leaf_name= (char *) iso_node_get_name(node); + if(Xorriso_much_too_long(xorriso, len_dp + strlen(leaf_name)+1, 0)<=0) + {ret= 0; goto was_problem;} + if(Xorriso_much_too_long(xorriso, len_ip + strlen(leaf_name)+1, 0)<=0) + {ret= 0; goto was_problem;} + /* name is a pointer into img_path */ + strcpy(name, leaf_name); + strcpy(disk_name, leaf_name); + + stbuf_src= srcpt; + ret= Xorriso_fake_stbuf(xorriso, img_path, &stbuf, &node, 1); + if(ret<=0) + goto was_problem; + source_is_dir= 0; + +#ifdef Osirrox_not_yeT + + /* ??? Link following in the image would cause severe problems + with Xorriso_path_from_node() */ + + int source_is_link; + + source_is_link= S_ISLNK(stbuf.st_mode); + if(xorriso->do_follow_links && source_is_link) { + /* Xorriso_hop_link checks for wide link loops */ + ret= Xorriso_hop_link(xorriso, srcpt, &own_link_stack, &hstbuf, 0); + if(ret<0) + goto was_problem; + if(ret==1) { + ret= Xorriso_resolve_link(xorriso, srcpt, link_target, 0); + if(ret<=0) + goto was_problem; + srcpt= link_target; + stbuf_src= srcpt; + if(lstat(srcpt, &stbuf)==-1) + goto cannot_lstat; + } else { + if(Xorriso_eval_problem_status(xorriso, 0, 1|2)<0) + {ret= 0; goto was_problem;} + } + } else if (S_ISLNK(stbuf.st_mode)) { + ret= Xorriso_resolve_link(xorriso, srcpt, link_target, 1); + if(ret<=0) + goto was_problem; + } + +#endif /* Osirrox_not_yeT */ + + do_not_dive= 0; + if(S_ISDIR(stbuf.st_mode)) + source_is_dir= 1; + source_is_split= 0; + if(source_is_dir) + source_is_split= Xorriso_is_split(xorriso, img_path, node, 1|2); + if(source_is_split) + do_not_dive= 1; + + if(source_is_dir || !(dir_create || do_node_count || node_register)) { + ret= Xorriso_handle_collision(xorriso, node, img_path, + disk_path, disk_path, &stbuf_ret, + (source_is_dir && !source_is_split)); + if(ret<=0 || ret==3) + goto was_problem; + } else { + stbuf_ret= -1; + } + + if(stbuf_ret!=-1) { /* (Can only happen with directory) */ + Xorriso_auto_chmod(xorriso, disk_path, 0); + } else { + hflag= 4 | (flag & (2|64)); + if(source_is_dir && !do_not_dive) + hflag|= 8; /* keep directory open for user */ + if((dir_create || do_node_count) && !source_is_dir) { + xorriso->node_counter++; + } else if(node_register && !source_is_dir) { + if(xorriso->node_counter < xorriso->node_array_size) { + xorriso->node_array[xorriso->node_counter++]= (void *) node; + iso_node_ref(node); + } + } else if(node_register || do_node_count) { + ret= 1; + } else { + ret= Xorriso_restore_disk_object(xorriso, img_path, node, disk_path, + (off_t) 0, (off_t) 0, hflag); + } + if(ret<=0) + goto was_problem; + } + if(source_is_dir && !do_not_dive) { + ret= Xorriso_restore_tree(xorriso, (IsoDir *) node, + img_path, disk_path, mem, + own_link_stack, 1 | (flag & (2 | (3 << 7)))); + /* eventually restore exact access permissions of directory */ + hret= Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, + !!(flag&64)); + if(hret<=0 && hret<ret) + ret= hret; + if(ret<=0) + goto was_problem; + } + + continue; /* regular bottom of loop */ +was_problem:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret<0) + goto ex; + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, !!(flag&64)); + } + + ret= 1; +ex: + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, !!(flag&64)); + if(sfe!=NULL) + free(sfe); + if(sfe2!=NULL) + free(sfe2); + if(disk_path!=NULL) + free(disk_path); + if(img_path!=NULL) + free(img_path); + if(link_target!=NULL) + free(link_target); + Xorriso_findi_iter(xorriso, dir, &mem, &iter, &node_array, &node_count, + &node_idx, &node, (1<<31)); + + Xorriso_process_msg_queues(xorriso,0); + +#ifdef Osirrox_not_yeT + + Linkitem_reset_stack(&own_link_stack, link_stack, 0); + +#endif + + if(ret<=0) + return(ret); + return(!was_failure); +} + + +/* + @param flag + >>> bit0= mkdir: graft in as empty directory, not as copy from iso + bit1= do not report copied files + bit2= -follow, -not_*: this is not a command parameter + bit3= use offset and cut_size for -paste_in + bit4= return 3 on rejection by exclusion or user + bit5= if directory then do not add sub tree + bit6= this is a copy action: do not fake times and ownership + bit7+8= operation mode + 0= direct operation + 1= create only directories, + count nodes in xorriso->node_counter + 2= only register non-directory nodes in + xorriso->node_array + 3= count nodes in xorriso->node_counter, + create no directory + bit9= with operation mode 1 do net register prefixes + @return <=0 = error , 1 = added leaf file object , 2 = added directory , + 3 = rejected +*/ +int Xorriso_restore(struct XorrisO *xorriso, + char *img_path, char *disk_path, + off_t offset, off_t bytes, int flag) +{ + IsoImage *volume; + char *path= NULL, *apt, *npt; + IsoNode *node= NULL; + int done= 0, is_dir= 0, ret, source_is_dir, stbuf_ret, hret; + int dir_create= 0, node_count= 0, node_register= 0, path_size; + int leaf_is_split= 0, source_is_split= 0, new_dir_made= 0; + struct stat stbuf; + struct PermiteM *perm_stack_mem; + + perm_stack_mem= xorriso->perm_stack; + + path_size= SfileadrL; + Xorriso_alloc_meM(path, char, path_size); + + switch((flag >> 7) & 3) { + case 1: dir_create= 1; + break; case 2: node_register= 1; + break; case 3: node_count= 1; + } + + if(dir_create && !(flag & (1 << 9))) { + ret= Xorriso_lst_append_binary(&(xorriso->node_disk_prefixes), + disk_path, strlen(disk_path) + 1, 0); + if(ret <= 0) + goto ex; + ret= Xorriso_lst_append_binary(&(xorriso->node_img_prefixes), + img_path, strlen(img_path) + 1, 0); + if(ret <= 0) + goto ex; + } + + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4)); + if(ret<0) + goto ex; + if(ret>0) + {ret= 3*!!(flag&16); goto ex;} + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + + strncpy(path, disk_path, path_size - 1); + path[path_size - 1]= 0; + apt= npt= path; + + if(!(flag&1)) { + ret= Xorriso_fake_stbuf(xorriso, img_path, &stbuf, &node, 0); + if(ret>0) { + if(S_ISDIR(stbuf.st_mode)) + is_dir= 1; + +#ifdef Osirrox_not_yeT + + /* ??? this would cause severe problems with Xorriso_path_from_node() */ + + else if((stbuf.st_mode&S_IFMT)==S_IFLNK && + (xorriso->do_follow_links || + (xorriso->do_follow_param && !(flag&4)))) { + resolve_link= 1; + ret= Xorriso_iso_lstat(xorriso, img_path, &stbuf, 1|2); + if(ret!=-1) { + if(S_ISDIR(stbuf.st_mode)) + is_dir= 1; + } + } +#endif /* Osirrox_not_yeT */ + + } else { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "Cannot determine attributes of (ISO) source file "); + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto ex; + } + if(is_dir && xorriso->do_concat_split) + leaf_is_split= Xorriso_is_split(xorriso, img_path, node, 1|2); + } + for(npt= apt; !done; apt= npt+1) { + npt= strchr(apt, '/'); + if(npt==NULL) { + npt= apt+strlen(apt); + done= 1; + } else + *npt= 0; + if(*apt==0) { + *apt= '/'; + apt++; + if(done) + goto attach_source; + continue; + } + source_is_dir= (is_dir || (flag&1) || !done); + source_is_split= done && leaf_is_split; + + stbuf_ret= -1; + if((flag&8) && done) { + + /* ??? move down from Xorriso_paste_in() : + check whether target does not exist or both are regular */; + + } else if(source_is_dir || !(dir_create || node_count || node_register)) { + ret= Xorriso_handle_collision(xorriso, node, img_path, path, disk_path, + &stbuf_ret, (source_is_dir && !source_is_split)); + if(ret<=0 || ret==3) + goto ex; + } + + new_dir_made= 0; + if(stbuf_ret==-1 && (source_is_dir && !source_is_split) && + !(node_count || node_register)) { + /* make a directory */ + ret= mkdir(path, 0777); + if(ret==-1) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_msgs_submit(xorriso, 0, disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, + "While restoring '%s' : could not insert '%s'", disk_path, path); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + {ret= 0; goto ex;} + } + if(!done) { + /* keep rwx for the owner */ + Xorriso_restore_implicit_properties(xorriso, disk_path, path, + img_path, 4); + } + new_dir_made= 1; + } else if((source_is_dir && !source_is_split)) { + if(!(node_count || node_register)) + Xorriso_auto_chmod(xorriso, path, 0); + } + if(done) { +attach_source:; + + if(flag&1) { + /* directory was created above */; + + } else if(is_dir && !source_is_split) { + + if(!node_register) { + if(new_dir_made) { /* keep open and push to Permstack */ + ret= Xorriso_restore_properties(xorriso, disk_path, node, + 2 | !!(flag&64)); + if(ret <= 0) { + hret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(hret < 0) + goto ex; + } + } + } + if(!(flag&32)) { + ret= Xorriso_restore_tree(xorriso, (IsoDir *) node, img_path, path, + (off_t) 0, NULL, flag & (2 | 64 | (3 << 7))); + if(ret <= 0) { + hret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(hret < 0) + goto ex; + } + if(new_dir_made && !(flag&64)) + /* set timestamps which Permstack_pop() will not set */ + Xorriso_restore_properties(xorriso, disk_path, node, 2); + } + } else { + if(dir_create || node_count) { + xorriso->node_counter++; + } else if(node_register) { + if(xorriso->node_counter < xorriso->node_array_size) { + xorriso->node_array[xorriso->node_counter++]= (void *) node; + iso_node_ref(node); + } + } else { + ret= Xorriso_restore_disk_object(xorriso, img_path, node, path, + offset, bytes, (flag & (2|4|64)) | !!(flag&8)); + if(ret <= 0) { + hret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); + if(hret < 0) + goto ex; + } + } + } + } else + *npt= '/'; + } + Xorriso_process_msg_queues(xorriso,0); + ret= 1 + (is_dir && !leaf_is_split); +ex:; + /* restore exact access permissions of stacked paths */ + hret= Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, + 2 | !!(flag&64)); + if(hret<=0 && hret<ret) + ret= hret; + Xorriso_free_meM(path); + return(ret); +} + + +int Xorriso_restore_node_array(struct XorrisO *xorriso, int flag) +{ + int i, ret, fret, hflag, stbuf_ret, faulty_family= 0; + struct PermiteM *perm_stack_mem; + char *img_path= NULL, *disk_path= NULL; + IsoNode *node; + struct Xorriso_lsT *img_prefixes= NULL, *disk_prefixes= NULL; + + perm_stack_mem= xorriso->perm_stack; + + Xorriso_alloc_meM(img_path, char, SfileadrL); + Xorriso_alloc_meM(disk_path, char, SfileadrL); + + Xorriso_sort_node_array(xorriso, 0); + + disk_path[0]= 0; + for(i= 0; i < xorriso->node_counter; i++) { + node= (IsoNode *) xorriso->node_array[i]; + ret= Xorriso_path_from_node(xorriso, node, img_path, 0); + if(ret < 0) + goto ex; + if(ret == 0) + continue; /* Node is deleted from tree (Should not happen here) */ + hflag= 1; + if(i == 0) { + hflag= 0; + } else if(node != xorriso->node_array[i - 1]) { + hflag= 0; + } + if(hflag == 0) { + img_prefixes= xorriso->node_img_prefixes; + disk_prefixes= xorriso->node_disk_prefixes; + } + ret= Xorriso_make_restore_path(xorriso, &img_prefixes, &disk_prefixes, + img_path, disk_path, hflag); + if(ret<=0) + goto was_problem; + + ret= Xorriso_handle_collision(xorriso, node, img_path, disk_path, disk_path, + &stbuf_ret, 64); + if(ret<=0 || ret==3) + goto was_problem; + if(xorriso->hln_array != NULL && !(xorriso->ino_behavior & 16)) { + /* Eventual lookup of hardlinks will be done in + Xorriso_restore_disk_object() */; + } else if(i > 0 && !(xorriso->ino_behavior & 4)) { + if(Xorriso__findi_sorted_ino_cmp(&(xorriso->node_array[i-1]), + &(xorriso->node_array[i])) == 0) { + if(faulty_family) { + sprintf(xorriso->info_text, "Hardlinking omitted with "); + Text_shellsafe(disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } else { + /* Try to install hardlink to a sibling */ + ret= Xorriso_restore_prefix_hl(xorriso, node, disk_path, i, 0); + if(ret < 0) { + goto was_problem; + } else if(ret & 1) { + /* Success, hardlink was created */ + xorriso->pacifier_count++; + continue; + } + if(ret & 4) { + /* Found elder siblings, but did not link. */ + ret= Xorriso_eval_problem_status(xorriso, 1, 1 | 2); + if(ret < 0) + {ret= 0; goto ex;} + } + } + } else + faulty_family= 0; + } + + ret= Xorriso_restore_disk_object(xorriso, img_path, node, disk_path, + (off_t) 0, (off_t) 0, + 4 | (xorriso->ino_behavior & 16) | 128); + if(ret<=0) + goto was_problem; + if(ret == 4) { + /* Failed from lack of permission */ + ret= Xorriso_make_accessible(xorriso, disk_path, 0); + if(ret < 0) + goto ex; + ret= Xorriso_restore_disk_object(xorriso, img_path, node, disk_path, + (off_t) 0, (off_t) 0, 4 | (xorriso->ino_behavior & 16)); + if(ret<=0) + goto was_problem; + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + } + + continue; /* regular bottom of loop */ +was_problem:; + faulty_family= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret<0) + goto ex; + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + } + ret= 1; +ex:; + Permstack_pop(&(xorriso->perm_stack), perm_stack_mem, xorriso, 0); + Xorriso_free_meM(img_path); + Xorriso_free_meM(disk_path); + return(ret); +} + + +/* @param flag bit0= -follow, -not: disk_path is not a command parameter +*/ +int Xorriso_paste_in(struct XorrisO *xorriso, char *disk_path, + off_t startbyte, off_t bytecount, char *iso_rr_path, int flag) +{ + int ret; + char *eff_source= NULL, *eff_dest= NULL; + struct stat stbuf; + IsoNode *node; + + Xorriso_alloc_meM(eff_source, char, SfileadrL); + Xorriso_alloc_meM(eff_dest, char, SfileadrL); + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_dest, + 2|4); + if(ret<=0) + goto ex; + ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&1)); + if(ret!=0) + {ret= 0; goto ex;} + ret= stat(eff_dest, &stbuf); + if(ret!=-1 && !S_ISREG(stbuf.st_mode)) { + Xorriso_msgs_submit(xorriso, 0, eff_dest, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "-paste_in: DISK file "); + Text_shellsafe(eff_source, xorriso->info_text, 1); + strcat(xorriso->info_text, " exists and is not a data file"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, iso_rr_path, + eff_source, 2); + if(ret<=0) + goto ex; + ret= Xorriso_fake_stbuf(xorriso, eff_source, &stbuf, &node, 4); + if(ret<=0) + {ret= 0; goto ex;} + if(!S_ISREG(stbuf.st_mode)) { + Xorriso_msgs_submit(xorriso, 0, eff_dest, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "-paste_in: ISO file "); + Text_shellsafe(eff_source, xorriso->info_text, 1); + strcat(xorriso->info_text, " is not a data file"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + + /* >>> eventually obtain parameters from file name */; + + ret= Xorriso_restore(xorriso, eff_source, eff_dest, startbyte, bytecount, 8); +ex:; + Xorriso_free_meM(eff_source); + Xorriso_free_meM(eff_dest); + return(ret); +} + + +int Xorriso_extract_cut(struct XorrisO *xorriso, + char *img_path, char *disk_path, + off_t img_offset, off_t bytes, int flag) +{ + int ret, stbuf_ret, read_raw; + double mem_lut= 0.0; + char *eff_img_path= NULL, *eff_disk_path= NULL; + IsoImage *volume; + IsoNode *node; + + Xorriso_alloc_meM(eff_img_path, char, SfileadrL); + Xorriso_alloc_meM(eff_disk_path, char, SfileadrL); + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, + img_path, eff_img_path, 0); + if(ret<=0) + goto ex; + ret= Xorriso_node_from_path(xorriso, volume, eff_img_path, &node, 0); + if(ret<=0) + goto ex; + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, + disk_path, eff_disk_path, 2 | 4); + if(ret<=0) + goto ex; + Xorriso_pacifier_reset(xorriso, 0); + mem_lut= xorriso->last_update_time; + + ret= Xorriso_handle_collision(xorriso, node, img_path, eff_disk_path, + disk_path, &stbuf_ret, 0); + if(ret<=0 || ret==3) + {ret= 0; goto ex;} + + /* If it is a non-filtered stream from the ISO image + and img_offset is a multiple of 2048 + then use Xorriso_read_file_data() for random access offset. + */ + if(!LIBISO_ISREG(node)) { + Xorriso_msgs_submit(xorriso, 0, eff_disk_path, 0, "ERRFILE", 0); + sprintf(xorriso->info_text, "-extract_cut: ISO file "); + Text_shellsafe(eff_img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, " is not a data file"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + read_raw= 0; + if((img_offset % 2048) == 0) { + ret= Xorriso_is_plain_image_file(xorriso, node, "", 0); + if(ret > 0) + read_raw= 1; + } + if (read_raw) { + ret= Xorriso_read_file_data(xorriso, node, eff_img_path, eff_disk_path, + img_offset, (off_t) 0, bytes, 0); + if(ret<=0) + goto ex; + } else { + ret= Xorriso_tree_restore_node(xorriso, node, eff_img_path, img_offset, + eff_disk_path, (off_t) 0, bytes, 2 | 8); + if(ret<=0) + goto ex; + } + + ret= Xorriso_restore_properties(xorriso, eff_disk_path, node, 0); + if(ret<=0) + goto ex; + + if(mem_lut != xorriso->last_update_time) + Xorriso_pacifier_callback(xorriso, "sectors examined", + xorriso->pacifier_count, 0, "", 1); + ret= 1; +ex:; + Xorriso_free_meM(eff_img_path); + Xorriso_free_meM(eff_disk_path); + return(ret); +} + + +/* @param flag bit1= for Xorriso_check_interval(): no pacifier messages +*/ +int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node, + char *img_path, char *disk_path, + off_t img_offset, off_t disk_offset, + off_t bytes, int flag) +{ + int ret, i, lba_count= 0, *start_lbas= NULL, *end_lbas= NULL, read_chunk= 16; + int lba, count, blocks, quality, spot, bad_extract= 0; + off_t size= 0, file_base_bytes= 0, file_processed_bytes= 0, img_adr; + off_t new_file_base_bytes, upto_file_bytes, start_byte= 0; + struct SpotlisT *spotlist= NULL; + struct CheckmediajoB *job= NULL; + + upto_file_bytes= img_offset + bytes; + + /* >>> make Xorriso_check_interval() ready for copying in byte granularity */ + if(img_offset % (off_t) 2048) { + sprintf(xorriso->info_text, + "Image address offset is not a multiple of 2048"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + ret= Xorriso__start_end_lbas(node, &lba_count, &start_lbas, &end_lbas, &size, + 0); + if(ret <= 0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, "File object "); + Text_shellsafe(img_path, xorriso->info_text, 1); + strcat(xorriso->info_text, + " is currently not a data file from the loaded image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + goto ex; + } + if(img_offset + bytes < size && bytes > 0) + size= img_offset + bytes; + + ret= Checkmediajob_new(&job, 0); + if(ret <= 0) + goto ex; + if(xorriso->check_media_default != NULL) + Checkmediajob_copy(xorriso->check_media_default, job, 0); + job->min_lba= -1; + job->max_lba= -1; + job->sector_map_path[0]= 0; + + ret= Spotlist_new(&spotlist, 0); + if(ret <= 0) + {ret= -1; goto ex;} + + if(Sfile_str(job->data_to_path, disk_path, 0) <= 0) + {ret= -1; goto ex;} + Xorriso_open_job_data_to(xorriso, job, 0); + if(ret <= 0) + goto ex; + + for(i= 0; i < lba_count && file_base_bytes < upto_file_bytes; i++) { + lba= start_lbas[i]; + count= end_lbas[i] + 1 - start_lbas[i]; + new_file_base_bytes= file_base_bytes + ((off_t) count) * (off_t) 2048; + + /* skip intervals before img_offset */ + if(new_file_base_bytes <= img_offset) { + file_base_bytes= new_file_base_bytes; + continue; + } + /* Eventually adjust first interval start */ + img_adr= ((off_t) lba) * (off_t) 2048; + if(file_base_bytes < img_offset) { + img_adr+= img_offset - file_base_bytes; + lba= img_adr / (off_t) 2048; + count= end_lbas[i] + 1 - lba; + file_base_bytes= img_offset; + } + + /* Eventually omit surplus blocks */ + if(new_file_base_bytes > upto_file_bytes) + count-= (new_file_base_bytes - upto_file_bytes) / (off_t) 2048; + /* Adjust job */ + job->data_to_offset= file_processed_bytes - img_adr + disk_offset; + job->data_to_limit= size - file_base_bytes; + + file_processed_bytes+= ((off_t) count) * (off_t) 2048; + ret= Xorriso_check_interval(xorriso, spotlist, job, lba, count, read_chunk, + 0, (flag & 2)); + if(ret <= 0) + goto ex; + if (ret == 2) { + sprintf(xorriso->info_text, "Attempt aborted to extract data from "); + Text_shellsafe(img_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + file_base_bytes= new_file_base_bytes; + } + + /* Use spotlist to evaluate damage */ + file_base_bytes= 0; + count= Spotlist_count(spotlist, 0); + for(spot= 0; spot < count; spot++) { + ret= Spotlist_get_item(spotlist, spot, &lba, &blocks, &quality, 0); + if(ret <= 0) + continue; + if(quality < Xorriso_read_quality_valiD) { + for(i= 0; i < lba_count; i++) { + if(start_lbas[i] <= lba && end_lbas[i] >= lba) { + start_byte= (lba - start_lbas[i]) * (off_t) 2048 + file_base_bytes; + break; + } + file_base_bytes+= ((off_t) (end_lbas[i] + 1 - start_lbas[i])) + * (off_t) 2048; + } + if(i < lba_count) { + sprintf(xorriso->info_text, "Bad extract : %14.f , %14.f , ", + (double) start_byte, ((double) blocks) * 2048.0); + Text_shellsafe(disk_path, xorriso->info_text, 1); + strcat(xorriso->info_text, "\n"); + Xorriso_info(xorriso, 0); + bad_extract= 1; + } + } + } + + ret= !bad_extract; +ex:; + if(start_lbas != NULL) + free((char *) start_lbas); + if(end_lbas != NULL) + free((char *) end_lbas); + Spotlist_destroy(&spotlist, 0); + Checkmediajob_destroy(&job, 0); + return(ret); +} + + +/* @param node Opaque handle to IsoNode which is to be inquired instead of path if it is not NULL. + @param path is used as address if node is NULL. + @param flag bit0= do not report to result but only indicate outcome + by return value + bit1= silently ignore nodes without MD5 + bit2= do not only report mismatches but also matches + @return 3= not a data file + 2= no MD5 attached to node + 1= ok, MD5 compared and matching + 0= not ok, MD5 mismatch + <0= other error +*/ +int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path, + int flag) +{ + int ret, wanted, rret, buffer_size= 64 * 1024; + IsoImage *image; + IsoNode *node; + IsoFile *file; + char node_md5[16], data_md5[16], *buffer= NULL; + void *stream= NULL, *ctx= NULL; + off_t todo; + + Xorriso_alloc_meM(buffer, char, 64 * 1024); + + node= (IsoNode *) in_node; + if(node == NULL) { + ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0); + if(ret<=0) + {ret= -1; goto ex;} + } + if(!LIBISO_ISREG(node)) { + strcpy(xorriso->info_text, "-check_md5: Not a data file: "); + Text_shellsafe(path, xorriso->info_text, 1); + if(!(flag & 2)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 3; goto ex; + } + file= (IsoFile *) node; + + /* obtain MD5 */ + ret= Xorriso_get_volume(xorriso, &image, 0); + if(ret <= 0) + {ret= -1; goto ex;} + ret= iso_file_get_md5(image, file, node_md5, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret < 0) + {ret= -1; goto ex;} + if(ret == 0) { + strcpy(xorriso->info_text, "-check_md5: No MD5 recorded with file: "); + Text_shellsafe(path, xorriso->info_text, 1); + if(!(flag & 2)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= 2; goto ex; + } + + /* Read file and compute MD5 */; + ret= Xorriso_iso_file_open(xorriso, path, (void *) node, &stream, 1 | 2); + if(ret <= 0) + {ret= -1; goto ex;} + ret= iso_md5_start(&ctx); + if(ret < 0) + goto ex; + todo= iso_stream_get_size(stream); + while(todo > 0) { + if(todo < buffer_size) + wanted= todo; + else + wanted= buffer_size; + rret = Xorriso_iso_file_read(xorriso, stream, buffer, wanted, 0); + if(rret <= 0) + {ret= -1; goto ex;} + todo-= rret; + ret = iso_md5_compute(ctx, buffer, rret); + if(ret < 0) + goto ex; + xorriso->pacifier_count+= rret; + xorriso->pacifier_byte_count+= rret; + Xorriso_pacifier_callback(xorriso, "content bytes read", + xorriso->pacifier_count, 0, "", 0); + ret= Xorriso_check_for_abort( + xorriso, + xorriso->check_media_default != NULL + ? xorriso->check_media_default->abort_file_path + : "/var/opt/xorriso/do_abort_check_media", + Sfile_microtime(0), &xorriso->last_abort_file_time, 0); + if(ret == 1) + {ret= -2; goto ex;} + } + ret= iso_md5_end(&ctx, data_md5); + if(ret < 0) + goto ex; + + /* Report outcome */ + Xorriso_process_msg_queues(xorriso,0); + if(! iso_md5_match(node_md5, data_md5)) { + sprintf(xorriso->result_line, "MD5 MISMATCH: "); + Text_shellsafe(path, xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + if(!(flag & 1)) + Xorriso_result(xorriso,0); + ret= 0; + } else { + sprintf(xorriso->result_line, "md5 match : "); + Text_shellsafe(path, xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + if(flag & 4) + Xorriso_result(xorriso,0); + ret= 1; + } + +ex:; + Xorriso_process_msg_queues(xorriso,0); + Xorriso_iso_file_close(xorriso, &stream, 0); + if(ctx != NULL) + iso_md5_end(&ctx, data_md5); + Xorriso_free_meM(buffer); + if(ret < 0) { + if(ret == -2) + sprintf(xorriso->result_line, "Aborted at: "); + else + sprintf(xorriso->result_line, "NOT READABLE: "); + Text_shellsafe(path, xorriso->result_line, 1); + strcat(xorriso->result_line, "\n"); + if(!(flag & 1)) + Xorriso_result(xorriso,0); + if(ret == -2) + xorriso->request_to_abort= 1; + } + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/read_run.h b/libisoburn/branches/1.1.8/xorriso/read_run.h new file mode 100644 index 00000000..f06be0e9 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/read_run.h @@ -0,0 +1,70 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of functions which +*/ + + +#ifndef Xorriso_pvt_read_run_includeD +#define Xorriso_pvt_read_run_includeD yes + + +int Xorriso__read_pacifier(IsoImage *image, IsoFileSource *filesource); + +int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path, + IsoNode *node, int flag); + +int Xorriso_restore_implicit_properties(struct XorrisO *xorriso, + char *full_disk_path, char *disk_path, char *full_img_path, int flag); + +int Xorriso_tree_restore_node(struct XorrisO *xorriso, IsoNode *node, + char *img_path, off_t img_offset, + char *disk_path, off_t disk_offset, off_t bytes, + int flag); + +int Xorriso_restore_overwrite(struct XorrisO *xorriso, + IsoNode *node, char *img_path, + char *path, char *nominal_path, + struct stat *stbuf, int flag); + +int Xorriso_restore_target_hl(struct XorrisO *xorriso, IsoNode *node, + char *disk_path, int *node_idx, int flag); + +int Xorriso_restore_prefix_hl(struct XorrisO *xorriso, IsoNode *node, + char *disk_path, int node_idx, int flag); + +int Xorriso_register_node_target(struct XorrisO *xorriso, int node_idx, + char *disk_path, int flag); + +int Xorriso_restore_disk_object(struct XorrisO *xorriso, + char *img_path, IsoNode *node, + char *disk_path, + off_t offset, off_t bytes, int flag); + +int Xorriso_handle_collision(struct XorrisO *xorriso, + IsoNode *node, char *img_path, + char *disk_path, char *nominal_disk_path, + int *stbuf_ret, int flag); + +int Xorriso_restore_tree(struct XorrisO *xorriso, IsoDir *dir, + char *img_dir_path, char *disk_dir_path, + off_t boss_mem, + struct LinkiteM *link_stack, int flag); + +int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node, + char *img_path, char *disk_path, + off_t img_offset, off_t disk_offset, + off_t bytes, int flag); + + + + + + + +#endif /* ! Xorriso_pvt_read_run_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/sfile.c b/libisoburn/branches/1.1.8/xorriso/sfile.c new file mode 100644 index 00000000..e7697ab0 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/sfile.c @@ -0,0 +1,905 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of functions around files and strings. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <pwd.h> +#include <grp.h> + + +#include "sfile.h" + + +/* @param flag bit0= do not clip off carriage return at line end +*/ +char *Sfile_fgets_n(char *line, int maxl, FILE *fp, int flag) +{ + int l; + char *ret; + + ret= fgets(line,maxl,fp); + if(ret==NULL) + return(NULL); + l= strlen(line); + if(l > 0 && !(flag & 1)) if(line[l-1] == '\r') line[--l]= 0; + if(l > 0) if(line[l-1] == '\n') line[--l]= 0; + if(l > 0 && !(flag & 1)) if(line[l-1] == '\r') line[--l]= 0; + return(ret); +} + + +int Sfile_count_components(char *path, int flag) +/* + bit0= do not ignore trailing slash + bit1= do not ignore empty components (other than the empty root name) +*/ +{ + int l,count= 0; + char *cpt; + + l= strlen(path); + if(l==0) + return(0); + count= 1; + for(cpt= path+l-1;cpt>=path;cpt--) { + if(*cpt=='/') { + if(*(cpt+1)==0 && !(flag&1)) + continue; + if(*(cpt+1)=='/' && !(flag&2)) + continue; + count++; + } + } + return(count); +} + + +int Sfile_component_pointer(char *path, char **sourcept, int idx, int flag) +/* + bit0= do not ignore trailing slash + bit1= do not ignore empty components (other than the empty root name) + bit2= accept 0 as '/' +*/ +{ + int count= 0; + char *spt; + + for(spt= path;*spt!=0 || (flag&4);spt++) { + if(count>=idx) { + *sourcept= spt; + return(1); + } + if(*spt=='/' || *spt==0) { + if(*(spt+1)=='/' && !(flag&2)) + continue; + if(*(spt+1)==0 && !(flag&1)) + continue; + count++; + } + } + if((flag&1) && count>=idx) + return(1); + return(0); +} + + +int Sfile_leafname(char *path, char leafname[SfileadrL], int flag) +{ + int count, ret; + char *lpt; + + leafname[0]= 0; + count= Sfile_count_components(path, 0); + if(count==0) + return(0); + ret= Sfile_component_pointer(path, &lpt, count-1, 0); + if(ret<=0) + return(ret); + if(Sfile_str(leafname, lpt, 0)<=0) + return(0); + lpt= strchr(leafname, '/'); + if(lpt!=NULL) + *lpt= 0; + return(1); +} + + +int Sfile_add_to_path(char path[SfileadrL], char *addon, int flag) +{ + int l; + + l= strlen(path); + if(l+1>=SfileadrL) + return(0); + if(l==0) { + strcpy(path,"/"); + l= 1; + } else if(path[l-1]!='/') { + path[l++]= '/'; + path[l]= 0; + } + if(l+strlen(addon)>=SfileadrL) + return(0); + if(addon[0]=='/') + strcpy(path+l,addon+1); + else + strcpy(path+l,addon); + return(1); +} + + +int Sfile_prepend_path(char *prefix, char path[SfileadrL], int flag) +{ + int l, i, slashes, prefix_len, path_len; + + l= strlen(prefix); + if(l == 0) + return(1); + + /* Do not copy slashes between both parts */ + for(prefix_len= l; prefix_len > 0; prefix_len--) + if(prefix[prefix_len - 1] != '/') + break; + if(prefix_len == 0) + prefix_len= strlen(prefix) - 1; + path_len= strlen(path); + for(slashes= 0; slashes < path_len; slashes++) + if(path[slashes] != '/') + break; + + l= (strlen(path) - slashes) + prefix_len + 1; + if(l>=SfileadrL) { + +#ifdef Not_yeT + /* >>> ??? how to transport messages to xorriso ? */ + sprintf(xorriso->info_text, + "Combination of wd and relative address too long (%d > %d)", + l,SfileadrL-1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); +#endif + + return(-1); + } + l-= strlen(path); + if(l < 0) { + for(i= slashes; i <= path_len + 1; i++) + path[i+l]= path[i]; + } else if(l > 0) { + for(i= path_len + 1; i >= slashes; i--) + path[i+l]= path[i]; + } + if(prefix_len > 0) + memcpy(path, prefix, prefix_len); + path[l - 1 + slashes]= '/'; + return(1); +} + +int Sfile_being_group_member(struct stat *stbuf, int flag) +{ + int i, suppl_groups; + gid_t *suppl_glist; + + if (getegid()==stbuf->st_gid) + return(1); + suppl_groups= getgroups(0, NULL); + suppl_glist= (gid_t *) malloc((suppl_groups + 1) * sizeof(gid_t)); + if (suppl_glist==NULL) + return(-1); + suppl_groups= getgroups(suppl_groups+1,suppl_glist); + for (i= 0; i<suppl_groups; i++) { + if (suppl_glist[i]==stbuf->st_gid) { + free((char *) suppl_glist); + return(1); + } + } + free((char *) suppl_glist); + return(0); +} + + +int Sfile_type(char *filename, int flag) +/* + bit0= return -1 if file is missing + bit1= return a hardlink with siblings as type 5 + bit2= evaluate eventual link target rather than the link object itself + bit3= return a socket or a char device as types 7 or 8 rather than 0 +*/ +/* + return: + 0=unknown + 1=regular + 2=directory + 3=symbolic link + 4=named pipe + 5=multiple hardlink (with bit1) + 6=block device + 7=socket (with bit3) + 8=character device (with bit3) +*/ +{ + struct stat stbuf; + if(flag&4) { + if(stat(filename,&stbuf)==-1) { + if(flag&1) return(-1); + else return(0); + } + } else { + if(lstat(filename,&stbuf)==-1) { + if(flag&1) return(-1); + else return(0); + } + } + if(S_ISREG(stbuf.st_mode)) { + if(flag&2) + if(stbuf.st_nlink>1) + return(5); + return(1); + } + if(S_ISDIR(stbuf.st_mode)) + return(2); + if((stbuf.st_mode&S_IFMT)==S_IFLNK) + return(3); + if(S_ISFIFO(stbuf.st_mode)) + return(4); + if(S_ISBLK(stbuf.st_mode)) + return(6); + if(flag&8) + if((stbuf.st_mode&S_IFMT)==S_IFSOCK) + return(7); + if(flag&8) + if(S_ISCHR(stbuf.st_mode)) + return(8); + return(0); +} + + +char *Sfile_datestr(time_t tim, short int flag) +/* + bit0=with hours+minutes + bit1=with seconds + + bit8= local time rather than UTC +*/ +{ + static char zeitcode[80]={"000000"}; + char puff[80]; + struct tm *azt; + + if(flag&256) + azt = localtime(&tim); + else + azt = gmtime(&tim); + + if(azt->tm_year>99) + sprintf(zeitcode,"%c%1.1d%2.2d%2.2d", + 'A'+(azt->tm_year-100)/10,azt->tm_year%10, + azt->tm_mon+1,azt->tm_mday); + else + sprintf(zeitcode,"%2.2d%2.2d%2.2d", + azt->tm_year,azt->tm_mon+1,azt->tm_mday); + if(flag&1){ + sprintf(puff,".%2.2d%2.2d",azt->tm_hour,azt->tm_min); + strcat(zeitcode,puff); + } + if(flag&2){ + sprintf(puff,"%2.2d",azt->tm_sec); + strcat(zeitcode,puff); + } + + return(zeitcode); +} + + +int Sfile_scale(double value, char *result, int siz, double thresh, int flag) +/* + bit0= eventually ommit 'b' + bit1= make text as short as possible + bit2= no fraction (if it would fit at all) +*/ +{ + char scale_c,scales[7],form[80], *negpt= NULL, *cpt; + int i,dec_siz= 0,avail_siz= 1; + + if(value<0) { + value= -value; + siz--; + result[0]= '-'; + negpt= result; + result++; + } + strcpy(scales,"bkmgtp"); + scale_c= scales[0]; + for(i=1;scales[i]!=0;i++) { + if(value<thresh-0.5) + break; + value/= 1024.0; + scale_c= scales[i]; + } + if(scale_c!='b' && !(flag&4)) { /* is there room for fractional part ? */ + avail_siz= siz-1; + sprintf(form,"%%.f"); + sprintf(result,"%.f",value); + if(((int) strlen(result)) <= avail_siz - 2) + dec_siz= 1; /* we are very modest */ + } + if(scale_c=='b' && (flag&1)) { + if(flag&2) + sprintf(form,"%%.f"); + else + sprintf(form,"%%%d.f",siz); + sprintf(result,form,value); + } else { + if(flag&2) + sprintf(form,"%%.f%%c"); + else if(dec_siz>0) + sprintf(form,"%%%d.%df%%c",avail_siz,dec_siz); + else + sprintf(form,"%%%d.f%%c",siz-1); + sprintf(result,form,value,scale_c); + } + if(negpt != NULL) { + for(cpt= result; *cpt==' '; cpt++); + if(cpt > result) { + *negpt= ' '; + *(cpt - 1)= '-'; + } + } + return(1); +} + + +int Sfile_off_t_text(char text[80], off_t num, int flag) +{ + char *tpt; + off_t hnum, scale= 1; + int digits= 0, d, i; + + tpt= text; + hnum= num; + if(hnum<0) { + *(tpt++)= '-'; + hnum= -num; + } + if(hnum<0) { /* it can stay nastily persistent */ + strcpy(text, "_overflow_"); + return(0); + } + for(i= 0; i<23; i++) { /* good for up to 70 bit = 10 exp 21.07... */ + if(hnum==0) + break; + hnum/= 10; + if(hnum) + scale*= 10; + } + if(i==0) { + strcpy(text, "0"); + return(1); + } + if(i==23) { + strcpy(text, "_overflow_"); + return(0); + } + digits= i; + hnum= num; + for(; i>0; i--) { + d= hnum/scale; + tpt[digits-i]= '0'+d; + hnum= hnum%scale; + scale/= 10; + } + tpt[digits]= 0; + return(1); +} + + +/* Converts backslash codes into single characters: + \a BEL 7 , \b BS 8 , \e ESC 27 , \f FF 12 , \n LF 10 , \r CR 13 , + \t HT 9 , \v VT 11 , \\ \ 92 + \[0-9][0-9][0-9] octal code , \x[0-9a-f][0-9a-f] hex code , + \cX control-x (ascii(X)-64) + @param upto maximum number of characters to examine for backslash. + The scope of a backslash (0 to 3 characters) is not affected. + @param eaten returns the difference in length between input and output + @param flag bit0= only determine *eaten, do not convert + bit1= allow to convert \000 to binary 0 +*/ +int Sfile_bsl_interpreter(char *text, int upto, int *eaten, int flag) +{ + char *rpt, *wpt, num_text[8], wdummy[8]; + unsigned int num= 0; + + *eaten= 0; + wpt= text; + for(rpt= text; *rpt != 0 && rpt - text < upto; rpt++) { + if(flag & 1) + wpt= wdummy; + if(*rpt == '\\') { + rpt++; + (*eaten)++; + if(*rpt == 'a') { + *(wpt++)= 7; + } else if(*rpt == 'b') { + *(wpt++)= 8; + } else if(*rpt == 'e') { + *(wpt++)= 27; + } else if(*rpt == 'f') { + *(wpt++)= 12; + } else if(*rpt == 'n') { + *(wpt++)= 10; + } else if(*rpt == 'r') { + *(wpt++)= 13; + } else if(*rpt == 't') { + *(wpt++)= 9; + } else if(*rpt == 'v') { + *(wpt++)= 11; + } else if(*rpt == '\\') { + *(wpt++)= '\\'; + } else if(rpt[0] >= '0' && rpt[0] <= '7' && + rpt[1] >= '0' && rpt[1] <= '7' && + rpt[2] >= '0' && rpt[2] <= '7') { + num_text[0]= '0'; + num_text[1]= *(rpt + 0); + num_text[2]= *(rpt + 1); + num_text[3]= *(rpt + 2); + num_text[4]= 0; + sscanf(num_text, "%o", &num); + if((num > 0 || (flag & 2)) && num <= 255) { + rpt+= 2; + (*eaten)+= 2; + *(wpt++)= num; + } else + goto not_a_code; + } else if(rpt[0] == 'x' && + ((rpt[1] >= '0' && rpt[1] <= '9') || + (rpt[1] >= 'A' && rpt[1] <= 'F') || + (rpt[1] >= 'a' && rpt[1] <= 'f')) + && + ((rpt[2] >= '0' && rpt[2] <= '9') || + (rpt[2] >= 'A' && rpt[2] <= 'F') || + (rpt[2] >= 'a' && rpt[2] <= 'f')) + ) { + num_text[0]= *(rpt + 1); + num_text[1]= *(rpt + 2); + num_text[2]= 0; + sscanf(num_text, "%x", &num); + if(num > 0 && num <= 255) { + rpt+= 2; + (*eaten)+= 2; + *(wpt++)= num; + } else + goto not_a_code; + } else if(*rpt == 'c') { + if(rpt[1] > 64 && rpt[1] < 96) { + *(wpt++)= rpt[1] - 64; + rpt++; + (*eaten)++; + } else + goto not_a_code; + } else { +not_a_code:; + *(wpt++)= '\\'; + rpt--; + (*eaten)--; + } + } else + *(wpt++)= *rpt; + } + *wpt= *rpt; + return(1); +} + + +int Sfile_argv_bsl(int argc, char ***argv, int flag) +{ + int i, ret, eaten; + char **new_argv= NULL; + + if(argc <= 0) + return(0); + new_argv= (char **) Smem_malloC(argc * sizeof(char *)); + if(new_argv == NULL) + return(-1); + for(i= 0; i < argc; i++) { + new_argv[i]= strdup((*argv)[i]); + if(new_argv[i] == NULL) + {ret= -1; goto ex;} + ret= Sfile_bsl_interpreter(new_argv[i], strlen(new_argv[i]), &eaten, 0); + if(ret <= 0) + goto ex; + } + ret= 1; +ex:; + if(ret <= 0) { + if(new_argv != NULL) + free((char *) new_argv); + } else + *argv= new_argv; + return(ret); +} + + +/* @param flag bit0= only encode inside quotes + bit1= encode < 32 outside quotes except 7, 8, 9, 10, 12, 13 + bit2= encode in any case above 126 + bit3= encode in any case shellsafe and name-value-safe: + <=42 , 59, 60, 61, 62, 63, 92, 94, 96, >=123 +*/ +int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag) +{ + signed char *rpt; + char *wpt; + int count, sq_open= 0, dq_open= 0; + + count= 0; + for(rpt= (signed char *) text; (size_t) (((char *) rpt) - text) < text_len; + rpt++) { + count++; + if(flag & 8) { + if(!(*rpt <= 42 || (*rpt >= 59 && *rpt <= 63) || + *rpt == 92 || *rpt == 94 || *rpt == 96 || *rpt >= 123)) + continue; + } else if(*rpt >= 32 && *rpt <= 126 && *rpt != '\\') + continue; + if(((*rpt >= 7 && *rpt <= 13) || *rpt == 27 || *rpt == '\\') && !(flag & 8)) + count++; + else + count+= 3; + } + (*result)= wpt= calloc(count + 1, 1); + if(wpt == NULL) + return(-1); + for(rpt= (signed char *) text; (size_t) (((char *) rpt) - text) < text_len; + rpt++) { + if(*rpt == '\'') + sq_open= !(sq_open || dq_open); + if(*rpt == '"') + dq_open= !(sq_open || dq_open); + + if(flag & 8) { + if(!(*rpt <= 42 || (*rpt >= 59 && *rpt <= 63) || + *rpt == 92 || *rpt == 94 || *rpt == 96 || *rpt >= 123)) { + *(wpt++)= *rpt; + continue; + } + } else if(*rpt >= 32 && *rpt <= 126 && *rpt != '\\') { + *(wpt++)= *rpt; + continue; + } else if( ((flag & 1) && !(sq_open || dq_open)) && + !((flag & 2) && (*rpt >= 1 && * rpt <= 31 && + !(*rpt == 7 || *rpt == 8 || *rpt == 9 || *rpt == 10 || + *rpt == 12 || *rpt == 13))) && + !((flag & 4) && (*rpt > 126 || *rpt < 0)) && + !((flag & 6) && *rpt == '\\')) { + *(wpt++)= *rpt; + continue; + } + *(wpt++)= '\\'; + if(((*rpt >= 7 && *rpt <= 13) || *rpt == 27 || *rpt == '\\') && !(flag&8)) { + if(*rpt == 7) + *(wpt++)= 'a'; + else if(*rpt == 8) + *(wpt++)= 'b'; + else if(*rpt == 9) + *(wpt++)= 't'; + else if(*rpt == 10) { + *(wpt++)= 'n'; + } else if(*rpt == 11) + *(wpt++)= 'v'; + else if(*rpt == 12) + *(wpt++)= 'f'; + else if(*rpt == 13) + *(wpt++)= 'c'; + else if(*rpt == 27) + *(wpt++)= 'e'; + else if(*rpt == '\\') + *(wpt++)= '\\'; + } else { + sprintf(wpt, "%-3.3o", (unsigned int) *((unsigned char *) rpt)); + wpt+= 3; + } + } + *wpt= 0; + return(1); +} + + +int Sfile_destroy_argv(int *argc, char ***argv, int flag) +{ + int i; + + if(*argc>0 && *argv!=NULL){ + for(i=0;i<*argc;i++){ + if((*argv)[i]!=NULL) + Smem_freE((*argv)[i]); + } + Smem_freE((char *) *argv); + } + *argc= 0; + *argv= NULL; + return(1); +} + + +int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, + int flag) +/* + bit0= read progname as first argument from line + bit1= just release argument list argv and return + bit2= abort with return(0) if incomplete quotes are found + bit3= eventually prepend missing '-' to first argument read from line + bit4= like bit2 but only check quote completeness, do not allocate memory + bit5+6= interpretation of backslashes: + 0= no interpretation, leave unchanged + 1= only inside double quotes + 2= outside single quotes + 3= everywhere + bit7= append a NULL element to argv +*/ +{ + int i,pass,maxl=0,l,argzaehl=0,bufl,line_start_argc, bsl_mode, ret= 0, eaten; + char *cpt,*start; + char *buf= NULL; + + Sfile_destroy_argv(argc,argv,0); + if(flag&2) + {ret= 1; goto ex;} + + if(flag & 16) + flag|= 4; + bsl_mode= (flag >> 5) & 3; + + buf= calloc(strlen(line) + SfileadrL, 1); + if(buf == NULL) + {ret= -1; goto ex;} + for(pass=0;pass<2;pass++) { + cpt= line-1; + if(!(flag&1)){ + argzaehl= line_start_argc= 1; + if(pass==0) + maxl= strlen(progname); + else + strcpy((*argv)[0],progname); + } else { + argzaehl= line_start_argc= 0; + if(pass==0) maxl= 0; + } + while(*(++cpt)!=0){ + if(isspace(*cpt)) continue; + start= cpt; + buf[0]= 0; + cpt--; + while(*(++cpt)!=0) { + if(isspace(*cpt)) break; + if(*cpt=='"'){ + l= cpt-start; bufl= strlen(buf); + if(l>0) { + strncpy(buf + bufl, start, l); buf[bufl + l]= 0; + if(bsl_mode >= 3) { + ret= Sfile_bsl_interpreter(buf, l, &eaten, 0); + if(ret <= 0) + goto ex; + } + } + l= strlen(buf); + start= cpt+1; + while(*(++cpt)!=0) if(*cpt=='"') break; + if((flag&4) && *cpt==0) + {ret= 0; goto ex;} + l= cpt-start; bufl= strlen(buf); + if(l>0) { + strncpy(buf + bufl, start, l); + buf[bufl + l]= 0; + if(bsl_mode >= 1) { + ret= Sfile_bsl_interpreter(buf + bufl, l, &eaten, 0); + if(ret <= 0) + goto ex; + } + } + start= cpt+1; + }else if(*cpt=='\''){ + l= cpt-start; bufl= strlen(buf); + if(l>0) { + strncpy(buf + bufl, start, l); buf[bufl + l]= 0; + if(bsl_mode >= 3) { + ret= Sfile_bsl_interpreter(buf, l, &eaten, 0); + if(ret <= 0) + goto ex; + } + } + l= strlen(buf); + start= cpt+1; + while(*(++cpt)!=0) if(*cpt=='\'') break; + if((flag&4) && *cpt==0) + {ret= 0; goto ex;} + l= cpt-start; bufl= strlen(buf); + if(l>0) { + strncat(buf,start,l);buf[bufl+l]= 0; + if(bsl_mode >= 2) { + ret= Sfile_bsl_interpreter(buf + bufl, l, &eaten, 0); + if(ret <= 0) + goto ex; + } + } + start= cpt+1; + } + if(*cpt==0) break; + } + l= cpt-start; + bufl= strlen(buf); + if(l>0) { + strncpy(buf + bufl, start, l); buf[bufl + l]= 0; + if(bsl_mode >= 3) { + ret= Sfile_bsl_interpreter(buf, l, &eaten, 0); + if(ret <= 0) + goto ex; + } + } + l= strlen(buf); + if(pass==0){ + if(argzaehl==line_start_argc && (flag&8)) + if(buf[0]!='-' && buf[0]!=0 && buf[0]!='#') + l++; + if(l>maxl) maxl= l; + }else{ + strcpy((*argv)[argzaehl],buf); + if(argzaehl==line_start_argc && (flag&8)) + if(buf[0]!='-' && buf[0]!=0 && buf[0]!='#') + sprintf((*argv)[argzaehl],"-%s", buf); + } + argzaehl++; + if(*cpt==0) break; + } + if(pass==0){ + if(flag & 16) + {ret= 1; goto ex;} + *argc= argzaehl; + if(argzaehl>0 || (flag & 128)) { + *argv= (char **) Smem_malloC((argzaehl + !!(flag & 128)) + * sizeof(char *)); + if(*argv==NULL) + {ret= -1; goto ex;} + } + for(i=0;i<*argc;i++) { + (*argv)[i]= (char *) Smem_malloC((maxl+1)); + if((*argv)[i]==NULL) + {ret= -1; goto ex;} + } + if(flag & 128) + (*argv)[*argc]= NULL; + } + } + ret= 1; +ex: + if(buf != NULL) + free(buf); + return(ret); +} + + +/* @param flag bit0= append */ +int Sfile_str(char target[SfileadrL], char *source, int flag) +{ + int l; + + l= strlen(source); + if(flag&1) + l+= strlen(target); + if(l>=SfileadrL) { + fprintf(stderr, "--- Path string overflow (%d > %d). Malicious input ?\n", + l,SfileadrL-1); + return(0); + } + if(flag&1) + strcat(target, source); + else + strcpy(target, source); + return(1); +} + + +/** Combine environment variable HOME with given filename + @param filename Address relative to $HOME + @param fileadr Resulting combined address + @param fa_size Size of array fileadr + @param flag Unused yet + @return 1=ok , 0=no HOME variable , -1=result address too long +*/ +int Sfile_home_adr_s(char *filename, char *fileadr, int fa_size, int flag) +{ + char *home; + + strcpy(fileadr,filename); + home= getenv("HOME"); + if(home==NULL) + return(0); + if((int) (strlen(home) + strlen(filename) + 1) >= fa_size) + return(-1); + strcpy(fileadr,home); + if(filename[0]!=0){ + strcat(fileadr,"/"); + strcat(fileadr,filename); + } + return(1); +} + + +/** Return a double representing seconds and microseconds since 1 Jan 1970 */ +double Sfile_microtime(int flag) +{ + struct timeval tv; + struct timezone tz; + gettimeofday(&tv,&tz); + return((double) (tv.tv_sec+1.0e-6*tv.tv_usec)); +} + + +int Sfile_decode_datestr(struct tm *reply, char *text, int flag) +/* YYMMDD[.hhmm[ss]] */ +{ + int i,l; + time_t current_time; + struct tm *now; + + current_time= time(0); + now= localtime(¤t_time); + for(i=0; i < (int) sizeof(struct tm); i++) + ((char *) reply)[i]= ((char *) now)[i]; + + if(text[0]<'0'|| (text[0]>'9' && text[0]<'A') || text[0]>'Z') + return(0); + l= strlen(text); + for(i=1;i<l;i++) + if(text[i]<'0'||text[i]>'9') + break; + if(i!=6) + return(0); + if(text[i]==0) + goto decode; + if(text[i]!='.' || (l!=11 && l!=13)) + return(0); + for(i++;i<l;i++) + if(text[i]<'0'||text[i]>'9') + break; + if(i!=l) + return(0); + +decode:; + reply->tm_hour= 0; + reply->tm_min= 0; + reply->tm_sec= 0; + i= 0; + if(text[0]>='A') + reply->tm_year= 100+(text[i]-'A')*10+text[1]-'0'; + else + reply->tm_year= 10*(text[0]-'0')+text[1]-'0'; + reply->tm_mon= 10*(text[2]-'0')+text[3]-'0'-1; + reply->tm_mday= 10*(text[4]-'0')+text[5]-'0'; + if(l==6) + return(1); + reply->tm_hour= 10*(text[7]-'0')+text[8]-'0'; + reply->tm_min= 10*(text[9]-'0')+text[10]-'0'; + if(l==11) + return(1); + reply->tm_sec= 10*(text[11]-'0')+text[12]-'0'; + return(1); +} + + diff --git a/libisoburn/branches/1.1.8/xorriso/sfile.h b/libisoburn/branches/1.1.8/xorriso/sfile.h new file mode 100644 index 00000000..74cdb309 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/sfile.h @@ -0,0 +1,135 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of functions around files and strings. +*/ + + +#ifndef Xorriso_pvt_sfile_includeD +#define Xorriso_pvt_sfile_includeD yes + +#define TSOB_FELD(typ, count) (typ *) calloc(1, (count)*sizeof(typ)); +#define Smem_malloC malloc +#define Smem_freE free + +#define Xorriso_alloc_meM(pt, typ, count) { \ + pt= (typ *) calloc(1, (count) * sizeof(typ)); \ + if(pt == NULL) { \ + Xorriso_no_malloc_memory(xorriso, NULL, 0); \ + ret= -1; \ + goto ex; \ + } } + +#define Xorriso_free_meM(pt) { \ + if(pt != NULL) \ + free((char *) pt); \ + } + + +#define SfileadrL 4096 + + +int Sfile_str(char target[SfileadrL], char *source, int flag); + +double Sfile_microtime(int flag); + +int Sfile_add_to_path(char path[SfileadrL], char *addon, int flag); + +int Sfile_scale(double value, char *result, int siz, double thresh, int flag); + +int Sfile_destroy_argv(int *argc, char ***argv, int flag); + +/* + bit0= do not ignore trailing slash + bit1= do not ignore empty components (other than the empty root name) +*/ +int Sfile_count_components(char *path, int flag); + +/* + @param flag + bit0= return -1 if file is missing + bit1= return a hardlink with siblings as type 5 + bit2= evaluate eventual link target rather than the link object itself + bit3= return a socket or a char device as types 7 or 8 rather than 0 + @return + 0=unknown + 1=regular + 2=directory + 3=symbolic link + 4=named pipe + 5=multiple hardlink (with bit1) + 6=block device + 7=socket (with bit3) + 8=character device (with bit3) +*/ +int Sfile_type(char *filename, int flag); + +/* @param flag bit0= only encode inside quotes + bit1= encode < 32 outside quotes except 7, 8, 9, 10, 12, 13 + bit2= encode in any case above 126 + bit3= encode in any case shellsafe: + <=42 , 59, 60, 62, 63, 92, 94, 96, >=123 +*/ +int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag); + +int Sfile_argv_bsl(int argc, char ***argv, int flag); + +/* + bit0= read progname as first argument from line + bit1= just release argument list argv and return + bit2= abort with return(0) if incomplete quotes are found + bit3= eventually prepend missing '-' to first argument read from line + bit4= like bit2 but only check quote completeness, do not allocate memory + bit5+6= interpretation of backslashes: + 0= no interpretation, leave unchanged + 1= only inside double quotes + 2= outside single quotes + 3= everywhere + bit7= append a NULL element to argv +*/ +int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, + int flag); + +/* YYMMDD[.hhmm[ss]] */ +int Sfile_decode_datestr(struct tm *reply, char *text, int flag); + +int Sfile_off_t_text(char text[80], off_t num, int flag); + +int Sfile_leafname(char *path, char leafname[SfileadrL], int flag); + +/* @param flag bit0= do not clip of carriage return at line end +*/ +char *Sfile_fgets_n(char *line, int maxl, FILE *fp, int flag); + +/* + bit0=with hours+minutes + bit1=with seconds + + bit8= local time rather than UTC +*/ +char *Sfile_datestr(time_t tim, short int flag); + +/* Converts backslash codes into single characters: + \a BEL 7 , \b BS 8 , \e ESC 27 , \f FF 12 , \n LF 10 , \r CR 13 , + \t HT 9 , \v VT 11 , \\ \ 92 + \[0-9][0-9][0-9] octal code , \x[0-9a-f][0-9a-f] hex code , + \cX control-x (ascii(X)-64) + @param upto maximum number of characters to examine for backslash. + The scope of a backslash (0 to 3 characters) is not affected. + @param eaten returns the difference in length between input and output + @param flag bit0= only determine *eaten, do not convert + bit1= allow to convert \000 to binary 0 +*/ +int Sfile_bsl_interpreter(char *text, int upto, int *eaten, int flag); + +int Sfile_prepend_path(char *prefix, char path[SfileadrL], int flag); + +int Sfile_home_adr_s(char *filename, char *fileadr, int fa_size, int flag); + + +#endif /* ! Xorriso_pvt_sfile_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/sort_cmp.c b/libisoburn/branches/1.1.8/xorriso/sort_cmp.c new file mode 100644 index 00000000..43ff3ecf --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/sort_cmp.c @@ -0,0 +1,722 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains functions which sort and compare tree nodes. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + + +#include "base_obj.h" +#include "lib_mgt.h" +#include "sort_cmp.h" +#include "iso_tree.h" +#include "iso_manip.h" + + +int Xorriso__findi_sorted_ino_cmp(const void *p1, const void *p2) +{ + int ret; + IsoNode *n1, *n2; + + n1= *((IsoNode **) p1); + n2= *((IsoNode **) p2); + + ret= Xorriso__node_lba_cmp(&n1, &n2); + if(ret) + return (ret > 0 ? 1 : -1); + ret= iso_node_cmp_ino(n1, n2, 0); + return(ret); +} + + +/* Not suitable for qsort() but for cross-array comparisons. + p1 and p2 are actually IsoNode *p1, IsoNode *p2 +*/ +int Xorriso__hln_cmp(const void *p1, const void *p2) +{ + int ret; + + ret= Xorriso__findi_sorted_ino_cmp(&p1, &p2); + if(ret) + return (ret > 0 ? 1 : -1); + if(p1 != p2) + return(p1 < p2 ? -1 : 1); + return(0); +} + + +/* + p1 and p2 are actually IsoNode **p1, IsoNode **p2 +*/ +int Xorriso__findi_sorted_cmp(const void *p1, const void *p2) +{ + int ret; + + ret= Xorriso__findi_sorted_ino_cmp(p1, p2); + if(ret) + return (ret > 0 ? 1 : -1); + if(p1 != p2) + return(p1 < p2 ? -1 : 1); + return(0); +} + + +int Xorriso_sort_node_array(struct XorrisO *xorriso, int flag) +{ + if(xorriso->node_counter <= 0) + return(0); + qsort(xorriso->node_array, xorriso->node_counter, sizeof(IsoNode *), + Xorriso__findi_sorted_cmp); + return(1); +} + + +int Xorriso__search_node(void *node_array[], int n, + int (*cmp)(const void *p1, const void *p2), + void *node, int *idx, int flag) +{ + int ret, l, r, p, pos; + + if(n == 0) + return(0); + l= 0; + r= n + 1; + while(1) { + p= (r - l) / 2; + if(p == 0) + break; + p+= l; + + /* NULL elements may indicate invalid nodes. Their first valid right neigbor + will serve as proxy. If none exists, then the test pushes leftwards. + */ + for(pos= p - 1; pos < n; pos++) + if(node_array[pos] != NULL) + break; + if(pos < n) + ret= (*cmp)(&(node_array[pos]), &node); + else + ret= 1; + + if(ret < 0) + l= p; + else if(ret > 0) + r= p; + else { + *idx= pos; + return(1); + } + } + return(0); +} + + +int Xorriso_search_in_hln_array(struct XorrisO *xorriso, + void *node, int *idx, int flag) +{ + int ret; + + if(xorriso->hln_array == NULL || xorriso->hln_count <= 0) + return(0); + ret= Xorriso__search_node(xorriso->hln_array, xorriso->hln_count, + Xorriso__findi_sorted_ino_cmp, node, idx, 0); + return ret; +} + + +int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag) +{ + int ret, i, i_end, imgid, error_code; + size_t value_length= 0; + char *value= NULL, *msg= NULL, severity[80]; + unsigned char *vpt; + static char *name= "isofs.di"; + +#ifdef NIX + /* <<< */ + Xorriso_get_di_counteR++; +#endif /* NIX */ + + msg= TSOB_FELD(char, ISO_MSGS_MESSAGE_LEN); + if(msg == NULL) + {ret= -1; goto ex;} + *dev= 0; + *ino= 0; + ret= iso_node_lookup_attr(node, name, &value_length, &value, 0); + if(ret <= 0) { + /* Drop any pending messages because there is no xorriso to take them */ + iso_obtain_msgs("NEVER", &error_code, &imgid, msg, severity); + goto ex; + } + vpt= (unsigned char *) value; + for(i= 1; i <= vpt[0] && i < (int) value_length; i++) + *dev= ((*dev) << 8) | vpt[i]; + i_end= i + vpt[i] + 1; + for(i++; i < i_end && i < (int) value_length; i++) + *ino= ((*ino) << 8) | vpt[i]; + free(value); + ret= 1; +ex:; + if(msg != NULL) + free(msg); + return(ret); +} + + +int Xorriso__di_ino_cmp(const void *p1, const void *p2) +{ + int ret; + IsoNode *n1, *n2; + dev_t d1, d2; + ino_t i1, i2; + + n1= *((IsoNode **) p1); + n2= *((IsoNode **) p2); + + ret= Xorriso__get_di(n1, &d1, &i1, 0); + if(ret <= 0) + {d1= 0; i1= 0;} + ret= Xorriso__get_di(n2, &d2, &i2, 0); + if(ret <= 0) + {d2= 0; i2= 0;} + + if(d1 < d2) + return(-1); + if(d1 > d2) + return(1); + if(i1 < i2) + return(-1); + if(i1 > i2) + return(1); + if(d1 == 0 && i1 == 0 && n1 != n2) + return(n1 < n2 ? -1 : 1); + return(0); +} + + +int Xorriso__di_cmp(const void *p1, const void *p2) +{ + int ret; + IsoNode *n1, *n2; + + ret= Xorriso__di_ino_cmp(p1, p2); + if(ret) + return(ret); + n1= *((IsoNode **) p1); + n2= *((IsoNode **) p2); + if(n1 != n2) + return(n1 < n2 ? -1 : 1); + return(0); +} + + +int Xorriso__sort_di(void *node_array[], int count, int flag) +{ + if(count <= 0) + return(0); + qsort(node_array, count, sizeof(IsoNode *), Xorriso__di_cmp); + return(1); +} + + +int Xorriso_invalidate_di_item(struct XorrisO *xorriso, IsoNode *node, + int flag) +{ + int ret, idx; + + if(xorriso->di_array == NULL) + return(1); + ret= Xorriso__search_node(xorriso->di_array, xorriso->di_count, + Xorriso__di_cmp, node, &idx, 0); + if(ret <= 0) + return(ret == 0); + if(xorriso->di_array[idx] != NULL) + iso_node_unref(xorriso->di_array[idx]); + xorriso->di_array[idx]= NULL; + return(1); +} + + +/* @param flag bit0= return 1 even if matching nodes were found but node is + not among them + bit1= use Xorriso__di_cmp() rather than Xorriso__di_ino_cmp() +*/ +int Xorriso_search_di_range(struct XorrisO *xorriso, IsoNode *node, + int *idx, int *low, int *high, int flag) +{ + int ret, i, found; + int (*cmp)(const void *p1, const void *p2)= Xorriso__di_ino_cmp; + + if(flag & 2) + cmp= Xorriso__di_cmp; + + *high= *low= *idx= -1; + ret= Xorriso__search_node(xorriso->di_array, xorriso->di_count, + cmp, node, &found, 0); + if(ret <= 0) + return(0); + *low= *high= found; + for(i= found + 1; i < xorriso->di_count; i++) + if(xorriso->di_array[i] != NULL) { + if((*cmp)(&node, &(xorriso->di_array[i])) != 0) + break; + *high= i; + } + for(i= found - 1; i >= 0; i--) + if(xorriso->di_array[i] != NULL) { + if((*cmp)(&node, &(xorriso->di_array[i])) != 0) + break; + *low= i; + } + for(i= *low; i <= *high; i++) + if(xorriso->di_array[i] == node) { + *idx= i; + break; + } + return(*idx >= 0 || (flag & 1)); +} + + +int Xorriso__node_lba_cmp(const void *node1, const void *node2) +{ + int ret; + int lba1= 0, lba2= 0; + + ret= Xorriso__file_start_lba(*((IsoNode **) node1), &lba1, 0); + if(ret!=1) + lba1= 0; + ret= Xorriso__file_start_lba(*((IsoNode **) node2), &lba2, 0); + if(ret!=1) + lba2= 0; + return(lba1-lba2); +} + + +int Xorriso__node_name_cmp(const void *node1, const void *node2) +{ + char *name1, *name2; + + name1= (char *) iso_node_get_name(*((IsoNode **) node1)); + name2= (char *) iso_node_get_name(*((IsoNode **) node2)); + return(strcmp(name1,name2)); +} + + +/* @param flag bit0= only accept directory nodes + bit1= do not report memory usage as DEBUG + bit2= do not apply search pattern but accept any node +*/ +int Xorriso_sorted_node_array(struct XorrisO *xorriso, + IsoDir *dir_node, + int *nodec, IsoNode ***node_array, + off_t boss_mem, int flag) +{ + int i, ret, failed_at; + char *npt; + IsoDirIter *iter= NULL; + IsoNode *node; + off_t mem; + + mem= ((*nodec)+1)*sizeof(IsoNode *); + ret= Xorriso_check_temp_mem_limit(xorriso, mem+boss_mem, flag&2); + if(ret<=0) + return(ret); + + *node_array= calloc(sizeof(IsoNode *), (*nodec)+1); + if(*node_array==NULL) { + sprintf(xorriso->info_text, + "Cannot allocate memory for %d directory entries", *nodec); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(-1); + } + + ret= iso_dir_get_children(dir_node, &iter); + if(ret<0) { + Xorriso_cannot_create_iter(xorriso, ret, 0); + return(-1); + } + + for(i= 0; iso_dir_iter_next(iter, &node) == 1 && i<*nodec; ) { + npt= (char *) iso_node_get_name(node); + if(!(flag&4)) { + ret= Xorriso_regexec(xorriso, npt, &failed_at, 0); + if(ret) + continue; /* no match */ + } + if(flag&1) + if(!LIBISO_ISDIR(node)) + continue; + (*node_array)[i++]= node; + } + iso_dir_iter_free(iter); + *nodec= i; + if(*nodec<=0) + return(1); + qsort(*node_array, *nodec, sizeof(IsoNode *), Xorriso__node_name_cmp); + return(1); +} + + +int Xorriso_remake_hln_array(struct XorrisO *xorriso, int flag) +{ + int ret, addon_nodes= 0, i, old_count, old_pt, new_pt; + IsoNode **old_nodes; + char **old_targets; + + /* Count hln_targets of which the node has been deleted meanwhile */ + for(i= 0; i < xorriso->hln_count; i++) { + if(xorriso->hln_targets[i] == NULL) + continue; + if(Xorriso_node_is_valid(xorriso, xorriso->hln_array[i], 0)) + continue; + addon_nodes++; + } + ret= Xorriso_all_node_array(xorriso, addon_nodes, 0); + if(ret <= 0) + goto ex; + if(addon_nodes > 0) { + /* Transfer delete nodes with hln_target to node array */ + for(i= 0; i < xorriso->hln_count; i++) { + if(xorriso->hln_targets[i] == NULL) + continue; + if(Xorriso_node_is_valid(xorriso, xorriso->hln_array[i], 0)) + continue; + if(xorriso->node_counter < xorriso->node_array_size) { + xorriso->node_array[xorriso->node_counter++]= xorriso->hln_array[i]; + iso_node_ref(xorriso->node_array[xorriso->node_counter - 1]); + } + } + } + + Xorriso_sort_node_array(xorriso, 0); + old_nodes= (IsoNode **) xorriso->hln_array; + old_targets= (char **) xorriso->hln_targets; + old_count= xorriso->hln_count; + xorriso->hln_array= 0; + xorriso->hln_targets= NULL; + + /* Transfer node_array to di_array without unrefering nodes */ + xorriso->hln_count= xorriso->node_counter; + xorriso->hln_array= xorriso->node_array; + xorriso->node_counter= 0; + xorriso->node_array_size= 0; + xorriso->node_array= NULL; + + /* Allocate hln_targets */ + ret= Xorriso_new_hln_array(xorriso, xorriso->temp_mem_limit, 1); + if(ret<=0) + goto ex; + xorriso->node_targets_availmem= xorriso->temp_mem_limit; + if(old_targets != NULL) { + /* Transfer targets from old target array */; + new_pt= old_pt= 0; + while(new_pt < xorriso->hln_count && old_pt < old_count) { + ret= Xorriso__hln_cmp(xorriso->hln_array[new_pt], old_nodes[old_pt]); + if(ret < 0) { + new_pt++; + } else if(ret > 0) { + old_pt++; + } else { + xorriso->hln_targets[new_pt]= old_targets[old_pt]; + if(old_targets[old_pt] != NULL) + xorriso->temp_mem_limit-= strlen(old_targets[old_pt]) + 1; + old_targets[old_pt]= NULL; + new_pt++; + old_pt++; + } + } + for(old_pt= 0; old_pt < old_count; old_pt++) + if(old_targets[old_pt] != NULL) /* (should not happen) */ + free(old_targets[old_pt]); + free((char *) old_targets); + } + if(old_nodes != NULL) { + for(old_pt= 0; old_pt < old_count; old_pt++) + if(old_nodes[old_pt] != NULL) + iso_node_unref(old_nodes[old_pt]); + free((char *) old_nodes); + } + xorriso->hln_change_pending= 0; + ret= 1; +ex:; + return(ret); +} + + +/* @param flag bit0= overwrite existing hln_array (else return 2) +*/ +int Xorriso_make_hln_array(struct XorrisO *xorriso, int flag) +{ + int ret; + + if(xorriso->hln_array != NULL && !(flag & 1)) { + /* If no fresh image manipulations occured: keep old array */ + if(!xorriso->hln_change_pending) + return(2); + ret= Xorriso_remake_hln_array(xorriso, 0); + return(ret); + } + Xorriso_destroy_hln_array(xorriso, 0); + + ret= Xorriso_all_node_array(xorriso, 0, 0); + if(ret <= 0) + goto ex; + Xorriso_sort_node_array(xorriso, 0); + + /* Transfer node_array to di_array without unrefering nodes */ + xorriso->hln_count= xorriso->node_counter; + xorriso->hln_array= xorriso->node_array; + xorriso->node_counter= 0; + xorriso->node_array_size= 0; + xorriso->node_array= NULL; + + /* Allocate hln_targets */ + ret= Xorriso_new_hln_array(xorriso, xorriso->temp_mem_limit, 1); + if(ret<=0) { + Xorriso_destroy_hln_array(xorriso, 0); + goto ex; + } + xorriso->node_targets_availmem= xorriso->temp_mem_limit; + xorriso->hln_change_pending= 0; + ret= 1; +ex:; + return(ret); +} + + +/* @param flag bit0= overwrite existing di_array (else return 2) + bit1= make di_array despite xorriso->ino_behavior bit 3 +*/ +int Xorriso_make_di_array(struct XorrisO *xorriso, int flag) +{ + int ret, bytes; + +#ifdef NIX + /* <<< */ + unsigned long old_gdic; + old_gdic= Xorriso_get_di_counteR; +#endif /* NIX */ + + if((xorriso->ino_behavior & 8 ) && !(flag & 2)) + return(2); + if(xorriso->di_array != NULL && !(flag & 1)) + return(2); + Xorriso_finish_hl_update(xorriso, 0); + + ret= Xorriso_all_node_array(xorriso, 0, 0); + if(ret <= 0) + goto ex; + bytes= xorriso->node_array_size / 8 + 1; + xorriso->di_do_widen= calloc(bytes, 1); + if(xorriso->di_do_widen == NULL) { + Xorriso_no_malloc_memory(xorriso, NULL, 0); + ret= -1; goto ex; + } + + /* Transfer node_array to di_array without unrefering nodes */ + xorriso->di_count= xorriso->node_counter; + xorriso->di_array= xorriso->node_array; + xorriso->node_counter= 0; + xorriso->node_array_size= 0; + xorriso->node_array= NULL; + + Xorriso__sort_di((void *) xorriso->di_array, xorriso->di_count, 0); + + ret= 1; +ex:; + +#ifdef NIX +/* <<< */ + fprintf(stderr, "xorriso_DEBUG: sort_count= %lu\n", + Xorriso_get_di_counteR - old_gdic); +#endif /* NIX */ + + return(ret); +} + + +/* + @param flag bit0= iso_rr_path is freshly added and up to date + bit1= do not mark as changed content (implied by bit0 too) + bit2= -follow: this is not a command parameter + @return -1= severe error + 0= not applicable for hard links + 1= go on with processing + 2= iso_rr_path is fully updated + */ +int Xorriso_hardlink_update(struct XorrisO *xorriso, int *compare_result, + char *disk_path, char *iso_rr_path, int flag) +{ + int ret, hret, idx, low, high, i, do_overwrite= 0, did_fake_di= 0; + int follow_links, old_idx= -1; + IsoNode *node; + struct stat stbuf; + dev_t old_dev; + ino_t old_ino; + + if(xorriso->di_array == NULL) + return(1); + follow_links= xorriso->do_follow_links || + (xorriso->do_follow_param && !(flag & 4)); + ret= Xorriso_node_from_path(xorriso, NULL, iso_rr_path, &node, 0); + if(ret <= 0) + return(ret); + if(LIBISO_ISDIR(node)) + return(1); + + /* Handle eventual hardlink split : */ + /* This is achieved by setting the content change bit. Reason: + The node needs to be removed from di_array because its di is + not matching its array index any more. So it becomes invisible for + the join check of eventual later hardlink siblings. Therefore + it must be updated now, even if it has currently no siblings + which it leaves or which it joins. + */ + if(!(flag & (1 | 2))) + do_overwrite= 1; + + Xorriso__get_di(node, &old_dev, &old_ino, 0); + ret= Xorriso__search_node(xorriso->di_array, xorriso->di_count, + Xorriso__di_cmp, node, &idx, 0); + if(ret < 0) + {ret= 0; goto ex;} + if(ret > 0) + old_idx= idx; + + /* Handle eventual hardlink joining : */ + + if(follow_links) + ret= stat(disk_path, &stbuf); + else + ret= lstat(disk_path, &stbuf); + if(ret==-1) + {ret= 0; goto ex;} + + /* Are there new dev-ino-siblings in the image ? */ + /* Fake isofs.di */ + if(!(flag & 1)) { + ret= Xorriso_record_dev_inode(xorriso, disk_path, stbuf.st_dev, + stbuf.st_ino, node, iso_rr_path, 1); + if(ret <= 0) + {ret= -1; goto ex;} + did_fake_di= 1; + /* temporarily remove node from di_array so it does not disturb + search by its fake di info */; + if(old_idx >= 0) + xorriso->di_array[old_idx]= NULL; + } + ret= Xorriso_search_di_range(xorriso, node, &idx, &low, &high, 1); + if(did_fake_di) { + /* Revoke fake of isofs.di */ + hret= Xorriso_record_dev_inode(xorriso, disk_path, old_dev, old_ino, + node, iso_rr_path, 1); + if(hret <= 0) + {ret= -1; goto ex;} + if(old_idx >= 0) + xorriso->di_array[old_idx]= node; + } + if(ret == 0) + {ret= 1; goto ex;} + if(ret < 0) + {ret= 0; goto ex;} + + +#ifdef Xorriso_hardlink_update_debuG + /* <<< */ + if(low < high || idx < 0) { + fprintf(stderr, + "xorriso_DEBUG: old_idx= %d , low= %d , high= %d , iso= '%s' , disk='%s'\n", + old_idx, low, high, iso_rr_path, disk_path); + fprintf(stderr, + "xorriso_DEBUG: old_dev= %lu , old_ino= %lu , dev= %lu , ino= %lu\n", + (unsigned long) old_dev, (unsigned long) old_ino, + (unsigned long) stbuf.st_dev, (unsigned long) stbuf.st_ino); + + if(idx >= 0 && idx != old_idx) + fprintf(stderr, "xorriso_DEBUG: idx= %d , old_idx = %d\n", idx, old_idx); + } +#endif /* Xorriso_hardlink_update_debuG */ + + /* Overwrite all valid siblings : */ + for(i= low; i <= high; i++) { + if(i == idx || xorriso->di_array[i] == NULL) + continue; + +#ifdef Xorriso_hardlink_update_debuG + /* <<< */ +{ + ino_t ino; + dev_t dev; + + Xorriso__get_di(xorriso->di_array[i], &dev, &ino, 0); + fprintf(stderr, "xorriso_DEBUG: iso_sibling= '%s' , dev= %lu , ino= %lu\n", + node_path, (unsigned long) dev, (unsigned long) ino); +} +#endif /* Xorriso_hardlink_update_debuG */ + + xorriso->di_do_widen[i / 8]|= 1 << (i % 8); + } + + ret= 1; +ex:; + if(do_overwrite) + *compare_result|= (1<<15); + if(old_idx >= 0 && (*compare_result & (3 << 21))) { + /* The old di info is obsolete */ + if(xorriso->di_array[old_idx] != NULL) + iso_node_unref(xorriso->di_array[old_idx]); + xorriso->di_array[old_idx]= NULL; + } + return(ret); +} + + +/* @param flag bit0= do not destroy di_array +*/ +int Xorriso_finish_hl_update(struct XorrisO *xorriso, int flag) +{ + int ret, zero= 0; + char *argv[4]; + struct Xorriso_lsT *disk_lst, *iso_lst; + + if(xorriso->di_array == NULL) + {ret= 1; goto ex;} + disk_lst= xorriso->di_disk_paths; + iso_lst= xorriso->di_iso_paths; + while(disk_lst != NULL && iso_lst != NULL) { + argv[0]= Xorriso_lst_get_text(iso_lst, 0); + argv[1]= "-exec"; + argv[2]= "widen_hardlinks"; + argv[3]= Xorriso_lst_get_text(disk_lst, 0); + zero= 0; + ret= Xorriso_option_find(xorriso, 4, argv, &zero, 0); /* -findi */ + if(ret < 0) + goto ex; + disk_lst= Xorriso_lst_get_next(disk_lst, 0); + iso_lst= Xorriso_lst_get_next(iso_lst, 0); + } + ret= 1; +ex:; + if(!(flag & 1)) + Xorriso_destroy_di_array(xorriso, 0); + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/sort_cmp.h b/libisoburn/branches/1.1.8/xorriso/sort_cmp.h new file mode 100644 index 00000000..8bc402bd --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/sort_cmp.h @@ -0,0 +1,62 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of functions which sort and compare + tree nodes. +*/ + + +#ifndef Xorriso_pvt_sort_cmp_includeD +#define Xorriso_pvt_sort_cmp_includeD yes + + +int Xorriso__findi_sorted_ino_cmp(const void *p1, const void *p2); + +int Xorriso__hln_cmp(const void *p1, const void *p2); + +int Xorriso__findi_sorted_cmp(const void *p1, const void *p2); + +int Xorriso__search_node(void *node_array[], int n, + int (*cmp)(const void *p1, const void *p2), + void *node, int *idx, int flag); + +int Xorriso_search_in_hln_array(struct XorrisO *xorriso, + void *node, int *idx, int flag); + +int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag); + +int Xorriso__di_ino_cmp(const void *p1, const void *p2); + +int Xorriso__di_cmp(const void *p1, const void *p2); + +int Xorriso__sort_di(void *node_array[], int count, int flag); + +int Xorriso_invalidate_di_item(struct XorrisO *xorriso, IsoNode *node, + int flag); + +int Xorriso_search_di_range(struct XorrisO *xorriso, IsoNode *node, + int *idx, int *low, int *high, int flag); + +int Xorriso__node_lba_cmp(const void *node1, const void *node2); + +int Xorriso__node_name_cmp(const void *node1, const void *node2); + +int Xorriso_sorted_node_array(struct XorrisO *xorriso, + IsoDir *dir_node, + int *nodec, IsoNode ***node_array, + off_t boss_mem, int flag); + +int Xorriso_remake_hln_array(struct XorrisO *xorriso, int flag); + +int Xorriso_make_di_array(struct XorrisO *xorriso, int flag); + +int Xorriso_search_hardlinks(struct XorrisO *xorriso, IsoNode *node, + int *node_idx, int *min_hl, int *max_hl, int flag); + + +#endif /* ! Xorriso_pvt_sort_cmp_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/text_io.c b/libisoburn/branches/1.1.8/xorriso/text_io.c new file mode 100644 index 00000000..973e50d5 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/text_io.c @@ -0,0 +1,2140 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the implementation of text i/o functions. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> +#include <signal.h> + +/* for -charset */ +#include <iconv.h> +#include <langinfo.h> +#include <locale.h> + + +#ifdef Xorriso_with_readlinE +#ifdef Xorriso_with_old_readlinE +#include <readline.h> +#include <history.h> +#else /* Xorriso_with_old_readlinE */ +#include <readline/readline.h> +#include <readline/history.h> +#endif /* ! Xorriso_with_old_readlinE */ +#endif /* Xorriso_with_readlinE */ + + +#include "xorriso.h" +#include "xorriso_private.h" +#include "xorrisoburn.h" + + +int Xorriso_protect_stdout(struct XorrisO *xorriso, int flag) +{ + if(xorriso->dev_fd_1>=0) + return(2); + xorriso->dev_fd_1= dup(1); + close(1); + dup2(2,1); + return(1); +} + + +int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize, + int flag) +/* + bit0= do not write to history + bit1= do not read input (but eventually write to history) + bit2= do not write to history line which begin with "-history:" or "-history " +*/ +{ + char *cpt= NULL, **argv= NULL, *linept, *why_append= ""; + int ret, argc= 0, base_length= 0, l, append_line; +#ifdef Xorriso_with_readlinE + static char last_input[SfileadrL]= {""}; +#endif /* ! Xorriso_with_readlinE */ + double tdiff; + struct timeval tv; + struct timezone tz; + + gettimeofday(&tv,&tz); + tdiff= tv.tv_sec+(1.e-6*(double) tv.tv_usec); + + fflush(stdout); + linept= line; + +get_single:; +#ifdef Xorriso_with_readlinE + + if(xorriso->use_stdin || xorriso->dev_fd_1>=0) { + if(flag&2) + {ret= 1; goto ex;} + if(Sfile_fgets_n(linept,linesize - base_length - 1, stdin, + (xorriso->dialog == 2)) == NULL) { + /* need a very dramatic end */ + kill(getpid(),SIGHUP); + {ret= -1; goto ex;} + } + goto process_single; + } + if(flag&2) { + cpt= NULL; + } else { + cpt= readline(""); + if(cpt==NULL) { + /* need a very dramatic end */ + kill(getpid(),SIGHUP); + {ret= -1; goto ex;} + } + l= strlen(cpt); + if(l >= linesize - base_length - 1) { + strncpy(linept, cpt, linesize - 1); + line[linesize - 1]= 0; + sprintf(xorriso->info_text,"Input line too long !"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + goto new_empty; + } else + strcpy(linept, cpt); + } + +process_single:; + +#else /* Xorriso_with_readlinE */ + + if(flag&2) + {ret= 1; goto ex;} + if(Sfile_fgets_n(linept, linesize - base_length - 1, stdin, + (xorriso->dialog == 2)) == NULL) { + /* need a very dramatic end */ + kill(getpid(),SIGHUP); + {ret= -1; goto ex;} + } + +#endif /* ! Xorriso_with_readlinE */ + + if(xorriso->dialog == 2) { + append_line= 0; + if(linept != line && strcmp(linept, "@@@") == 0) { + sprintf(xorriso->info_text, "Incomplete input line cleared by %s", + linept); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0); +new_empty:; + line[0]= 0; + linept= line; + sprintf(xorriso->info_text, "-------------------------------------\n"); + Xorriso_info(xorriso,0); + sprintf(xorriso->info_text, "Enter new text for empty input line :\n"); + Xorriso_info(xorriso,0); + goto get_single; + } + l= strlen(line); + ret= Sfile_make_argv("", line, &argc, &argv, 16); + if(ret < 0) + goto ex; + if(ret == 0 && !append_line) { + /* append a newline character */ + if(l >= linesize - 1) { + sprintf(xorriso->info_text,"Input line too long !"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + goto new_empty; + } + line[l]= '\n'; + line[l + 1]= 0; + append_line= 1; + why_append= "Quoted newline char"; + } + if(l > 0 && !append_line) + if(line[l - 1] == '\\') { + line[l - 1]= 0; + append_line= 1; + why_append= "Trailing backslash "; + } + if(append_line) { + base_length= strlen(line); + linept= line + base_length; + sprintf(xorriso->info_text, + "---------------------------------------------------------------\n"); + Xorriso_info(xorriso,0); + sprintf(xorriso->info_text, + "%s : Enter rest of line (or @@@ to clear it) :\n", why_append); + Xorriso_info(xorriso,0); + goto get_single; + } + } + +#ifdef Xorriso_with_readlinE + + if(line[0]!=0 && strcmp(last_input,line)!=0 && !(flag&1)) + if(!((flag&4) && + (strncmp(line,"-history:",9)==0 || strncmp(line,"-history ",9)==0))) { + add_history(line); + strncpy(last_input,line,sizeof(last_input)-1); + last_input[sizeof(last_input)-1]= 0; + } + +#endif /* ! Xorriso_with_readlinE */ + + ret= 1; +ex:; + if(cpt!=NULL) + free(cpt); + gettimeofday(&tv,&tz); + xorriso->idle_time+= tv.tv_sec+(1.e-6*(double) tv.tv_usec)-tdiff; + return(ret); +} + + +int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag) +/* + bit0= important operation going on: + demand confirmation of abort, only abort on @@@ + bit1= mark '@' and '@@' by return 4 + bit2= accept: i|n= ignore | do not remove , r|y= retry | remove , q|x= abort + bit3= @@@ = 'done reading' rather than 'abort' + bit4= in non-dialog mode return 6 rather than 1 +*/ +/* return: <=0 error + 1= go on | do not remove existing file + 2= abort + 3= redo request for confirmation + 4= see flag bit1 + (5= skip volume) + 6= retry failed operation | remove existing file + */ +{ + int ret; + char *line= NULL, *cpt, *previous_line= NULL; + char *abort_req_text,*abort_really_text; + + Xorriso_alloc_meM(line, char, SfileadrL); + Xorriso_alloc_meM(previous_line, char, SfileadrL); + + if(!xorriso->dialog) { + if(flag&16) + {ret= 6; goto ex;} + {ret= 1; goto ex;} + } + if(flag&8) { + abort_req_text= "request to end"; + abort_really_text= "done reading"; + } else { + abort_req_text= "request to abort"; + abort_really_text= "abort this command"; + } + ret= Xorriso_dialog_input(xorriso,line, SfileadrL, 1); + xorriso->result_line_counter= 0; + xorriso->result_page_counter++; + if(ret<=0) + if(xorriso->result_page_length>0) + xorriso->result_page_length= -xorriso->result_page_length; + + cpt= line; + if(strcmp(cpt,"@@@")==0 || + strcmp(cpt,"x")==0 || strcmp(cpt,"X")==0 || + strcmp(cpt,"q")==0 || strcmp(cpt,"Q")==0) { + if(flag&1) { + strcpy(previous_line,cpt); + sprintf(xorriso->info_text, + "... [%s = %s registered. Really %s ? (y/n) ] ...\n", + cpt,abort_req_text,abort_really_text); + Xorriso_info(xorriso,0); + ret= Xorriso_dialog_input(xorriso,line, SfileadrL, 1); + if(ret<=0) + goto ex; + cpt= line; + if(strcmp(cpt,previous_line)==0 || + ((*cpt=='Y' || *cpt=='y' || *cpt=='j' || *cpt=='J' || *cpt=='1') && + *(cpt+1)==0)) { + xorriso->request_to_abort= 1; + sprintf(xorriso->info_text, + "------- ( %s confirmed )\n",abort_req_text); + Xorriso_info(xorriso,0); + {ret= 2; goto ex;} + } + sprintf(xorriso->info_text, "....... ( %s revoked )\n",abort_req_text); + Xorriso_info(xorriso,0); + {ret= 3; goto ex;} + } + xorriso->request_to_abort= 1; + sprintf(xorriso->info_text, +"----------- [%s = request to abort registered. Operation ends ] ------------\n", + cpt); + Xorriso_info(xorriso,0); + {ret= 2; goto ex;} + } else if(*cpt=='@') { + if(strcmp(cpt,"@@")==0) { + goto klammer_affe; + + } else if(strcmp(cpt,"@")==0) { +klammer_affe:; + if(xorriso->result_page_length>0) + xorriso->result_page_length= -xorriso->result_page_length; + if(flag&1) { + sprintf(xorriso->info_text, +"... [@ = prompt suppression registered. Prompting disabled temporarily ] ...\n"); + Xorriso_info(xorriso,0); + } + + } else { + Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */ + sprintf(xorriso->info_text, + "--- Unrecognized input beginning with @. Please enter someting else.\n"); + Xorriso_info(xorriso,0); + {ret= 3; goto ex;} + } + if(flag&2) + {ret= 4; goto ex;} + if(flag&1) + {ret= 3; goto ex;} + {ret= 1; goto ex;} + } else if(flag&4) { + + if(strcmp(cpt,"i")==0 || strcmp(cpt,"I")==0 || + strcmp(cpt,"n")==0 || strcmp(cpt,"N")==0 || + *cpt==0) { + {ret= 1; goto ex;} + } else if(strcmp(cpt,"r")==0 || strcmp(cpt,"R")==0 || + strcmp(cpt,"y")==0 || strcmp(cpt,"Y")==0) { + {ret= 6; goto ex;} + } else { + /* >>> unknown input */ + sprintf(xorriso->info_text, + "--- Please enter one of : empty line, i,n, r,y, q,x, @, @@@\n"); + Xorriso_info(xorriso,0); + {ret= 3; goto ex;} + } + + } else if(*cpt!=0 && !(flag&1)) { + Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */ + strcpy(xorriso->pending_option,cpt); + xorriso->request_to_abort= 1; + sprintf(xorriso->info_text, +"-------------- [ Input of option registered. Operation ends ] ---------------\n"); + Xorriso_info(xorriso,0); + {ret= 2; goto ex;} + + } else if(*cpt!=0) { + Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */ + sprintf(xorriso->info_text, + "--- Please enter one of : empty line, @, @@@\n"); + Xorriso_info(xorriso,0); + {ret= 3; goto ex;} + } + ret= 1; +ex:; + Xorriso_free_meM(line); + Xorriso_free_meM(previous_line); + return(ret); +} + + +/* @param flag bit0= quoted multiline mode + bit1= release allocated memory and return 1 + bit2= with bit0: warn of empty text arguments + bit3= deliver as single quoted text including all whitespace + and without any backslash interpretation + @return -1=out of memory , 0=line format error , 1=ok, go on , 2=done +*/ +int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, + int *argc, char ***argv, int flag) +{ + char *line= NULL, *linept, *fgot; + int l, base_length, append_line, ret, mem_linecount, i; + + Sfile_make_argv("", line, argc, argv, 2); + if(flag & 2) + {ret= 1; goto ex;} + + Xorriso_alloc_meM(line, char, 5 * SfileadrL + 2); + + mem_linecount= *linecount; + linept= line; + base_length= 0; + while(1) { + fgot= Sfile_fgets_n(linept, SfileadrL - base_length - 1, fp, + !!(flag & (1 | 8))); + if(fgot == NULL) { + if(ferror(fp)) + {ret= 0; goto ex;} + if(linept != line) { + sprintf(xorriso->info_text,"Open quotation mark at end of input"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + {ret= 2; goto ex;} + } + l= strlen(line); + (*linecount)++; + append_line= 0; + if(flag & 1) { /* check whether the line is incomplete yet */ + ret= Sfile_make_argv("", line, argc, argv, 16); + if(ret < 0) + goto ex; + if(ret == 0 && !append_line) { + line[l]= '\n'; + line[l + 1]= 0; + append_line= 1; + } + if(l > 0 && !append_line) + if(line[l - 1] == '\\') { + line[l - 1]= 0; + append_line= 1; + } + } + if(l >= SfileadrL) { + sprintf(xorriso->info_text,"Input line too long !"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(!append_line) + break; + base_length= strlen(line); + linept= line + base_length; + } + if((flag & 1) && !(flag & 8)) { + ret= Sfile_make_argv("", line, argc, argv, + 1 | ((xorriso->bsl_interpretation & 3) << 5)); + if(ret < 0) + goto ex; + if(flag & 4) + for(i= 0; i < *argc; i++) { + if((*argv)[i][0] == 0) { + sprintf(xorriso->info_text, "Empty text as quoted argument in "); + } else if(strlen((*argv)[i]) >= SfileadrL) { + (*argv)[i][SfileadrL - 1]= 0; + sprintf(xorriso->info_text, + "Input text too long and now truncated in"); + } else + continue; + if(mem_linecount + 1 < *linecount) + sprintf(xorriso->info_text + strlen(xorriso->info_text), + "lines %d to %d", mem_linecount + 1, *linecount); + else + sprintf(xorriso->info_text + strlen(xorriso->info_text), + "line %d", mem_linecount + 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + } else { + (*argv)= Smem_malloC(sizeof(char *)); + if(argv == NULL) + {ret= -1; goto ex;} + (*argv)[0]= strdup(line); + if((*argv)[0] == NULL) + {ret= -1; goto ex;} + *argc= 1; + } + ret= 1; +ex:; + Xorriso_free_meM(line); + return(ret); +} + + +int Xorriso_predict_linecount(struct XorrisO *xorriso, char *line, + int *linecount, int flag) +{ + int width,l; + char *spt,*ept; + + *linecount= 0; + spt= line; + width= xorriso->result_page_width; + while(1) { + ept= strchr(spt,'\n'); + if(ept==NULL) + l= strlen(spt); + else + l= ept-spt; + l+= xorriso->result_open_line_len; + if(ept!=NULL && l==0) + (*linecount)++; + else { + (*linecount)+= l/width; + if(ept==NULL) { + xorriso->result_open_line_len= l%width; + break; + } + (*linecount)+= !!(l%width); + } + xorriso->result_open_line_len= 0; + spt= ept+1; + } + return(1); +} + + +int Xorriso_pager(struct XorrisO *xorriso, char *line, int flag) +/* + bit1= mark '@' by return 4 +*/ +/* return: <=0 error , 1=go on , 2=abort , 4=see flag bit1*/ +{ + int ret,linecount; + char *info_text= NULL; + + if(xorriso->result_page_length<=0 || xorriso->request_not_to_ask || + xorriso->dialog == 0) + {ret= 1; goto ex;} + Xorriso_predict_linecount(xorriso,line,&linecount,0); + if(xorriso->result_line_counter+linecount>xorriso->result_page_length) { +ask_for_page:; + if(info_text == NULL) + Xorriso_alloc_meM(info_text, char, 10*SfileadrL); + strcpy(info_text,xorriso->info_text); + sprintf(xorriso->info_text,"\n"); + Xorriso_info(xorriso,0); + sprintf(xorriso->info_text, +".... [Press Enter to continue. @,Enter avoids further stops. @@@ aborts] ....\n"); + Xorriso_info(xorriso,0); + ret= Xorriso_request_confirmation(xorriso,flag&2); + strcpy(xorriso->info_text,info_text); + if(ret<=0) + goto ex; + if(ret==2) + {ret= 2; goto ex;} + if(ret==3) + goto ask_for_page; + } + xorriso->result_line_counter+= linecount; + ret= 1; +ex:; + Xorriso_free_meM(info_text); + return(ret); +} + + +int Xorriso_write_to_channel(struct XorrisO *xorriso, + char *in_text, int channel_no, int flag) +/* + bit0= eventually backslash encode linefeeds + bit1= text is the name of the log file for the given channel + bit2= text is the name of the consolidated packet log file for all channels +bit15= with bit1 or bit2: close depicted log file +*/ +{ + char *rpt, *npt, *text= NULL; + int ret= 1, info_redirected= 0, result_redirected= 0; + char prefix[16]; + FILE *logfile_fp, *pktlog_fp; + struct Xorriso_lsT *msglist; + static int num_channels= 4; + static char channel_prefixes[4][4]= {".","R","I","M"}; + + text= in_text; /* might change due to backslash encoding */ + + if(channel_no<0 || channel_no>=num_channels) + {ret= -1; goto ex;} + + /* Logfiles */ + logfile_fp= xorriso->logfile_fp[channel_no]; + pktlog_fp= xorriso->pktlog_fp; + if((flag&2) && logfile_fp!=NULL) { + fprintf(logfile_fp, + "! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n", + channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256)); + fclose(logfile_fp); + xorriso->logfile_fp[channel_no]= logfile_fp= NULL; + } + if((flag&4) && pktlog_fp!=NULL) { + fprintf(pktlog_fp, + "I:1:! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n", + channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256)); + fclose(pktlog_fp); + xorriso->pktlog_fp= pktlog_fp= NULL; + } + if(flag&(1<<15)) + {ret= 1; goto ex;} + if((flag&2)) { + xorriso->logfile_fp[channel_no]= logfile_fp= fopen(text,"a"); + if(logfile_fp==NULL) + {ret= 0; goto ex;} + fprintf(logfile_fp, + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : %s : %s\n", + channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256)); + fflush(logfile_fp); + } + if((flag&4)) { + xorriso->pktlog_fp= pktlog_fp= fopen(text,"a"); + if(pktlog_fp==NULL) + {ret= 0; goto ex;} + fprintf(pktlog_fp, + "I:1:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : . : %s\n", + Sfile_datestr(time(0),1|2|256)); + fflush(pktlog_fp); + } + if(flag&(2|4)) + {ret= 1; goto ex;} + + /* Eventually perform backslash encoding of non-printable characters */ + if(((xorriso->bsl_interpretation & 32) && channel_no == 1) || + ((xorriso->bsl_interpretation & 64) && channel_no == 2)) { + ret= Sfile_bsl_encoder(&text, text, strlen(text), 1 | 2 | 4); + if(ret <= 0) + {ret= -1; goto ex;} + } + + /* Eventually perform messag redirection */ + if(xorriso->msglist_stackfill > 0) { + if(xorriso->msglist_flags[xorriso->msglist_stackfill - 1] & 1) + result_redirected= 1; + if(xorriso->msglist_flags[xorriso->msglist_stackfill - 1] & 2) + info_redirected= 1; + } + if(result_redirected) { + if(channel_no==1 || channel_no==3) { + msglist= xorriso->result_msglists[xorriso->msglist_stackfill - 1]; + ret= Xorriso_lst_append_binary(&msglist, text, strlen(text) + 1, 0); + if(ret <= 0) + {ret= -1; goto ex;} + if(xorriso->result_msglists[xorriso->msglist_stackfill - 1] == NULL) + xorriso->result_msglists[xorriso->msglist_stackfill - 1]= msglist; + } + } + if(info_redirected) { + if(channel_no==2 || channel_no==3) { + msglist= xorriso->info_msglists[xorriso->msglist_stackfill - 1]; + ret= Xorriso_lst_append_binary(&msglist, text, strlen(text) + 1, 0); + if(ret <= 0) + {ret= -1; goto ex;} + if(xorriso->info_msglists[xorriso->msglist_stackfill - 1] == NULL) + xorriso->info_msglists[xorriso->msglist_stackfill - 1]= msglist; + } + } + if((channel_no == 1 && result_redirected) || + (channel_no == 2 && info_redirected) || + (result_redirected && info_redirected)) + {ret= 1; goto ex;} + + /* Non-redirected output */ + if(!xorriso->packet_output) { + if(channel_no==1 || channel_no==3) { + printf("%s",text); + fflush(stdout); + } + if(channel_no==2 || channel_no==3) + fprintf(stderr,"%s",text); + if(logfile_fp!=NULL) { + fprintf(logfile_fp,"%s",text); + fflush(logfile_fp); + } + if(pktlog_fp==NULL) + {ret= 1; goto ex;} + } + rpt= text; + sprintf(prefix,"%s:x: ",channel_prefixes[channel_no]); + while(*rpt!=0) { + npt= strchr(rpt,'\n'); + if(npt==NULL) + prefix[2]= '0'; + else + prefix[2]= '1'; + if(xorriso->packet_output) { + ret= fwrite(prefix,5,1,stdout); + if(ret<=0) + {ret= 0; goto ex;} + } + if(pktlog_fp!=NULL) { + ret= fwrite(prefix,5,1,pktlog_fp); + if(ret<=0) + {ret= 0; goto ex;} + } + if(npt==NULL) { + if(xorriso->packet_output) { + ret= fwrite(rpt,strlen(rpt),1,stdout); + if(ret<=0) + {ret= 0; goto ex;} + ret= fwrite("\n",1,1,stdout); + if(ret<=0) + {ret= 0; goto ex;} + } + if(pktlog_fp!=NULL) { + ret= fwrite(rpt,strlen(rpt),1,pktlog_fp); + if(ret<=0) + {ret= 0; goto ex;} + ret= fwrite("\n",1,1,pktlog_fp); + if(ret<=0) + {ret= 0; goto ex;} + } + break; + } else { + if(xorriso->packet_output) { + ret= fwrite(rpt,npt+1-rpt,1,stdout); + if(ret<=0) + {ret= 0; goto ex;} + } + if(pktlog_fp!=NULL) { + ret= fwrite(rpt,npt+1-rpt,1,pktlog_fp); + if(ret<=0) + {ret= 0; goto ex;} + } + } + rpt= npt+1; + } + if(xorriso->packet_output) + fflush(stdout); + if(pktlog_fp!=NULL) + fflush(pktlog_fp); + ret= 1; +ex: + if(text != in_text && text != NULL) + free(text); + return(ret); +} + + +int Xorriso_push_outlists(struct XorrisO *xorriso, int *stack_handle, + int flag) +{ + if(xorriso->msglist_stackfill + 1 >= Xorriso_max_outlist_stacK) { + Xorriso_msgs_submit(xorriso, 0, + "Overflow of message output redirection stack", 0, "FATAL", 0); + return(-1); + } + if((flag & 3) == 0) + flag|= 3; + xorriso->msglist_stackfill++; + xorriso->result_msglists[xorriso->msglist_stackfill - 1]= NULL; + xorriso->info_msglists[xorriso->msglist_stackfill - 1]= NULL; + xorriso->msglist_flags[xorriso->msglist_stackfill - 1]= flag & 3; + *stack_handle= xorriso->msglist_stackfill - 1; + return(1); +} + + +int Xorriso_pull_outlists(struct XorrisO *xorriso, int stack_handle, + struct Xorriso_lsT **result_list, + struct Xorriso_lsT **info_list, int flag) +{ + int i; + + if(stack_handle < 0 || stack_handle >= xorriso->msglist_stackfill) { + Xorriso_msgs_submit(xorriso, 0, + "Program error: Wrong message output redirection stack handle", + 0, "FATAL", 0); + return(-1); + } + *result_list= xorriso->result_msglists[stack_handle]; + *info_list= xorriso->info_msglists[stack_handle]; + for(i = stack_handle + 1; i < xorriso->msglist_stackfill - 1; i++) { + xorriso->result_msglists[i - 1]= xorriso->result_msglists[i]; + xorriso->info_msglists[i - 1]= xorriso->info_msglists[i]; + } + xorriso->msglist_stackfill--; + return(1); +} + + +int Xorriso_result(struct XorrisO *xorriso, int flag) +/* + bit0= no considerations or computations or dialog. Just put out. +*/ +{ + int ret, redirected= 0; + + if(flag&1) + goto put_it_out; + if(xorriso->request_to_abort) + return(1); + if(xorriso->msglist_stackfill > 0) + if(xorriso->msglist_flags[xorriso->msglist_stackfill - 1] & 1) + redirected= 1; + if(xorriso->result_page_length>0 && !redirected) { + ret= Xorriso_pager(xorriso,xorriso->result_line,2); + if(ret<=0) + return(ret); + if(ret==2) + return(1); + if(xorriso->request_to_abort) + return(1); + } +put_it_out:; + xorriso->bar_is_fresh= 0; + ret= Xorriso_write_to_channel(xorriso, xorriso->result_line, 1,0); + return(ret); +} + + +int Xorriso_info(struct XorrisO *xorriso, int flag) +/* + bit0= use pager (as with result) + bit1= permission to suppress output + bit2= insist in showing output +*/ +{ + int ret; + static int note_sev= 0; + + if(flag&2) + if(xorriso->request_to_abort) + return(1); + + if(note_sev==0) + Xorriso__text_to_sev("NOTE", ¬e_sev, 0); + if(note_sev<xorriso->report_about_severity && + note_sev<xorriso->abort_on_severity && !(flag&4)) + return(1); + + if(flag&1) { + ret= Xorriso_pager(xorriso,xorriso->info_text,2); + if(ret<=0) + return(ret); + if(ret==2) + return(1); + if(flag&2) + if(xorriso->request_to_abort) + return(1); + } + xorriso->bar_is_fresh= 0; + ret=Xorriso_write_to_channel(xorriso, xorriso->info_text, 2, 0); + return(ret); +} + + +int Xorriso_mark(struct XorrisO *xorriso, int flag) +{ + int ret= 1,r_ret,i_ret; + + if(xorriso->mark_text[0]==0) + return(1); + if(xorriso->packet_output) + ret=Xorriso_write_to_channel(xorriso, xorriso->mark_text, 3, 0); + else { + sprintf(xorriso->result_line,"%s\n",xorriso->mark_text); + r_ret= Xorriso_result(xorriso,1); + strcpy(xorriso->info_text,xorriso->result_line); + i_ret= Xorriso_info(xorriso,0); + if(r_ret==0 || i_ret==0) + ret= 0; + } + return(ret); +} + + +int Xorriso_restxt(struct XorrisO *xorriso, char *text) +{ + int ret; + + strncpy(xorriso->result_line,text,sizeof(xorriso->result_line)-1); + xorriso->result_line[sizeof(xorriso->result_line)-1]= 0; + ret= Xorriso_result(xorriso,0); + return(ret); +} + + +/* @param flag bit0-7= purpose + 0= ERRFILE + 1= mark line (only to be put out if enabled) +*/ +int Xorriso_process_errfile(struct XorrisO *xorriso, + int error_code, char msg_text[], int os_errno, + int flag) +{ + char ttx[41]; + int purpose; + + if(strlen(msg_text)>SfileadrL) + return(-1); + + purpose= flag&255; + if(purpose==1 && !(xorriso->errfile_mode&1)) + return(2); + if(xorriso->errfile_fp!=NULL) { + if(purpose==1) + fprintf(xorriso->errfile_fp, "----------------- %s %s\n", + msg_text, Ftimetxt(time(0), ttx, 1)); + else + fprintf(xorriso->errfile_fp, "%s\n", msg_text); + fflush(xorriso->errfile_fp); + return(1); + } + if(xorriso->errfile_log[0]==0) + return(1); + if(strcmp(xorriso->errfile_log, "-")==0 || + strcmp(xorriso->errfile_log, "-R")==0) { + if(purpose==1) + sprintf(xorriso->result_line, "----------------- %s %s\n", + msg_text, Ftimetxt(time(0), ttx, 1)); + else + sprintf(xorriso->result_line, "%s\n", msg_text); + Xorriso_result(xorriso, 1); + return(1); + } + if(strcmp(xorriso->errfile_log, "-I")==0) { + if(purpose==1) + sprintf(xorriso->info_text, "ERRFILE_MARK=%s %s\n", + msg_text, Ftimetxt(time(0), ttx, 1)); + else + sprintf(xorriso->info_text, "ERRFILE=%s\n", msg_text); + Xorriso_info(xorriso, 0); + return(1); + } + return(2); +} + + +/* Note: It is ok to submit xorriso->info_text as msg_text here. */ +/* flag: + bit0= for Xorriso_info() : use pager (as with result) + bit1= for Xorriso_info() : permission to suppress output + bit2..5= name prefix + 0="xorriso" + 1="libisofs" + 2="libburn" + 3="libisoburn" + else: "" + bit6= append carriage return rather than line feed (if not os_errno) + bit7= perform Xorriso_process_msg_queues() first +*/ +int Xorriso_msgs_submit(struct XorrisO *xorriso, + int error_code, char msg_text[], int os_errno, + char severity[], int flag) +{ + int ret, lt, li, sev, i; + char *sev_text= "FATAL", prefix[80]; + static char pfx_list[20][16]= { + "xorriso : ", "libisofs: ", "libburn : ", "libisoburn: ", + "", "", "", "", "", "", "", "", "", "", "", "" }; + + if(flag&128) + Xorriso_process_msg_queues(xorriso, 0); + + if(strcmp(severity, "ERRFILE")==0) + Xorriso_process_errfile(xorriso, error_code, msg_text, os_errno, 0); + + /* Set problem status */ + ret= Xorriso__text_to_sev(severity, &sev, 0); + if(ret<=0) + Xorriso__text_to_sev(sev_text, &sev, 0); + else + sev_text= severity; + if(xorriso->problem_status<sev) { + xorriso->problem_status= sev; + strcpy(xorriso->problem_status_text, sev_text); + } + if(xorriso->eternal_problem_status<sev) { + xorriso->eternal_problem_status= sev; + strcpy(xorriso->eternal_problem_status_text, sev_text); + } + + /* Report problem event */ + if(sev<xorriso->report_about_severity && sev<xorriso->abort_on_severity) + return(2); + sprintf(prefix,"%s%s : ", pfx_list[(flag>>2)&15], sev_text); + li= strlen(prefix); + lt= strlen(msg_text); + if(lt > ((int) sizeof(xorriso->info_text)) - li - 2) + lt= sizeof(xorriso->info_text)-li-2; + if(msg_text==xorriso->info_text) { + for(i= lt; i>=0; i--) + msg_text[i+li]= msg_text[i]; + for(i=0; i<li; i++) + msg_text[i]= prefix[i]; + } else { + strcpy(xorriso->info_text, prefix); + strncpy(xorriso->info_text+li, msg_text, lt); + } + if((flag&64) && os_errno<=0) + xorriso->info_text[li+lt]= '\r'; + else + xorriso->info_text[li+lt]= '\n'; + xorriso->info_text[li+lt+1]= 0; + +#ifdef NIX + + /* <<< */ + Xorriso_info(xorriso,4|(flag&3)); + if(os_errno>0) { + sprintf(xorriso->info_text, "%s%s : %s\n", + pfx_list[(flag>>2)&15], sev_text, strerror(os_errno)); + Xorriso_info(xorriso,4|(flag&3)); + } + +#else + + if(os_errno>0) { + sprintf(xorriso->info_text + strlen(xorriso->info_text) - 1, + " : %s\n", strerror(os_errno)); + } + Xorriso_info(xorriso,4|(flag&3)); + +#endif + + return(1); +} + + +/* To be used with isoburn_set_msgs_submit() +*/ +int Xorriso_msgs_submit_void(void *xorriso, + int error_code, char msg_text[], int os_errno, + char severity[], int flag) +{ + int ret; + + ret= Xorriso_msgs_submit((struct XorrisO *) xorriso, error_code, msg_text, + os_errno, severity, flag); + return(ret); +} + + +/** @return -1= abort , 0= no , 1= yes +*/ +int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will, + int flag) +{ + int ret; + + if(!xorriso->do_reassure) + return(1); + sprintf(xorriso->info_text, "Really perform %s which will %s ? (y/n)\n", + cmd, which_will); + Xorriso_info(xorriso, 4); + do { + ret= Xorriso_request_confirmation(xorriso, 2|4|16); + } while(ret==3); + if(ret==6 || ret==4) { + sprintf(xorriso->info_text, "%s confirmed", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); + } + if(ret==2) { + sprintf(xorriso->info_text, "%s aborted", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(-1); + } + sprintf(xorriso->info_text, "%s revoked", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(0); +} + + +int Xorriso_write_session_log(struct XorrisO *xorriso, int flag) +{ + FILE *fp= NULL; + char *sfe= NULL, timetext[40], *rpt, *wpt; + int ret; + + if(xorriso->session_logfile[0]==0) + {ret= 2; goto ex;} + + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL); + + fp= fopen(xorriso->session_logfile, "a"); + if(fp==0) { + sprintf(xorriso->info_text, "-session_log: Cannot open file %s", + Text_shellsafe(xorriso->session_logfile, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + wpt= sfe; + for(rpt= xorriso->volid; *rpt!=0; rpt++) { + if(*rpt=='\n') { + *(wpt++)= '\\'; + *(wpt++)= 'n'; + } else + *(wpt++)= *rpt; + } + *wpt= 0; + fprintf(fp, "%s %d %d %s\n", + Ftimetxt(time(0), timetext, 2), xorriso->session_lba, + xorriso->session_blocks, sfe); + fclose(fp); + ret= 1; +ex:; + Xorriso_free_meM(sfe); + return(ret); +} + + +int Xorriso_status_filter(struct XorrisO *xorriso, char *filter, char *line, + int flag) +{ + if(filter!=NULL) + if(filter[0]=='-') + if(strncmp(filter, line, strlen(filter))!=0) + return(0); + return(1); +} + + +int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag) +/* +bit1= do only report to fp +*/ +{ + int ret; + + ret= Xorriso_status_filter(xorriso, filter, xorriso->result_line, 0); + if(ret <= 0) + return(2); + if(!(flag&2)) + Xorriso_result(xorriso,0); + if(fp!=NULL) { + ret= fwrite(xorriso->result_line,strlen(xorriso->result_line),1,fp); + if(ret<=0) + return(ret); + } + return(1); +} + + +int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) +/* + bit0= do only report non-default settings + bit1= do only report to fp + bit2= report current -resume status even if bit0 is set, but only if valid + bit3= report readline history + bit4= report -resume options indirectly as + -options_from_file:${resume_state_file}_pos +*/ +{ + int is_default, no_defaults, i, ret, adr_mode, do_single, behavior; + int show_indev= 1, show_outdev= 1, show_dev= 0; + int part_table_implicit= 0; + char *line, *sfe= NULL, mode[80], *form, *treatment; + char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt; + char *dev_filter= NULL, *xorriso_id= NULL; + static char channel_prefixes[4][4]= {".","R","I","M"}; + static char load_names[][20]= {"auto", "session", "track", "lba", "volid"}; + static int max_load_mode= 4; + struct Xorriso_lsT *paths, *leafs, *s, *plst, *vlst; + + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL + 80); + Xorriso_alloc_meM(xorriso_id, char, 129); + + no_defaults= flag&1; + line= xorriso->result_line; + + if(xorriso->no_rc) { + sprintf(line,"-no_rc\n"); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + is_default= strcmp(xorriso->list_delimiter, "--") == 0; + sprintf(line,"-list_delimiter %s\n", xorriso->list_delimiter); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= 0; + if(xorriso->dialog == 2) + sprintf(line,"-dialog on\n"); + else if(xorriso->dialog == 1) + sprintf(line,"-dialog single_line\n"); + else { + sprintf(line,"-dialog off\n"); + is_default= 1; + } + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->result_page_length==0 && xorriso->result_page_width==80); + sprintf(line,"-page %d %d\n", + (xorriso->result_page_length>=0?xorriso->result_page_length + :-xorriso->result_page_length), + xorriso->result_page_width); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->use_stdin==0); + sprintf(line,"-use_readline %s\n", (xorriso->use_stdin?"off":"on")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->bsl_interpretation == 0); + strcpy(line, "-backslash_codes "); + if(xorriso->bsl_interpretation == 0) + strcat(line, "off"); + else if(xorriso->bsl_interpretation == (3 | 16 | 32 | 64)) + strcat(line, "on"); + else { + if((xorriso->bsl_interpretation & 3) == 1) + strcat(line, "in_double_quotes"); + else if((xorriso->bsl_interpretation & 3) == 2) + strcat(line, "in_quotes"); + else if((xorriso->bsl_interpretation & 3) == 3) + strcat(line, "with_quoted_input"); + if(xorriso->bsl_interpretation & 16) { + if(strlen(line) > 17) + strcat(line, ":"); + strcat(line, "with_program_arguments"); + } + if((xorriso->bsl_interpretation & (32 | 64)) == (32 | 64)) { + if(strlen(line) > 17) + strcat(line, ":"); + strcat(line, "encode_output"); + } else { + if(xorriso->bsl_interpretation & 32) { + if(strlen(line) > 17) + strcat(line, ":"); + strcat(line, "encode_results"); + } + if(xorriso->bsl_interpretation & 64) { + if(strlen(line) > 17) + strcat(line, ":"); + strcat(line, "encode_infos"); + } + } + } + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= !xorriso->packet_output; + sprintf(line,"-pkt_output %s\n",(xorriso->packet_output?"on":"off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + for(i=0;i<4;i++) { + is_default= (xorriso->logfile[i]!=0); + sprintf(line,"-logfile %s %s\n", + channel_prefixes[i],Text_shellsafe(xorriso->logfile[i],sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + is_default= (xorriso->errfile_log[0]==0); + sprintf(line,"-errfile_log %s\n",Text_shellsafe(xorriso->errfile_log,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + if(xorriso->check_media_default == NULL) { + is_default= 1; + sprintf(line, "-check_media_defaults reset=now %s\n", + xorriso->list_delimiter); + } else { + ret= Xorriso_check_media_list_job(xorriso, xorriso->check_media_default, + line, no_defaults); + is_default= (ret == 2); + strcat(line, "\n"); + } + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + behavior= Xorriso__get_signal_behavior(0); + is_default= (behavior == 1); + treatment= "on"; + if(behavior == 0) + treatment= "off"; + else if(behavior == 2) + treatment= "sig_dfl"; + else if(behavior == 3) + treatment= "sig_ign"; + sprintf(line,"-signal_handling %s\n", treatment); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->img_read_error_mode==2); + treatment= "best_effort"; + if(xorriso->img_read_error_mode==1) + treatment= "failure"; + else if(xorriso->img_read_error_mode==2) + treatment= "fatal"; + sprintf(line,"-error_behavior image_loading %s\n", treatment); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->extract_error_mode == 1); + treatment= "keep"; + if(xorriso->extract_error_mode == 0) + treatment= "best_effort"; + else if(xorriso->extract_error_mode == 2) + treatment= "delete"; + sprintf(line,"-error_behavior file_extraction %s\n", treatment); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->mark_text[0]==0); + sprintf(line,"-mark %s\n",Text_shellsafe(xorriso->mark_text,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->temp_mem_limit==16*1024*1024); + if((xorriso->temp_mem_limit/1024/1024)*1024*1024==xorriso->temp_mem_limit) + sprintf(line,"-temp_mem_limit %dm\n", xorriso->temp_mem_limit/1024/1024); + else + sprintf(line,"-temp_mem_limit %dk\n", xorriso->temp_mem_limit/1024); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + + sprintf(line,"-prog %s\n",Text_shellsafe(xorriso->progname,sfe,0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + + if(xorriso->ban_stdio_write) { + sprintf(line,"-ban_stdio_write\n"); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + is_default= ((xorriso->early_stdio_test & 14) == 0); + sprintf(line, "-early_stdio_test %s\n", + xorriso->early_stdio_test & 6 ? xorriso->early_stdio_test & 8 ? + "appendable_wo" : "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->allow_restore==0 && xorriso->do_concat_split==1 && + xorriso->do_auto_chmod==0 && xorriso->drives_exclusive == 1); + mode_pt= "off"; + if(xorriso->allow_restore == -1) + mode_pt= "banned"; + else if(xorriso->allow_restore == 1) + mode_pt= "on"; + else if(xorriso->allow_restore == 2) + mode_pt= "device_files"; + if(xorriso->allow_restore == -1) + sprintf(line,"-osirrox %s\n", mode_pt); + else + sprintf(line,"-osirrox %s:%s:%s:%s:%s\n", mode_pt, + xorriso->do_concat_split ? "concat_split_on" : "concat_split_off", + xorriso->do_auto_chmod ? "auto_chmod_on" : "auto_chmod_off", + xorriso->do_restore_sort_lba ? "sort_lba_on" : "sort_lba_off", + xorriso->drives_exclusive ? "o_excl_on" : "o_excl_off" + ); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->mount_opts_flag == 0); + sprintf(line,"-mount_opts %s\n", + xorriso->mount_opts_flag & 1 ? "shared" : "exclusive"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + Xorriso_boot_image_status(xorriso, filter, fp, flag & 3); + + is_default= (xorriso->system_area_disk_path[0] == 0); + sprintf(line,"-boot_image %s system_area=%s\n", + xorriso->system_area_disk_path[0] && (xorriso->system_area_options & 2) + ? "isolinux" : "any", + Text_shellsafe(xorriso->system_area_disk_path, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->partition_offset == 0); + sprintf(line,"-boot_image any partition_offset=%lu\n", + (unsigned long int) xorriso->partition_offset); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->partition_secs_per_head == 0); + sprintf(line,"-boot_image any partition_sec_hd=%lu\n", + (unsigned long int) xorriso->partition_secs_per_head); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->partition_heads_per_cyl == 0); + sprintf(line,"-boot_image any partition_hd_cyl=%lu\n", + (unsigned long int) xorriso->partition_heads_per_cyl); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + ret= (xorriso->system_area_options & 0x300) >> 8; + is_default= (ret == 0); + sprintf(line,"-boot_image any partition_cyl_align=%s\n", + ret == 0 ? "auto" : ret == 1 ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + if((xorriso->system_area_disk_path[0] || !part_table_implicit) && + (xorriso->partition_offset == 0 || (xorriso->system_area_options & 2))) { + is_default= ((xorriso->system_area_options & 3) == 0); + sprintf(line,"-boot_image %s partition_table=%s\n", + xorriso->system_area_options & 2 ? "isolinux" : "grub", + xorriso->system_area_options & 3 ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + +#ifdef Xorriso_with_isohybriD + if(strcmp(form, "isolinux") == 0) { + static char modes[4][6]= {"off", "auto", "on", "force"}; + is_default= (xorriso->boot_image_isohybrid == 1); + sprintf(line,"-boot_image isolinux isohybrid=%s\n", + modes[xorriso->boot_image_isohybrid & 3]); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } +#endif /* Xorriso_with_isohybriD */ + + sprintf(line,"-cd %s\n", + (xorriso->wdi[0] ? Text_shellsafe(xorriso->wdi,sfe,0) : "'/'")); + Xorriso_status_result(xorriso,filter,fp,flag&2); + sprintf(line,"-cdx %s\n", + (xorriso->wdx[0] ? Text_shellsafe(xorriso->wdx,sfe,0) : "'/'")); + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->split_size==0); + strcpy(line,"-split_size "); + if(xorriso->split_size % (1024*1024) || xorriso->split_size==0) { + Sfile_off_t_text(line+strlen(line), xorriso->split_size, 0); + } else { + Sfile_off_t_text(line+strlen(line), xorriso->split_size / (1024*1024), 0); + strcat(line, "m"); + } + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->add_plainly==0); + sprintf(line,"-add_plainly %s\n", + (xorriso->add_plainly == 1 ? "unknown" : + xorriso->add_plainly == 2 ? "dashed" : + xorriso->add_plainly == 3 ? "any" : "none")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + ret= Exclusions_get_descrs(xorriso->disk_exclusions, &paths, &leafs, 0); + if(ret>0) { + for(; paths!=NULL; paths= paths->next) { + sprintf(line, "-not_paths %s %s\n", + Text_shellsafe(paths->text, sfe, 0), xorriso->list_delimiter); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + for(; leafs!=NULL; leafs= leafs->next) { + sprintf(line,"-not_leaf %s\n", Text_shellsafe(leafs->text, sfe, 0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + } + + is_default= (xorriso->file_size_limit == + Xorriso_default_file_size_limiT); + if(xorriso->file_size_limit <= 0) + sprintf(line, "-file_size_limit off %s\n", xorriso->list_delimiter); + else + sprintf(line, "-file_size_limit %.f %s\n", + (double) xorriso->file_size_limit, xorriso->list_delimiter); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->disk_excl_mode==1); + sprintf(line, "-not_mgt %s:%s:%s:%s\n", + (xorriso->disk_excl_mode&1 ? "on" : "off"), + (xorriso->disk_excl_mode&2 ? "param_on" : "param_off"), + (xorriso->disk_excl_mode&4 ? "subtree_on" : "subtree_off"), + (xorriso->disk_excl_mode&8 ? "ignore_on" : "ignore_off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->do_iso_rr_pattern==1); + sprintf(line,"-iso_rr_pattern %s\n", + (xorriso->do_iso_rr_pattern == 1 ? "on" : + (xorriso->do_iso_rr_pattern == 2 ? "ls" : "off"))); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->do_disk_pattern==2); + sprintf(line,"-disk_pattern %s\n", + (xorriso->do_disk_pattern == 1 ? "on" : + (xorriso->do_disk_pattern == 2 ? "ls" : "off"))); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= xorriso->volid_default; + sprintf(line,"-volid %s\n",Text_shellsafe(xorriso->volid,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + if(is_default && xorriso->loaded_volid[0] && + strcmp(xorriso->loaded_volid, xorriso->volid)!=0 && !no_defaults) { + sprintf(line,"# loaded image effective -volid %s\n", + Text_shellsafe(xorriso->loaded_volid,sfe,0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + Xorriso_preparer_string(xorriso, xorriso_id, 0); + is_default= (strcmp(xorriso->preparer_id, xorriso_id) == 0); + sprintf(line,"-preparer_id %s\n",Text_shellsafe(xorriso->preparer_id,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->publisher[0]==0); + sprintf(line,"-publisher %s\n",Text_shellsafe(xorriso->publisher,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->application_id[0]==0); + sprintf(line,"-application_id %s\n", + Text_shellsafe(xorriso->application_id,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->system_id[0]==0); + sprintf(line,"-system_id %s\n", Text_shellsafe(xorriso->system_id,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->volset_id[0]==0); + sprintf(line,"-volset_id %s\n", Text_shellsafe(xorriso->volset_id,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->vol_creation_time == 0); + sprintf(line,"-volume_date c %s\n", + is_default ? "default" : + Ftimetxt(xorriso->vol_creation_time, sfe, 2)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->vol_modification_time == 0); + sprintf(line,"-volume_date m %s\n", + xorriso->vol_uuid[0] ? "overridden" : + is_default ? "default" : + Ftimetxt(xorriso->vol_modification_time, sfe, 2)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->vol_expiration_time == 0); + sprintf(line,"-volume_date x %s\n", + is_default ? "default" : + Ftimetxt(xorriso->vol_expiration_time, sfe, 2)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->vol_effective_time == 0); + sprintf(line,"-volume_date f %s\n", + is_default ? "default" : + Ftimetxt(xorriso->vol_effective_time, sfe, 2)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->vol_uuid[0] == 0); + sprintf(line,"-volume_date uuid %s\n", + Text_shellsafe(xorriso->vol_uuid,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->copyright_file[0] == 0); + sprintf(line,"-copyright_file %s\n", + Text_shellsafe(xorriso->copyright_file,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->biblio_file[0]==0); + sprintf(line,"-biblio_file %s\n",Text_shellsafe(xorriso->biblio_file,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->abstract_file[0]==0); + sprintf(line,"-abstract_file %s\n", + Text_shellsafe(xorriso->abstract_file,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->do_joliet==0); + sprintf(line,"-joliet %s\n", (xorriso->do_joliet == 1 ? "on" : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + Xorriso_lst_get_last(xorriso->jigdo_params, &plst, 0); + Xorriso_lst_get_last(xorriso->jigdo_values, &vlst, 0); + if(plst == NULL || vlst == NULL) { + is_default= 1; + sprintf(line,"-jigdo clear 'all'\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + } + while(plst != NULL && vlst != NULL) { + sprintf(line,"-jigdo %s %s\n", Xorriso_lst_get_text(plst, 0), + Text_shellsafe(Xorriso_lst_get_text(vlst, 0), sfe, 0)); + Xorriso_status_result(xorriso, filter, fp, flag & 2); + plst= Xorriso_lst_get_prev(plst, 0); + vlst= Xorriso_lst_get_prev(vlst, 0); + } + + if(xorriso->do_global_uid) { + sprintf(line,"-uid %lu\n", (unsigned long) xorriso->global_uid); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + if(xorriso->do_global_gid) { + sprintf(line,"-gid %lu\n", (unsigned long) xorriso->global_gid); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + Xorriso_status_extf(xorriso, filter, fp, flag & 2); + Xorriso_status_zisofs(xorriso, filter, fp, flag & 3); + + is_default= !xorriso->allow_graft_points; + sprintf(line,"-pathspecs %s\n", xorriso->allow_graft_points ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->do_follow_pattern && (!xorriso->do_follow_param) + && xorriso->do_follow_mount && (!xorriso->do_follow_links) + && xorriso->follow_link_limit==100); + mode[0]= 0; + if(xorriso->do_follow_pattern && + !(xorriso->do_follow_links && xorriso->do_follow_mount)) + strcat(mode,":pattern"); + if(xorriso->do_follow_param && !(xorriso->do_follow_links)) + strcat(mode,":param"); + if(xorriso->do_follow_links) + strcat(mode,":link"); + if(xorriso->do_follow_mount) + strcat(mode,":mount"); + if(mode[0]==0) + strcpy(mode, ":off"); + sprintf(mode+strlen(mode), ":limit=%d", xorriso->follow_link_limit); + sprintf(line,"-follow %s\n", mode+1); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->do_overwrite==2); + sprintf(line,"-overwrite %s\n",(xorriso->do_overwrite == 1 ? "on" : + (xorriso->do_overwrite == 2 ? "nondir" : "off"))); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= !xorriso->do_reassure; + sprintf(line,"-reassure %s\n",(xorriso->do_reassure == 1 ? "on" : + (xorriso->do_reassure == 2 ? "tree" : "off"))); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= !xorriso->do_close; + sprintf(line,"-close %s\n",(xorriso->do_close ? "on" : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= !xorriso->do_dummy; + sprintf(line,"-dummy %s\n",(xorriso->do_dummy ? "on" : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->speed==0); + sprintf(line,"-speed %dkB/s\n", xorriso->speed); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->do_stream_recording==0); + strcpy(mode, "off"); + if(xorriso->do_stream_recording == 1) + strcpy(mode, "full"); + if(xorriso->do_stream_recording == 2) + strcpy(mode, "data"); + else if(xorriso->do_stream_recording == 32) + strcpy(mode, "on"); + else if(xorriso->do_stream_recording >= 16) + sprintf(mode, "%ds", xorriso->do_stream_recording); + sprintf(line,"-stream_recording %s\n", mode); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->dvd_obs == 0); + strcpy(mode, "default"); + if(xorriso->dvd_obs == 32768 || xorriso->dvd_obs == 65536) + sprintf(mode, "%dk", xorriso->dvd_obs / 1024); + sprintf(line,"-dvd_obs %s\n", mode); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->stdio_sync == 0); + strcpy(line, "-stdio_sync "); + if(xorriso->stdio_sync == -1) + strcat(line, "off"); + else if(xorriso->stdio_sync == 0) + strcat(line, "on"); + else if(xorriso->stdio_sync % 512) { + Sfile_off_t_text(line+strlen(line), (off_t) (xorriso->stdio_sync * 2048), + 0); + } else { + Sfile_off_t_text(line+strlen(line), (off_t) (xorriso->stdio_sync / 512), 0); + strcat(line, "m"); + } + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->fs==4*512); + if((xorriso->fs/512)*512==xorriso->fs) + sprintf(line,"-fs %dm\n", xorriso->fs/512); + else + sprintf(line,"-fs %dk\n", xorriso->fs*2); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->padding==300*1024); + sprintf(line,"-padding %dk\n", xorriso->padding/1024); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->do_padding_by_libisofs == 0); + sprintf(line,"-padding %s\n", + xorriso->do_padding_by_libisofs ? "included" : "appended"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (strcmp(xorriso->report_about_text,"UPDATE")==0); + sprintf(line,"-report_about %s\n",xorriso->report_about_text); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->scsi_log == 0); + sprintf(line,"-scsi_log %s\n", xorriso->scsi_log ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->session_logfile[0]==0); + sprintf(line,"-session_log %s\n", + Text_shellsafe(xorriso->session_logfile,sfe,0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->pacifier_style==0); + sprintf(line,"-pacifier '%s'\n", + xorriso->pacifier_style==1 ? "mkisofs" : + xorriso->pacifier_style==2 ? "cdrecord" : "xorriso"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (strcmp(xorriso->return_with_text,"SORRY")==0 && + xorriso->return_with_value==32); + sprintf(line,"-return_with %s %d\n", + xorriso->return_with_text, xorriso->return_with_value); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= 0; + sprintf(line,"-abort_on %s\n",xorriso->abort_on_text); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + if(xorriso->status_history_max!=Xorriso_status_history_maX || !no_defaults) { + sprintf(line,"-status_history_max %d\n",xorriso->status_history_max); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + +#ifdef Xorriso_with_readlinE + + if((flag&8) && xorriso->status_history_max>0) { + HIST_ENTRY **hl; + int hc,i; + + hl= history_list(); + if(hl!=NULL) { + for(hc= 0;hl[hc]!=NULL;hc++); + if(hc>0) + if(strcmp(hl[hc-1]->line,"-end")==0) + hc--; + if(hc>=xorriso->status_history_max) + i= hc-xorriso->status_history_max; + else + i= 0; + for(;i<hc;i++) { + sprintf(line,"-history %s\n",Text_shellsafe(hl[i]->line,sfe,0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + } + } + +#endif /* Xorriso_with_readlinE */ + + is_default= (xorriso->toc_emulation_flag == 0); + sprintf(line,"-rom_toc_scan %s%s\n", + xorriso->toc_emulation_flag & 4 ? "force" : + xorriso->toc_emulation_flag & 1 ? "on" : "off", + xorriso->toc_emulation_flag & 2 ? ":emul_off" : ""); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + + is_default= (xorriso->displacement == 0); + sprintf(line, "-displacement %s%lu\n", + xorriso->displacement_sign < 0 ? "-" : "", + (unsigned long) xorriso->displacement); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + + adr_mode= xorriso->image_start_mode & 0xffff; + if(adr_mode>=0 && adr_mode<=max_load_mode) { + is_default= (adr_mode==0); + sprintf(line,"-load %s ", load_names[adr_mode]); + if(adr_mode==0) + sprintf(line+strlen(line),"''\n"); + else if(adr_mode>=1 && adr_mode<=3) + sprintf(line+strlen(line),"%s\n", xorriso->image_start_value); + else + sprintf(line+strlen(line),"%s\n", + Text_shellsafe(xorriso->image_start_value, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + + is_default= (xorriso->do_calm_drive & 1); + sprintf(line,"-calm_drive %s\n", xorriso->do_calm_drive & 1 ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->grow_blindly_msc2<0); + sprintf(sfe, "%d", xorriso->grow_blindly_msc2); + sprintf(line,"-grow_blindly %s\n", + xorriso->grow_blindly_msc2 < 0 ? "off" : sfe); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + Xorriso_get_local_charset(xorriso, &local_charset, 0); + nl_charset= nl_langinfo(CODESET); + is_default= (strcmp(local_charset, nl_charset) == 0); + sprintf(line, "-local_charset %s\n", Text_shellsafe(local_charset, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + + is_default= (xorriso->out_charset == NULL && xorriso->in_charset == NULL); + in_pt= ""; + if(xorriso->in_charset != NULL) + in_pt= xorriso->in_charset; + out_pt= ""; + if(xorriso->out_charset != NULL) + out_pt= xorriso->out_charset; + do_single= 0; + ret= Xorriso_status_filter(xorriso, filter, "-in_charset", 0); + if(ret <= 0) + ret= Xorriso_status_filter(xorriso, filter, "-out_charset", 0); + if(ret > 0) + do_single= 1; + if(strcmp(in_pt, out_pt) == 0 && !do_single) { + sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + } else { + sprintf(line, "-in_charset %s\n", Text_shellsafe(in_pt, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + sprintf(line, "-out_charset %s\n", Text_shellsafe(out_pt, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso, filter, fp, flag & 2); + } + is_default= ((xorriso->do_aaip & (256 | 512)) == 0); + sprintf(line,"-auto_charset %s\n", (xorriso->do_aaip & 256 ? "on" : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= ((xorriso->ino_behavior & 31) == 7); + switch (xorriso->ino_behavior & 15) { + case 0: form= "on"; + break; case 8: form= "without_update"; + break; default: form= "off"; + } + sprintf(line,"-hardlinks %s:%s\n", form, + xorriso->ino_behavior & 16 ? + "cheap_sorted_extract" : "normal_extract"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= ((xorriso->do_aaip & (1 | 4)) == 0); + sprintf(line,"-acl %s\n", (xorriso->do_aaip & 1 ? "on" : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= ((xorriso->do_aaip & (2 | 8)) == 0); + sprintf(line,"-xattr %s\n", (xorriso->do_aaip & 4 ? "on" : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= ((xorriso->do_aaip & (16 | 32 | 64)) == 0); + sprintf(line,"-disk_dev_ino %s\n", + (xorriso->do_aaip & 16 ? (xorriso->do_aaip & 128 ? "ino_only" : "on" ) + : "off")); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= ((xorriso->do_md5 & 31) == 0); + sprintf(line, "-md5 "); + if(xorriso->do_md5 & 1) { + if((xorriso->do_md5 & 8) == 8) { + strcat(line, "all"); + } else { + strcat(line, "on"); + if(xorriso->do_md5 & 8) + strcat(line, ":stability_check_on"); + } + if(xorriso->do_md5 & 32) + strcat(line, ":load_check_off"); + strcat(line, "\n"); + } else + strcat(line, "off\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->scdbackup_tag_name[0] == 0 && + xorriso->scdbackup_tag_listname[0] == 0); + sprintf(line, "-scdbackup_tag "); + Text_shellsafe(xorriso->scdbackup_tag_listname, line, 1); + strcat(line, " "); + Text_shellsafe(xorriso->scdbackup_tag_name, line, 1); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (Xorriso_get_relax_text(xorriso, sfe, 0) == 2); + sprintf(line,"-compliance %s\n", sfe); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= (xorriso->assert_volid[0] == 0); + sprintf(line, "-assert_volid "); + Text_shellsafe(xorriso->assert_volid, line, 1); + strcat(line, " "); + Text_shellsafe(xorriso->assert_volid_sev, line, 1); + strcat(line, "\n"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= 1; + if(xorriso->drive_blacklist != NULL || xorriso->drive_whitelist != NULL || + xorriso->drive_greylist == NULL) + is_default= 0; + if(xorriso->drive_greylist != NULL) { + if(strcmp(Xorriso_get_pattern(xorriso, xorriso->drive_greylist, 0, 0), + "/dev") != 0) + is_default= 0; + if(Xorriso_get_pattern(xorriso, xorriso->drive_greylist, 1, 0) != NULL) + is_default= 0; + } + if(!(is_default && no_defaults)) { + for(s= xorriso->drive_blacklist; s != NULL; s= Xorriso_lst_get_next(s, 0)) { + sprintf(line, "-drive_class 'banned' %s\n", + Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + for(s= xorriso->drive_greylist; s != NULL; s= Xorriso_lst_get_next(s, 0)) { + sprintf(line, "-drive_class 'caution' %s\n", + Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + for(s= xorriso->drive_whitelist; s != NULL; s= Xorriso_lst_get_next(s, 0)) { + sprintf(line, "-drive_class 'harmless' %s\n", + Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + } + + do_single= 0; + dev_filter= filter; + if(dev_filter != NULL) { + show_dev= Xorriso_status_filter(xorriso, filter, "-dev", 0); + if(show_dev > 0) + dev_filter= NULL; + } + if(dev_filter != NULL) { + show_indev= Xorriso_status_filter(xorriso, filter, "-indev", 0); + show_outdev= Xorriso_status_filter(xorriso, filter, "-outdev", 0); + if(show_outdev > 0 || show_indev > 0) + do_single= 1; + } + if(xorriso->drives_exclusive != xorriso->indev_is_exclusive && + xorriso->indev[0]) + do_single= 1; + else if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive && + xorriso->outdev[0]) + do_single= 1; + if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) { + sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0)); + Xorriso_status_result(xorriso, dev_filter, fp, flag & 2); + } else { + if(xorriso->drives_exclusive != xorriso->indev_is_exclusive && + xorriso->indev[0] && show_indev) { + sprintf(line,"-osirrox o_excl_%s\n", + xorriso->indev_is_exclusive ? "on" : "off"); + Xorriso_status_result(xorriso, NULL, fp, flag & 2); + } + sprintf(line,"-indev %s\n", Text_shellsafe(xorriso->indev,sfe,0)); + Xorriso_status_result(xorriso, dev_filter, fp, flag & 2); + if(xorriso->drives_exclusive != xorriso->indev_is_exclusive && + xorriso->indev[0] && show_indev) { + sprintf(line,"-osirrox o_excl_%s\n", + xorriso->drives_exclusive ? "on" : "off"); + Xorriso_status_result(xorriso, NULL, fp, flag & 2); + } + + if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive && + xorriso->outdev[0] && show_outdev) { + sprintf(line,"-osirrox o_excl_%s\n", + xorriso->outdev_is_exclusive ? "on" : "off"); + Xorriso_status_result(xorriso, NULL, fp, flag & 2); + } + sprintf(line,"-outdev %s\n", Text_shellsafe(xorriso->outdev,sfe,0)); + Xorriso_status_result(xorriso, dev_filter, fp, flag & 2); + if(xorriso->drives_exclusive != xorriso->outdev_is_exclusive && + xorriso->outdev[0] && show_outdev) { + sprintf(line,"-osirrox o_excl_%s\n", + xorriso->drives_exclusive ? "on" : "off"); + Xorriso_status_result(xorriso, NULL, fp, flag & 2); + } + } + + ret= 1; +ex:; + Xorriso_free_meM(sfe); + Xorriso_free_meM(xorriso_id); + return(ret); +} + + +int Xorriso_pacifier_reset(struct XorrisO *xorriso, int flag) +{ + xorriso->start_time= Sfile_microtime(0); + xorriso->last_update_time= xorriso->start_time; + xorriso->pacifier_count= 0; + xorriso->pacifier_total= 0; + xorriso->pacifier_byte_count= 0; + return(1); +} + + +/* This call is to be issued by long running workers in short intervals. + It will check whether enough time has elapsed since the last pacifier + message and eventually issue an update message. + @param what_done A sparse description of the action, preferrably in past + tense. E.g. "done" , "files added". + @param count The number of objects processed so far. + Is ignored if <=0. + @param todo The number of objects to be done in total. + Is ignored if <=0. + @param current_object A string telling the object currently processed. + Ignored if "". + @param flag bit0= report unconditionally, no time check + bit1= report count <=0 (no thank you for being patient then) + bit2= report xorriso->pacifier_byte_count + bit6= report with carriage return rather than line feed +*/ +int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done, + off_t count, off_t todo, char *current_object, + int flag) +{ + double current_time, since; + char count_text[80], byte_text[80]; + + current_time= Sfile_microtime(0); + if(current_time - xorriso->last_update_time < xorriso->pacifier_interval + && !(flag&1)) + return(1); + xorriso->last_update_time= Sfile_microtime(0); + since= current_time - xorriso->start_time; + if((flag&1)&&since<1.0) + since= 1.0; + byte_text[0]= 0; + if(flag&4) { + strcat(byte_text, " ("); + Sfile_scale((double) xorriso->pacifier_byte_count, + byte_text+strlen(byte_text), 7, 1e5, 0); + strcat(byte_text, ")"); + } + if(count<=0.0 && !(flag&2)) { + if(since < 2) + return(2); + sprintf(xorriso->info_text, + "Thank you for being patient for %.f seconds", since); + } else if(todo<=0.0) { + if(count<10000000) + sprintf(count_text, "%.f", (double) count); + else + Sfile_scale((double) count, count_text, 7, 1e5, 1); + sprintf(xorriso->info_text, "%s %s%s in %.f %s", + count_text, what_done, byte_text, since, (flag&64) ? "s" : "seconds"); + } else { + sprintf(xorriso->info_text, "%.f of %.f %s%s in %.f seconds", + (double) count, (double) todo, what_done, byte_text, since); + } + if(current_object[0]!=0) + sprintf(xorriso->info_text+strlen(xorriso->info_text), + ", now at %s", current_object); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", (flag&64)); + return(1); +} + + +int Xorriso_reset_counters(struct XorrisO *xorriso, int flag) +{ + xorriso->error_count= 0; + xorriso->insert_count= 0; + xorriso->insert_bytes= 0; + Xorriso_pacifier_reset(xorriso, 0); + return(1); +} + + +int Xorriso_no_malloc_memory(struct XorrisO *xorriso, char **to_free, int flag) +{ + if(to_free!=NULL) + if(*to_free!=NULL) { + /* Eventual memory sacrifice to get on going */ + free(*to_free); + *to_free= NULL; + } + sprintf(xorriso->info_text, "Out of virtual memory"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "ABORT", 0); + return(1); +} + + +/* @param flag bit0=path is in source filesystem , bit1= unconditionally */ +int Xorriso_much_too_long(struct XorrisO *xorriso, int len, int flag) +{ + if(len>=SfileadrL || (flag&2)) { + sprintf(xorriso->info_text, + "Path given for %s is much too long (%d)", + ((flag&1) ? "local filesystem" : "ISO image"), len); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + return(1); +} + + +int Xorriso_no_findjob(struct XorrisO *xorriso, char *cmd, int flag) +{ + sprintf(xorriso->info_text, "%s: cannot create find job object", cmd); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + return(1); +} + + +int Xorriso_report_md5_outcome(struct XorrisO *xorriso, char *severity, + int flag) +{ + int has_md5; + + has_md5= Xorriso_image_has_md5(xorriso, 0); + if(xorriso->find_check_md5_result & 1) { + sprintf(xorriso->result_line, + "Mismatch detected between file contents and MD5 checksums.\n"); + } else if(xorriso->find_check_md5_result & 8) { + sprintf(xorriso->result_line, + "File contents and their MD5 checksums match.\n"); + } else { + sprintf(xorriso->result_line, + "Not a single file with MD5 checksum was found."); + if(has_md5 <= 0) + strcat(xorriso->result_line, + " (There is no MD5 checksum array loaded.)\n"); + else + strcat(xorriso->result_line, "\n"); + } + Xorriso_result(xorriso,0); + if(xorriso->find_check_md5_result & 2) { + sprintf(xorriso->result_line, + "Encountered errors other than non-match during MD5 checking.\n"); + Xorriso_result(xorriso,0); + } + if((xorriso->find_check_md5_result & 4) && has_md5) { + sprintf(xorriso->result_line, + "There were data files which have no MD5 and thus could not be checked.\n"); + Xorriso_result(xorriso,0); + } + if((xorriso->find_check_md5_result & 3) && strcmp(severity, "ALL") != 0) { + sprintf(xorriso->info_text, "Event triggered by MD5 comparison mismatch"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, severity, 0); + } + return(1); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/text_io.h b/libisoburn/branches/1.1.8/xorriso/text_io.h new file mode 100644 index 00000000..7544fac1 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/text_io.h @@ -0,0 +1,90 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of text i/o functions. +*/ + + +#ifndef Xorriso_pvt_textio_includeD +#define Xorriso_pvt_textio_includeD yes + + +int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize, + int flag); + +/** @return -1= abort , 0= no , 1= yes +*/ +int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will, + int flag); + +int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= quoted multiline mode + bit1= release allocated memory and return 1 + bit2= with bit0: warn of empty text arguments + bit3= deliver as single quoted text including all whitespace + and without any backslash interpretation + @return -1=out of memory , 0=line format error , 1=ok, go on , 2=done +*/ +int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, + int *argc, char ***argv, int flag); + +int Xorriso_write_to_channel(struct XorrisO *xorriso, + char *in_text, int channel_no, int flag); + +int Xorriso_result(struct XorrisO *xorriso, int flag); + +int Xorriso_restxt(struct XorrisO *xorriso, char *text); + +int Xorriso_info(struct XorrisO *xorriso, int flag); + +int Xorriso_mark(struct XorrisO *xorriso, int flag); + + +int Xorriso_write_session_log(struct XorrisO *xorriso, int flag); + + +int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag); + +int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag); + +int Xorriso_pacifier_reset(struct XorrisO *xorriso, int flag); + +/* This call is to be issued by long running workers in short intervals. + It will check whether enough time has elapsed since the last pacifier + message and eventually issue an update message. + @param what_done A sparse description of the action, preferrably in past + tense. E.g. "done" , "files added". + @param count The number of objects processed so far. + Is ignored if <=0. + @param todo The number of objects to be done in total. + Is ignored if <=0. + @param current_object A string telling the object currently processed. + Ignored if "". + @param flag bit0= report unconditionally, no time check +*/ +int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done, + off_t count, off_t todo, char *current_object, + int flag); + +int Xorriso_reset_counters(struct XorrisO *xorriso, int flag); + +int Xorriso_no_malloc_memory(struct XorrisO *xorriso, char **to_free, + int flag); + +int Xorriso_much_too_long(struct XorrisO *xorriso, int len, int flag); + +int Xorriso_no_findjob(struct XorrisO *xorriso, char *cmd, int flag); + +int Xorriso_report_md5_outcome(struct XorrisO *xorriso, char *severity, + int flag); + +int Xorriso_protect_stdout(struct XorrisO *xorriso, int flag); + +#endif /* ! Xorriso_pvt_textio_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/write_run.c b/libisoburn/branches/1.1.8/xorriso/write_run.c new file mode 100644 index 00000000..c0c03c4e --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/write_run.c @@ -0,0 +1,2550 @@ + + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains functions which are needed to write sessions. +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include <ctype.h> +#include <sys/types.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <time.h> +#include <errno.h> + +#include <fcntl.h> + +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif +#endif + +#ifdef Xorriso_standalonE + +#ifdef Xorriso_with_libjtE +#include "../libjte/libjte.h" +#endif + +#else + +#ifdef Xorriso_with_libjtE +#include <libjte/libjte.h> +#endif + +#endif /* ! Xorriso_standalonE */ + +#include "xorriso.h" +#include "xorriso_private.h" + +#include "lib_mgt.h" +#include "drive_mgt.h" +#include "iso_img.h" +#include "iso_tree.h" +#include "write_run.h" + + +/* @param flag bit0= talk of -as cdrecord -multi rather than of -close +*/ +int Xorriso_check_multi(struct XorrisO *xorriso, struct burn_drive *drive, + int flag) +{ + int profile_no= 0, ret; + struct burn_multi_caps *caps= NULL; + char profile_name[80]; + + if(!xorriso->do_close) { + burn_disc_get_profile(drive, &profile_no, profile_name); + if(profile_no == 0x14) { /* DVD-RW sequential */ + ret= burn_disc_get_multi_caps(drive, BURN_WRITE_TAO, &caps, 0); + if(caps != NULL) + burn_disc_free_multi_caps(&caps); + if(ret == 0) { + if(flag & 1) { + sprintf(xorriso->info_text, + "This DVD-RW media can only be written without option -multi"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Possibly it was blanked by blank=deformat_quickest"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + sprintf(xorriso->info_text, + "After writing a session without -multi, apply blank=all"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + } else { + sprintf(xorriso->info_text, + "This DVD-RW media can only be written with -close \"on\""); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Possibly it was blanked by -blank \"deformat_quickest\""); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + sprintf(xorriso->info_text, + "After writing a session with -close \"on\", apply -blank \"all\""); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + } + return(0); + } + } else if(profile_no == 0x15) { /* DVD-RW DL */ + if(flag & 1) + sprintf(xorriso->info_text, + "DVD-R DL media can only be written without option -multi"); + else + sprintf(xorriso->info_text, + "DVD-R DL media can only be written with -close \"on\""); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + return(1); +} + + +int Xorriso_make_write_options( + struct XorrisO *xorriso, struct burn_drive *drive, + struct burn_write_opts **burn_options, int flag) +{ + int drive_role, stream_mode= 0; + + *burn_options= burn_write_opts_new(drive); + if(*burn_options==NULL) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Cannot allocate option set"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + burn_write_opts_set_simulate(*burn_options, !!xorriso->do_dummy); + drive_role= burn_drive_get_drive_role(drive); + burn_write_opts_set_multi(*burn_options, + !(xorriso->do_close || drive_role==0 || drive_role==3)); + burn_drive_set_speed(drive, xorriso->speed, xorriso->speed); + if(xorriso->do_stream_recording == 1) + stream_mode= 1; + else if(xorriso->do_stream_recording == 2) + stream_mode= 51200; /* 100 MB */ + else if(xorriso->do_stream_recording >= 16) + stream_mode= xorriso->do_stream_recording; + burn_write_opts_set_stream_recording(*burn_options, stream_mode); + +#ifdef Xorriso_dvd_obs_default_64K + if(xorriso->dvd_obs == 0) + burn_write_opts_set_dvd_obs(*burn_options, 64 * 1024); + else +#endif + burn_write_opts_set_dvd_obs(*burn_options, xorriso->dvd_obs); + + burn_write_opts_set_stdio_fsync(*burn_options, xorriso->stdio_sync); + burn_write_opts_set_underrun_proof(*burn_options, 1); + return(1); +} + + +/* @param flag bit0= do not write but only prepare and return size in sectors + bit1= do not use isoburn wrappers, do not assume libisofs +*/ +int Xorriso_sanitize_image_size(struct XorrisO *xorriso, + struct burn_drive *drive, struct burn_disc *disc, + struct burn_write_opts *burn_options, int flag) +{ + int ret, img_sectors, num_sessions= 0, num_tracks= 0, padding= 0, profile; + int media_space, lba, nwa, multi_emul_blocks= 0; + char profile_name[80]; + struct burn_session **sessions; + struct burn_track **tracks; + enum burn_disc_status s; + + img_sectors= burn_disc_get_sectors(disc); + + sessions= burn_disc_get_sessions(disc, &num_sessions); + if(sessions==NULL || num_sessions < 1) { +no_track:; + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Program error : no track in prepared disc"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + {ret= -1; goto ex;} + } + tracks= burn_session_get_tracks(sessions[0], &num_tracks); + if(tracks==NULL || num_tracks < 1) + goto no_track; + + padding= 0; + ret= burn_disc_get_profile(drive, &profile, profile_name); + padding= xorriso->padding / 2048; + if(xorriso->padding > padding * 2048) + padding++; + if(img_sectors>0 && ret>0 && + (profile==0x09 || profile==0x0a)) { /* CD-R , CD-RW */ + if(img_sectors + padding < Xorriso_cd_min_track_sizE) { + padding= Xorriso_cd_min_track_sizE - img_sectors; + sprintf(xorriso->info_text, + "Expanded track to minimum size of %d sectors", + Xorriso_cd_min_track_sizE); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + } + if(xorriso->alignment == 0 && ! (xorriso->no_emul_toc & 1)) { + ret= isoburn_needs_emulation(drive); + if(ret > 0) { + /* Take care that the session is padded up to the future NWA. + Else with padding < 32 it could happen that PVDs from older + sessions survive and confuse -rom_toc_scan. + */ + xorriso->alignment= 32; + s= isoburn_disc_get_status(drive); + if(s == BURN_DISC_BLANK) { + /* Count blocks before nwa as part of the image */; + ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &lba, &nwa); + if(ret <= 0) + nwa= 0; + multi_emul_blocks= nwa; + } + } + } + + if(!(flag & 2)) { + +#ifdef Xorriso_with_libjtE + /* JTE : no multi-session, no_emul_toc, padding in libisofs */ + if(xorriso->libjte_handle != NULL) + padding= 0; +#endif /* ! Xorriso_with_libjtE */ + + if(xorriso->do_padding_by_libisofs) + padding= 0; + } + + if(xorriso->alignment > 0) { + if(img_sectors > 0) { + ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &lba, &nwa); + if(ret <= 0) + nwa= 0; + lba= (nwa + img_sectors + padding) % xorriso->alignment; + if(lba > 0) + padding+= xorriso->alignment - lba; + } + } + + burn_track_define_data(tracks[0], 0, padding * 2048, 0, BURN_MODE1); + Xorriso_process_msg_queues(xorriso,0); + + if(flag&2) + media_space= burn_disc_available_space(drive, burn_options) / + (off_t) 2048; + else + media_space= isoburn_disc_available_space(drive, burn_options) / + (off_t) 2048; + if(media_space < img_sectors + padding) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Image size %ds exceeds free space on media %ds", + img_sectors + padding, media_space); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(flag&1) { + ret= multi_emul_blocks + img_sectors + padding; + } else + ret= 1; +ex:; + return(ret); +} + + +int Xorriso_auto_format(struct XorrisO *xorriso, int flag) +{ + int ret, profile, status, num_formats; + char profile_name[80]; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + off_t size; + unsigned dummy; + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + return(0); + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to autoformat", 2); + if(ret<=0) + return(0); + ret= burn_disc_get_profile(drive, &profile, profile_name); + if(ret>0 && (profile==0x12 || profile==0x43)) { /* DVD-RAM or BD-RE */ + ret= burn_disc_get_formats(drive, &status, &size, &dummy, &num_formats); + if(ret>0 && status==BURN_FORMAT_IS_UNFORMATTED) { + sprintf(xorriso->info_text, + "Unformatted %s medium detected. Trying -format fast.", + profile_name); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + ret= Xorriso_format_media(xorriso, (off_t) 0, 1 | 4); + if(ret<=0) { + sprintf(xorriso->info_text, "Automatic formatting of %s failed", + profile_name); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(ret); + } + } + } + return(1); +} + + +int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive, + IsoImage *img, struct isoburn_imgen_opts *sopts, + int flag) +{ + int ret, options, system_area_options, iso_lba= -1, start_lba, image_blocks; + char volid[33]; + FILE *fp= NULL; + char *buf= NULL, *bufpt= NULL; + off_t hd_lba; + unsigned char *ub; + ElToritoBootImage *bootimg; + IsoFile *bootimg_node; + uint32_t offst; + enum burn_disc_status state; + + Xorriso_alloc_meM(buf, char, 32768); + system_area_options= xorriso->system_area_options; + memset(buf, 0, 32768); + if(xorriso->system_area_disk_path[0] == 0) { + if(xorriso->patch_system_area) { + ret= iso_image_get_system_area(img, buf, &options, 0); + if(ret == 0) { + goto do_set; + } else if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when inquiring System Area data of ISO 9660 image", + 0, "FAILURE", 1); + {ret= 0; goto ex;} + } else { + system_area_options= xorriso->patch_system_area; + /* Check whether partition 1 ends at image end */; + ub= (unsigned char *) buf; + hd_lba= (ub[454] | (ub[455] << 8) | (ub[456] << 16) | (ub[457] << 24)) + + (ub[458] | (ub[459] << 8) | (ub[460] << 16) | (ub[461] << 24)); + + iso_lba= -1; + ret= isoburn_disc_get_msc1(drive, &start_lba); + if(ret > 0) { + ret= isoburn_read_iso_head(drive, start_lba, &image_blocks, + volid, 1); + if(ret > 0) + iso_lba= start_lba + image_blocks; + } + if(((off_t) iso_lba) * (off_t) 4 > hd_lba) { + system_area_options= 0; + } else if((xorriso->patch_system_area & 1) && + ((off_t) iso_lba) * (off_t) 4 != hd_lba) { + system_area_options= 0; + } else if((xorriso->patch_system_area & 2) && + ((off_t) iso_lba) * (off_t) 4 + (off_t) (63 * 256) < hd_lba) { + system_area_options= 0; + } else if(xorriso->patch_system_area & 2) { /* isohybrid patching */ + /* Check whether bytes 432-345 point to ElTorito LBA */ + hd_lba= ub[432] | (ub[433] << 8) | (ub[434] << 16) | (ub[435] << 24); + ret= iso_image_get_boot_image(img, &bootimg, &bootimg_node, NULL); + if(ret != 1) + system_area_options= 0; + else if(bootimg_node != NULL) { + Xorriso__file_start_lba((IsoNode *) bootimg_node, &(iso_lba), 0); + if(((off_t) iso_lba) * (off_t) 4 != hd_lba) + system_area_options= 0; + } + } + if(system_area_options == 0) { + Xorriso_msgs_submit(xorriso, 0, + "Loaded System Area data are not suitable for MBR patching.", + 0, "DEBUG", 0); + } + } + bufpt= buf; + ret= 1; + } else + ret= 0; + goto do_set; + } + if(strcmp(xorriso->system_area_disk_path, "/dev/zero") == 0) + {ret= 1; goto do_set;} + + ret= Xorriso_afile_fopen(xorriso, xorriso->system_area_disk_path, + "rb", &fp, 2); + if(ret <= 0) + {ret= 0; goto ex;} + ret= fread(buf, 1, 32768, fp); + if(ret < 32768) { + if(ferror(fp)) { + sprintf(xorriso->info_text, + "Error when reading -boot_image system_area="); + Text_shellsafe(xorriso->system_area_disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + bufpt= buf; + +do_set:; + if(ret > 0 && xorriso->system_area_disk_path[0]) { + sprintf(xorriso->info_text, "Copying to System Area: %d bytes from file ", + ret); + Text_shellsafe(xorriso->system_area_disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + ret= isoburn_igopt_set_system_area(sopts, bufpt, system_area_options); + if(ret != ISO_SUCCESS) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when attaching System Area data to ISO 9660 image", + 0, "FAILURE", 1); + {ret= 0; goto ex;} + } + offst= xorriso->partition_offset; + state= isoburn_disc_get_status(drive); + if(state == BURN_DISC_APPENDABLE) { + ret= isoburn_get_img_partition_offset(drive, &offst); + if(ret == 1) { + sprintf(xorriso->info_text, + "Preserving in ISO image: -boot_image any partition_offset=%lu", + (unsigned long) offst); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } else + offst= xorriso->partition_offset; + } + ret= isoburn_igopt_set_part_offset(sopts, offst, + xorriso->partition_secs_per_head, + xorriso->partition_heads_per_cyl); + if(ret != ISO_SUCCESS) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when setting partition offset", 0, "FAILURE", 1); + {ret= 0; goto ex;} + } + ret= 1; +ex:; + if(fp != NULL && fp != stdin) + fclose(fp); + Xorriso_free_meM(buf); + return(ret); +} + + +/* @param flag bit0= do not increment boot_count + and do not reset boot parameters + bit1= dispose attached boot images +*/ +int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag) +{ + int ret; + char *cpt; + struct burn_drive_info *source_dinfo; + struct burn_drive *source_drive; + IsoImage *image= NULL; + IsoNode *node; + ElToritoBootImage *bootimg; + enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL; + char *bin_path; + int emul, platform_id; + off_t load_size; + struct stat stbuf; + int hflag= 0; + + if(xorriso->boot_image_bin_path[0] == 0 && !(flag & 2)) { + + /* >>> no boot image path given : no op */; + + ret= 2; goto ex; + } + + if(xorriso->in_drive_handle == NULL) + hflag= 2; + ret= Xorriso_get_drive_handles(xorriso, &source_dinfo, &source_drive, + "on attempt to attach boot image", hflag); + if(ret<=0) + goto ex; + image= isoburn_get_attached_image(source_drive); + if(image == NULL) { + /* (should not happen) */ + sprintf(xorriso->info_text, + "No ISO image present on attempt to attach boot image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(flag & 2) { + iso_image_remove_boot_image(image); + xorriso->boot_count= 0; + ret= 1; goto ex; + } + + bin_path= xorriso->boot_image_bin_path; + emul= xorriso->boot_image_emul; + platform_id= xorriso->boot_platform_id; + load_size= xorriso->boot_image_load_size; + + if(xorriso->boot_efi_default) { + emul= 0; + platform_id= 0xef; + xorriso->patch_isolinux_image= 0; + } + if(platform_id == 0xef || load_size < 0) { + ret= Xorriso_iso_lstat(xorriso, bin_path, &stbuf, 2 | 4); + if(ret != 0) + {ret= 0; goto ex;} + load_size= ((stbuf.st_size / (off_t) 512) + + !!(stbuf.st_size % (off_t) 512)) * 512; + } + sprintf(xorriso->info_text, "Adding boot image "); + Text_shellsafe(bin_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + if(emul == 0) + emul_type= ELTORITO_NO_EMUL; + else if(emul == 1) + emul_type= ELTORITO_HARD_DISC_EMUL; + else if(emul == 2) + emul_type= ELTORITO_FLOPPY_EMUL; + + ret= Xorriso_node_from_path(xorriso, image, bin_path, &node, 1); + if(ret <= 0) { + sprintf(xorriso->info_text, + "Cannot find in ISO image: -boot_image ... bin_path="); + Text_shellsafe(bin_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + if(xorriso->boot_count == 0) { + if(xorriso->boot_image_cat_path[0] == 0) { + strcpy(xorriso->boot_image_cat_path, bin_path); + cpt= strrchr(xorriso->boot_image_cat_path, '/'); + if(cpt == NULL) + cpt= xorriso->boot_image_cat_path; + else + cpt++; + strcpy(cpt, "boot.cat"); + } + ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_cat_path, + &node, 1); + if(ret > 0) { + if(!xorriso->do_overwrite) { + sprintf(xorriso->info_text, + "May not overwite existing -boot_image ... cat_path="); + Text_shellsafe(xorriso->boot_image_cat_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, xorriso->boot_image_cat_path, + 8 | (xorriso->do_overwrite == 1)); + if(ret != 1) { + sprintf(xorriso->info_text, + "Could not remove existing -boot_image cat_path="); + Text_shellsafe(xorriso->boot_image_cat_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + + /* Discard old boot image, set new one */ + ret= iso_image_get_boot_image(image, &bootimg, NULL, NULL); + if(ret == 1) + iso_image_remove_boot_image(image); + ret= iso_image_set_boot_image(image, bin_path, emul_type, + xorriso->boot_image_cat_path, &bootimg); + if(ret > 0) + iso_image_set_boot_catalog_weight(image, 1000000000); + } else { + ret= iso_image_add_boot_image(image, bin_path, emul_type, 0, &bootimg); + } + if(ret < 0) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when attaching El-Torito boot image to ISO 9660 image", + 0, "FAILURE", 1); + sprintf(xorriso->info_text, + "Could not attach El-Torito boot image to ISO 9660 image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + el_torito_set_boot_platform_id(bootimg, (uint8_t) platform_id); + el_torito_set_load_size(bootimg, load_size / 512); + el_torito_set_id_string(bootimg, xorriso->boot_id_string); + el_torito_set_selection_crit(bootimg, xorriso->boot_selection_crit); + ret= Xorriso_set_isolinux_options(xorriso, image, 1); + if(!(flag & 1)) { + /* Register attachment and reset even in case of error return */ + xorriso->boot_count++; + xorriso->boot_platform_id= 0; + xorriso->patch_isolinux_image= 0; + xorriso->boot_image_bin_path[0]= 0; + xorriso->boot_image_bin_form[0]= 0; + xorriso->boot_image_emul= 0; + xorriso->boot_image_load_size= 4 * 512; + memset(xorriso->boot_id_string, 0, sizeof(xorriso->boot_id_string)); + memset(xorriso->boot_selection_crit, 0, + sizeof(xorriso->boot_selection_crit)); + xorriso->boot_efi_default= 0; + } + if(ret <= 0) + goto ex; + + ret= 1; +ex:; + if(image != NULL) + iso_image_unref(image); + return(ret); +} + + +/* @param flag bit0= do not write but only prepare and return size in sectors +*/ +int Xorriso_write_session(struct XorrisO *xorriso, int flag) +{ + int ret, relax= 0, i, pacifier_speed= 0, data_lba, ext, is_bootable= 0; + int freshly_bootable= 0, hide_attr, pad_by_libisofs= 0, signal_mode; + char *xorriso_id= NULL, *img_id, *sfe= NULL, *out_cs, *part_image; + struct isoburn_imgen_opts *sopts= NULL; + struct burn_drive_info *dinfo, *source_dinfo; + struct burn_drive *drive, *source_drive; + struct burn_disc *disc= NULL; + struct burn_write_opts *burn_options; + off_t readcounter= 0,writecounter= 0; + int num_sessions= 0, num_tracks= 0; + struct burn_session **sessions; + struct burn_track **tracks; + enum burn_disc_status s; + IsoImage *image= NULL; + IsoNode *root_node; + int profile_number; + char *profile_name= NULL; + IsoBoot *bootcat_node; + uint32_t padding; + + Xorriso_alloc_meM(sfe, char, 5 * SfileadrL); + Xorriso_alloc_meM(xorriso_id, char, 256); + Xorriso_alloc_meM(profile_name, char, 80); + + ret= Xorriso_finish_hl_update(xorriso, 0); + if(ret <= 0) + goto ex; + + out_cs= xorriso->out_charset; + if(out_cs == NULL) + Xorriso_get_local_charset(xorriso, &out_cs, 0); + + if(!(flag & 1)) { + ret= Xorriso_auto_format(xorriso, 0); + if(ret <=0 ) + {ret= 0; goto ex;} + } + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to write", 2); + if(ret<=0) + goto ex; + + s= isoburn_disc_get_status(drive); + if(xorriso->out_drive_handle == xorriso->in_drive_handle) { + if(abs(xorriso->displacement_sign) == 1 && xorriso->displacement != 0 && + s != BURN_DISC_BLANK) { + sprintf(xorriso->info_text, + "May not grow ISO image while -displacement is non-zero"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + source_drive= drive; + } else { + if(xorriso->in_drive_handle == NULL) { + source_drive= drive; + } else { + ret= Xorriso_get_drive_handles(xorriso, &source_dinfo, &source_drive, + "on attempt to get source for write", 0); + if(ret<=0) + goto ex; + } + if(s!=BURN_DISC_BLANK) { + s= burn_disc_get_status(drive); + if(s!=BURN_DISC_BLANK) + sprintf(xorriso->info_text, + "-indev differs from -outdev and -outdev media is not blank"); + else + sprintf(xorriso->info_text, + "-indev differs from -outdev and -outdev media holds non-zero data"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2); + if(ret == 2) + pacifier_speed= 1; + else if(ret == 3) + pacifier_speed= 2; + + ret= Xorriso_check_multi(xorriso, drive, 0); + if(ret<=0) + goto ex; + + ret= isoburn_igopt_new(&sopts, 0); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso, 0); + goto ex; + } + relax= xorriso->relax_compliance; + + xorriso->alignment= 0; + image= isoburn_get_attached_image(source_drive); + if(image != NULL) { + iso_image_set_application_id(image, xorriso->application_id); + iso_image_set_publisher_id(image, xorriso->publisher); + iso_image_set_system_id(image, xorriso->system_id); + iso_image_set_volset_id(image, xorriso->volset_id); + iso_image_set_copyright_file_id(image, xorriso->copyright_file); + iso_image_set_biblio_file_id(image, xorriso->biblio_file); + iso_image_set_abstract_file_id(image, xorriso->abstract_file); + } + + if((xorriso->do_aaip & 256) && out_cs != NULL) { + static char *names = "isofs.cs"; + size_t value_lengths[1]; + + value_lengths[0]= strlen(out_cs); + ret= Xorriso_setfattr(xorriso, NULL, "/", + (size_t) 1, &names, value_lengths, &out_cs, 2 | 8); + if(ret<=0) + goto ex; + } + + ret= Xorriso_set_system_area(xorriso, source_drive, image, sopts, 0); + if(ret <= 0) + goto ex; + + /* Activate, adjust or discard boot image */ + if(image!=NULL && !(flag&1)) { + is_bootable= iso_image_get_boot_image(image, NULL, NULL, &bootcat_node); + if(xorriso->boot_image_bin_path[0]) { + ret= Xorriso_attach_boot_image(xorriso, xorriso->boot_count == 0); + if(ret <= 0) + goto ex; + freshly_bootable= 1; + } + if(xorriso->boot_count > 0) { + /* Eventually rename boot catalog node to changed boot_image_cat_path */ + if(is_bootable > 0) { + ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootcat_node, sfe, 0); + if(ret > 0) { + if(strcmp(sfe, xorriso->boot_image_cat_path) != 0) { + ret= Xorriso_rename(xorriso, NULL, sfe, + xorriso->boot_image_cat_path, 0); + if(ret <= 0) + goto ex; + } + } + } + hide_attr= !!(xorriso->boot_image_cat_hidden); + if(xorriso->boot_image_cat_hidden & 1) + hide_attr|= LIBISO_HIDE_ON_RR; + if(xorriso->boot_image_cat_hidden & 2) + hide_attr|= LIBISO_HIDE_ON_JOLIET; + iso_image_set_boot_catalog_hidden(image, hide_attr); + } else if(xorriso->patch_isolinux_image & 1) { + if(is_bootable == 1) { + relax|= isoburn_igopt_allow_full_ascii; + sprintf(xorriso->info_text, "Patching boot info table"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + + ret= Xorriso_path_from_lba(xorriso, NULL, xorriso->loaded_boot_bin_lba, + sfe, 1); + if(ret < 0) + goto ex; + if(ret == 0) { + sprintf(xorriso->info_text, + "Cannot patch boot image: no file found for its LBA."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Probably the loaded boot image file was deleted in this session."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Use -boot_image \"any\" \"discard\" or set new boot image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + goto ex; + } + ret= Xorriso_set_isolinux_options(xorriso, image, 0); + if(ret <= 0) + goto ex; + } else if(!freshly_bootable) { + sprintf(xorriso->info_text, + "Could not find any boot image for -boot_image patching"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); + } + } else if(xorriso->keep_boot_image && is_bootable == 1) { + relax|= isoburn_igopt_allow_full_ascii; + sprintf(xorriso->info_text, "Keeping boot image unchanged"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } else if(is_bootable == 1) { + iso_image_remove_boot_image(image); + sprintf(xorriso->info_text, "Discarded boot image from old session"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + } + + if((xorriso->do_aaip & 16) || !(xorriso->ino_behavior & 2)) { + /* Overwrite isofs.st of root node by xorriso->isofs_st_out */ + char *name= "isofs.st"; + char timestamp[16], *value= timestamp; + size_t value_length; + + sprintf(timestamp, "%.f", (double) xorriso->isofs_st_out); + value_length= strlen(timestamp); + Xorriso_setfattr(xorriso, NULL, "/", (size_t) 1, &name, + &value_length, &value, 2 | 8); + } + + isoburn_igopt_set_level(sopts, xorriso->iso_level); + ext= isoburn_igopt_rockridge | + ((!!xorriso->do_joliet) * isoburn_igopt_joliet) | + ((!!xorriso->do_iso1999) * isoburn_igopt_iso1999) | + (( !(xorriso->ino_behavior & 2)) * isoburn_igopt_hardlinks) | + (( (!(xorriso->ino_behavior & 2)) || + (xorriso->do_aaip & (2 | 8 | 16 | 256)) || + (xorriso->do_md5 & (2 | 4)) + ) * isoburn_igopt_aaip) | + ((!!(xorriso->do_md5 & 2)) * isoburn_igopt_session_md5) | + ((!!(xorriso->do_md5 & 4)) * isoburn_igopt_file_md5) | + ((!!(xorriso->do_md5 & 8)) * isoburn_igopt_file_stability) | + ((!!xorriso->do_old_empty) * isoburn_igopt_old_empty) | + ((flag & 1) * isoburn_igopt_will_cancel); + if(xorriso->no_emul_toc & 1) + ext|= isoburn_igopt_no_emul_toc; + isoburn_igopt_set_extensions(sopts, ext); + isoburn_igopt_set_relaxed(sopts, relax); + ret= isoburn_igopt_set_untranslated_name_len(sopts, + xorriso->untranslated_name_len); + if(ret <= 0) + {ret= 0; goto ex;} + isoburn_igopt_set_sort_files(sopts, 1); + isoburn_igopt_set_over_mode(sopts, 0, 0, (mode_t) 0, (mode_t) 0); + isoburn_igopt_set_over_ugid(sopts, 2 * !!xorriso->do_global_uid, + 2 * !!xorriso->do_global_gid, + (uid_t) xorriso->global_uid, + (gid_t) xorriso->global_gid); + isoburn_igopt_set_out_charset(sopts, out_cs); + isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048); + Ftimetxt(time(NULL), xorriso->scdbackup_tag_time, 8); + isoburn_igopt_set_scdbackup_tag(sopts, xorriso->scdbackup_tag_name, + xorriso->scdbackup_tag_time, + xorriso->scdbackup_tag_written); + for(i= 0; i < Xorriso_max_appended_partitionS; i++) { + if(xorriso->appended_partitions[i] == NULL) + continue; + if(xorriso->appended_partitions[i][0] == 0) + continue; + if(strcmp(xorriso->appended_partitions[i], ".") == 0) + part_image= ""; + else + part_image= xorriso->appended_partitions[i]; + isoburn_igopt_set_partition_img(sopts, i + 1, + xorriso->appended_part_types[i], part_image); + } + isoburn_igopt_set_disc_label(sopts, xorriso->ascii_disc_label); + + if(image!=NULL && 12+strlen(Xorriso_timestamP)<80) { + strcpy(xorriso_id, xorriso->preparer_id); + img_id= (char *) iso_image_get_data_preparer_id(image); + if(img_id!=NULL) { + for(i= strlen(img_id)-1; i>=0 && img_id[i]==' '; i--); + if(i>0) { + sprintf(xorriso->info_text, "Overwrote previous preparer id '%s'", + img_id); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + } + } + iso_image_set_data_preparer_id(image, xorriso_id); + } + isoburn_igopt_set_pvd_times(sopts, + xorriso->vol_creation_time, xorriso->vol_modification_time, + xorriso->vol_expiration_time, xorriso->vol_effective_time, + xorriso->vol_uuid); + +#ifdef Xorriso_with_libjtE + if(xorriso->libjte_handle && (xorriso->libjte_params_given & (4 | 8))) { + + /* >>> Check whether the mandatory parameters are set */; + + ret= libjte_set_outfile(xorriso->libjte_handle, xorriso->outdev); + Xorriso_process_msg_queues(xorriso, 0); + if(ret <= 0) + goto ex; + isoburn_igopt_attach_jte(sopts, xorriso->libjte_handle); + pad_by_libisofs= 1; + } +#endif /* Xorriso_with_libjtE */ + + if(xorriso->do_padding_by_libisofs || pad_by_libisofs) { + /* Padding to be done by libisofs, not by libburn. + */ + padding= xorriso->padding / 2048; + if((uint32_t) xorriso->padding > padding * 2048) + padding++; +/* +fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n", + (int) padding); +*/ + isoburn_igopt_set_tail_blocks(sopts, padding); + } + + /* Make final abort check before starting expensive activities */ + ret= Xorriso_eval_problem_status(xorriso, 1, 0); + if(ret<0) + {ret= 0; goto ex;} + + if(xorriso->zisofs_by_magic) { + sprintf(xorriso->info_text, + "Checking disk file content for zisofs compression headers."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + root_node= (IsoNode *) iso_image_get_root(image); + ret= iso_node_zf_by_magic(root_node, + (xorriso->out_drive_handle == xorriso->in_drive_handle) | 2 | 16); + if(ret<0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when examining file content for zisofs headers", + 0, "FAILURE", 1); + } + ret= Xorriso_eval_problem_status(xorriso, 1, 0); + if(ret<0) + {ret= 0; goto ex;} + sprintf(xorriso->info_text, + "Check for zisofs compression headers done."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + } + + /* >>> omit iso_image_update_sizes if the image was filled up very quickly */; + + ret= iso_image_update_sizes(image); + if(ret < 0) { + Xorriso_process_msg_queues(xorriso, 0); + if(ret<0) { + Xorriso_report_iso_error(xorriso, "", ret, + "Error when updating file sizes", + 0, "FAILURE", 1); + } + ret= Xorriso_eval_problem_status(xorriso, 1, 0); + if(ret<0) + {ret= 0; goto ex;} + } + + Xorriso_set_abort_severity(xorriso, 1); + if (xorriso->grow_blindly_msc2 >= 0 && + xorriso->out_drive_handle != xorriso->in_drive_handle) { + ret= isoburn_prepare_blind_grow(source_drive, &disc, sopts, drive, + xorriso->grow_blindly_msc2); + if(ret>0) { + /* Allow the consumer of output to access the input drive */ + source_drive= NULL; + ret= Xorriso_give_up_drive(xorriso, 1|8); + if(ret<=0) + goto ex; + } + } else if(xorriso->out_drive_handle == xorriso->in_drive_handle || + xorriso->in_drive_handle == NULL) { + ret= isoburn_prepare_disc(source_drive, &disc, sopts); + } else { + ret= isoburn_prepare_new_image(source_drive, &disc, sopts, drive); + } + if(ret <= 0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Failed to prepare session write run"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); + if(ret<=0) + goto cancel_iso; + isoburn_igopt_get_effective_lba(sopts, &(xorriso->session_lba)); + if(xorriso->do_stream_recording == 2) { + ret= isoburn_igopt_get_data_start(sopts, &data_lba); + if(ret > 0 && data_lba >= 16) + burn_write_opts_set_stream_recording(burn_options, data_lba); + } + + ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, flag&1); + if(ret<=0 || (flag&1)) { + Xorriso_process_msg_queues(xorriso,0); + if(flag&1) /* set queue severity to FAILURE */ + Xorriso_set_image_severities(xorriso, 2); + if(flag&1) /* reset queue severity */ + Xorriso_set_image_severities(xorriso, 0); + goto cancel_iso; + } + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + goto cancel_iso; + + /* Important: do not return until burn_is_aborting() was checked */ + + signal_mode= 1; + ret= burn_drive_get_drive_role(drive); + if(ret == 1) + signal_mode|= 2; + Xorriso_set_signal_handling(xorriso, signal_mode); + + /* De-activate eventual target file truncation in dummy mode */ + ret= isoburn_set_truncate(drive, (!xorriso->do_dummy) | 2 | 4); + if(ret < 0) + goto cancel_iso; + + xorriso->run_state= 1; /* Indicate that burning has started */ + isoburn_disc_write(burn_options, disc); + burn_write_opts_free(burn_options); + + ret= Xorriso_pacifier_loop(xorriso, drive, pacifier_speed << 4); + if(burn_is_aborting(0)) + Xorriso_abort(xorriso, 0); /* Never comes back */ + Xorriso_set_signal_handling(xorriso, 0); + if(ret<=0) + goto ex; + if(!isoburn_drive_wrote_well(drive)) { + isoburn_cancel_prepared_write(source_drive, drive, 0); + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "libburn indicates failure with writing."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + Xorriso_process_msg_queues(xorriso,0); + + sessions= burn_disc_get_sessions(disc, &num_sessions); + if(num_sessions>0) { + tracks= burn_session_get_tracks(sessions[0], &num_tracks); + if(tracks!=NULL && num_tracks>0) { + burn_track_get_counters(tracks[0],&readcounter,&writecounter); + xorriso->session_blocks= (int) (writecounter/ (off_t) 2048); + sprintf(xorriso->info_text, + "ISO image produced: %d sectors\nWritten to medium : %d sectors at LBA %d\n", + (int) (readcounter/ (off_t) 2048), + xorriso->session_blocks, xorriso->session_lba); + Xorriso_info(xorriso, 0); + } + } + ret= isoburn_activate_session(drive); + Xorriso_process_msg_queues(xorriso,0); + if(ret<=0) { + sprintf(xorriso->info_text, + "Could not write new set of volume descriptors"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + goto ex; + } + /* Done early to free any reference to the libisofs resources via disc */ + if(disc!=NULL) + burn_disc_free(disc); + disc= NULL; + /* To wait for the end of the libisofs threads and their messages. */ + isoburn_sync_after_write(source_drive, drive, 0); + Xorriso_process_msg_queues(xorriso,0); + + sprintf(xorriso->info_text, "Writing to %s completed successfully.\n\n", + Text_shellsafe(xorriso->outdev,sfe,0)); + Xorriso_info(xorriso, 0); + ret= 1; +ex:; + xorriso->run_state= 0; /* Indicate that burning has ended */ + Xorriso_set_abort_severity(xorriso, 0); + + if(ret<=0) { + + /* >>> ??? revive discarded boot image */; + + } + if(disc!=NULL) + burn_disc_free(disc); + if(image != NULL) + iso_image_unref(image); + isoburn_igopt_destroy(&sopts, 0); + Xorriso_process_msg_queues(xorriso,0); + Xorriso_append_scdbackup_record(xorriso, 0); + Xorriso_free_meM(sfe); + Xorriso_free_meM(xorriso_id); + Xorriso_free_meM(profile_name); + return(ret); + +cancel_iso:; + isoburn_cancel_prepared_write(source_drive, drive, 0); + goto ex; +} + + +int Xorriso_check_burn_abort(struct XorrisO *xorriso, int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + + if(burn_is_aborting(0)) + return(2); + if(xorriso->run_state!=1) + return(0); + ret= Xorriso_eval_problem_status(xorriso, 1, 1); + if(ret>=0) + return(0); + sprintf(xorriso->info_text, + "-abort_on '%s' encountered '%s' during image writing", + xorriso->abort_on_text, xorriso->problem_status_text); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + xorriso->problem_status_text, 0); + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to abort burn run", 2); + if(ret<=0) + return(0); + + burn_drive_cancel(drive); + sprintf(xorriso->info_text, + "libburn has now been urged to cancel its operation"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); +} + + +/* This loop watches burn runs until they end. + It issues pacifying update messages to the user. + @param flag bit0-3 = emulation mode + 0= xorriso + 1= mkisofs + 2= cdrecord + bit4= report speed in CD units + bit5= report speed in BD units +*/ +int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, + int flag) +{ + int ret, size, free_bytes, i, aborting= 0, emul, buffer_fill= 50, last_sector; + int iso_wait_counter= 0, iso_cancel_limit= 5; + struct burn_progress progress; + char *status_text, date_text[80], *speed_unit, mem_text[8]; + enum burn_drive_status drive_status; + double start_time, current_time, last_time, base_time= 0.0, base_count= 0.0; + double next_base_time= 0.0, next_base_count= 0.0, first_base_time= 0.0; + double first_base_count= 0.0, norm= 0.0, now_time, fract_offset= 0.0; + double measured_speed, speed_factor= 1385000, quot; + time_t time_prediction; + IsoImage *image= NULL; + + image= isoburn_get_attached_image(drive); + + start_time= Sfile_microtime(0); + while(burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) + usleep(100002); + + emul= flag&15; + fract_offset= 0.2 * (double) emul - ((int) (0.2 * (double) emul)); + if(emul==0) + emul= xorriso->pacifier_style; + speed_unit= "D"; + if(flag&16) { + speed_factor= 150.0*1024; + speed_unit= "C"; + } else if(flag & 32) { + speed_factor= 4495625; + speed_unit= "B"; + } + progress.sector= 0; + current_time= Sfile_microtime(0); + measured_speed= 0.0; + while(1) { + last_time= current_time; + last_sector= progress.sector; + drive_status= burn_drive_get_status(drive, &progress); + + if(drive_status == BURN_DRIVE_IDLE) { + /* To avoid a race condition between burn_source and libisofs + writer thread: Wait for ISO generator thread to have finished. + After some seconds kick it by isoburn_cancel_prepared_write() + which waits for the write thread to end. + */ + if(image == NULL) + break; + if(!iso_image_generator_is_running(image)) + break; + iso_wait_counter++; + if(iso_wait_counter > iso_cancel_limit) { + isoburn_cancel_prepared_write(drive, NULL, 0); + break; + } + } + current_time= Sfile_microtime(0); + if(drive_status == BURN_DRIVE_WRITING && progress.sectors > 0) { + if(current_time-last_time>0.2) + measured_speed= (progress.sector - last_sector) * 2048.0 / + (current_time - last_time); + buffer_fill= 50; + if(progress.buffer_capacity>0) + buffer_fill= (double) (progress.buffer_capacity + - progress.buffer_available) * 100.0 + / (double) progress.buffer_capacity; + if(emul==2) { + if(progress.sector<=progress.sectors) + sprintf(xorriso->info_text, "%4d of %4d MB written", + progress.sector / 512, progress.sectors / 512); + else + sprintf(xorriso->info_text, "%4d MB written", + progress.sector / 512); + + if(xorriso->pacifier_fifo!=NULL) + ret= burn_fifo_inquire_status(xorriso->pacifier_fifo, + &size, &free_bytes, &status_text); + else + ret= isoburn_get_fifo_status(drive, &size, &free_bytes, &status_text); + if(ret>0 ) + sprintf(xorriso->info_text+strlen(xorriso->info_text), + " (fifo %2d%%)", + (int) (100.0-100.0*((double) free_bytes)/(double) size)); + + sprintf(xorriso->info_text+strlen(xorriso->info_text), " [buf %3d%%]", + buffer_fill); + + if(current_time-last_time>0.2) + sprintf(xorriso->info_text+strlen(xorriso->info_text), " %4.1fx.", + measured_speed/speed_factor); + + } else if(emul == 1 && + progress.sectors > 0 && progress.sector <= progress.sectors) { + /* "37.87% done, estimate finish Tue Jul 15 18:55:07 2008" */ + + quot= ((double) progress.sector) / ((double) progress.sectors); + sprintf(xorriso->info_text, " %2.2f%% done", quot*100.0); + if(current_time - start_time >= 2 && quot > 0.0 && + (quot >= 0.02 || progress.sector >= 5*1024)) { + if(base_time == 0.0 && progress.sector >= 16*1024) { + first_base_time= base_time= next_base_time= current_time; + first_base_count= next_base_count= progress.sector; + } else if(next_base_time > 0 && current_time - next_base_time >= 10) { + base_time= next_base_time; + base_count= next_base_count; + next_base_time= current_time; + next_base_count= progress.sector; + } + if(first_base_time > 0 && + current_time - first_base_time >= 10 && + progress.sectors > first_base_count && + progress.sector > first_base_count) { + norm= (1.0 - quot); + if(norm < 0.0001) + norm= 0.0001; + quot= ((double) progress.sector - first_base_count) + / ((double) progress.sectors - first_base_count); + time_prediction= norm * (1.0 - quot) / quot + * (current_time - first_base_time); + } else { + time_prediction= (1.0 - quot) / quot * (current_time - start_time); + norm= 1.0; + } + if(base_time > 0 && + current_time - base_time >= 10 && progress.sectors > base_count) { + quot= ((double) progress.sector - base_count) + / ((double) progress.sectors - base_count); + time_prediction+= (1.0 - quot) / quot * (current_time - base_time); + norm+= 1.0; + } + time_prediction/= norm; + if(time_prediction < 30*86400 && time_prediction > 0) { + time_prediction+= current_time + 1; + Ftimetxt(time_prediction, date_text, 4); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + ", estimate finish %s", date_text); + } + } + } else { + if(progress.sector<=progress.sectors) { + if(progress.sectors <= 0) + strcpy(mem_text, " 99.9"); + else + sprintf(mem_text, "%5.1f", + 100.0 * ((double) progress.sector) / ((double) progress.sectors)); + mem_text[5]= 0; + sprintf(xorriso->info_text, "Writing: %10ds %s%% ", + progress.sector, mem_text); + } else { + Sfile_scale(2048.0 * (double) progress.sector, mem_text, 5, 1e4, 1); + sprintf(xorriso->info_text, "Writing: %10ds %s ", + progress.sector, mem_text); + } + ret= isoburn_get_fifo_status(drive, &size, &free_bytes, &status_text); + if(ret>0 ) + sprintf(xorriso->info_text+strlen(xorriso->info_text), + " fifo %3d%% buf %3d%%", + (int) (100.0-100.0*((double) free_bytes)/(double) size), + buffer_fill); + if(current_time-last_time>0.2) + sprintf(xorriso->info_text+strlen(xorriso->info_text), " %5.1fx%s ", + measured_speed/speed_factor, speed_unit); + } + } else if(drive_status == BURN_DRIVE_CLOSING_SESSION || + drive_status == BURN_DRIVE_CLOSING_TRACK) + sprintf(xorriso->info_text, + "Closing track/session. Working since %.f seconds", + current_time-start_time); + else if(drive_status == BURN_DRIVE_FORMATTING) + sprintf(xorriso->info_text, "Formatting. Working since %.f seconds", + current_time-start_time); + else + sprintf(xorriso->info_text, + "Thank you for being patient. Working since %.f seconds.", + current_time-start_time); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + + for(i= 0; i<12; i++) { /* 2 usleeps more than supposed to be needed */ + Xorriso_process_msg_queues(xorriso, 0); + if(aborting<=0) + aborting= Xorriso_check_burn_abort(xorriso, 0); + usleep(100000); + now_time= Sfile_microtime(0); + if(((time_t) now_time) - ((time_t) current_time) >= 1 && + now_time - ((time_t) now_time) >= fract_offset) + break; + } + } + iso_image_unref(image); + return(1); +} + + +/* @param flag bit0= fast + bit1= deformat + bit2= do not re-aquire drive + @return 0=failure, did not touch medium , -1=failure, altered medium + 1=success, altered medium , 2=success, did not touch medium +*/ +int Xorriso_blank_media(struct XorrisO *xorriso, int flag) +{ + int ret, do_deformat= 0, signal_mode; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + enum burn_disc_status disc_state; + struct burn_progress p; + double percent = 1.0; + int current_profile; + char current_profile_name[80]; + time_t start_time; + char mode_names[4][80]= {"all", "fast", "deformat", "deformat_quickest"}; + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + return(0); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to -blank", 2); + if(ret<=0) + return(0); + + burn_disc_get_profile(drive, ¤t_profile, current_profile_name); + + disc_state = isoburn_disc_get_status(drive); + if(current_profile == 0x13) { /* overwriteable DVD-RW */ + /* Depending on flag bit1 formatted DVD-RW will get blanked to sequential + state or pseudo blanked by invalidating an eventual ISO image. */ + if(flag&2) + do_deformat= 1; + } else if(current_profile == 0x14) { /* sequential DVD-RW */ + if((flag&1) && !(flag&2)) { + sprintf(xorriso->info_text, + "-blank: DVD-RW present. Mode 'fast' defaulted to mode 'all'."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + sprintf(xorriso->info_text, + "Mode 'deformat_quickest' produces single-session-only media."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + flag&= ~1; + } + } + if(disc_state == BURN_DISC_BLANK) { + if(!do_deformat) { + sprintf(xorriso->info_text, + "Blank medium detected. Will leave it untouched"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return 2; + } + } else if(disc_state==BURN_DISC_FULL || disc_state==BURN_DISC_APPENDABLE) { + ; + } else if(disc_state == BURN_DISC_EMPTY) { + sprintf(xorriso->info_text,"No media detected in drive"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return 0; + } else { + sprintf(xorriso->info_text, "Unsuitable drive and media state"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return 0; + } + if(!isoburn_disc_erasable(drive)) { + sprintf(xorriso->info_text, "Media is not of erasable type"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return 0; + } + if(xorriso->do_dummy) { + sprintf(xorriso->info_text, + "-dummy mode prevents blanking of medium in mode '%s'.", + mode_names[flag&3]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); + } + sprintf(xorriso->info_text, "Beginning to blank medium in mode '%s'.\n", + mode_names[flag&3]); + Xorriso_info(xorriso,0); + + /* Important: do not return until burn_is_aborting() was checked */ + signal_mode= 1; + ret= burn_drive_get_drive_role(drive); + if(ret == 1) + signal_mode|= 2; + Xorriso_set_signal_handling(xorriso, signal_mode); + + if(do_deformat) + burn_disc_erase(drive, (flag&1)); + else + isoburn_disc_erase(drive, (flag&1)); + start_time= time(0); + usleep(1000000); + while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { + Xorriso_process_msg_queues(xorriso,0); + if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */ + percent = 1.0 + ((double) p.sector+1.0) / ((double) p.sectors) * 98.0; + sprintf(xorriso->info_text, "Blanking ( %.1f%% done in %d seconds )", + percent, (int) (time(0) - start_time)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + usleep(1000000); + } + Xorriso_process_msg_queues(xorriso,0); + if(burn_is_aborting(0)) + Xorriso_abort(xorriso, 0); /* Never comes back */ + Xorriso_set_signal_handling(xorriso, 0); + if(burn_drive_wrote_well(drive)) { + sprintf(xorriso->info_text, "Blanking done\n"); + Xorriso_info(xorriso,0); + } else { + sprintf(xorriso->info_text, "Blanking failed."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + if(!(flag & 4)) { + ret= Xorriso_reaquire_outdev(xorriso, + 2 + (xorriso->in_drive_handle == xorriso->out_drive_handle)); + if(ret <= 0) + return(-1); + } + return(1); +} + + +/* @param flag bit0= try to achieve faster formatting + bit1= use parameter size (else use default size) + bit2= do not re-aquire drive + bit7= by_index mode: + bit8 to bit15 contain the index of the format to use. + @return 0=failure, did not touch medium , -1=failure, altered medium + 1=success, altered medium , 2=success, did not touch medium +*/ +int Xorriso_format_media(struct XorrisO *xorriso, off_t in_size, int flag) +{ + int ret, mode_flag= 0, index, status, num_formats, signal_mode; + unsigned dummy; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_progress p; + double percent = 1.0; + int current_profile; + char current_profile_name[80]; + off_t size= 0; + time_t start_time; + enum burn_disc_status disc_state; + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + return(0); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to -format", 2); + if(ret<=0) + return(0); + + if(flag & 2) { + mode_flag= 0; /* format to given size */ + } else { + mode_flag= 4; /* format to full size */ + } + burn_disc_get_profile(drive, ¤t_profile, current_profile_name); + + if(flag&128) { /* by_index */ + index= (flag>>8) & 0xff; + ret= burn_disc_get_formats(drive, &status, &size, &dummy, &num_formats); + if(ret<=0) + num_formats= 0; + if(ret<=0 || index<0 || index>=num_formats) { + if(num_formats>0) + sprintf(xorriso->info_text, + "-format by_index_%d: format descriptors range from index 0 to %d", + index, num_formats-1); + else + sprintf(xorriso->info_text, + "-format by_index_%d: no format descriptors available", index); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + mode_flag|= (flag & 0xff80); + if(flag&1) + mode_flag|= (1<<6); + + } else if(current_profile == 0x12) { /* DVD+RAM */ + if(!(flag & 2)) + mode_flag= 6; /* format to default payload size */ + if(flag&1) + mode_flag|= (1<<6); + + } else if(current_profile == 0x13) { /* DVD-RW */ + if(flag&1) { + sprintf(xorriso->info_text, + "Detected formatted DVD-RW. Thus omitting desired fast format run."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(2); + } + + } else if(current_profile == 0x14) { /* DVD-RW sequential */ + if(flag & 1) { + size= 128*1024*1024; + mode_flag= 1; /* format to size, then write size of zeros */ + } else + mode_flag= 4; + + } else if(current_profile == 0x1a) { /* DVD+RW */ + if(flag&1) { + sprintf(xorriso->info_text, + "Detected DVD+RW. Thus omitting desired fast format run."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(2); + } + + } else if(current_profile == 0x41) { /* BD-R SRM */ + if(!(flag & 2)) + mode_flag= 6; /* format to default payload size */ + if(flag&1) + mode_flag|= (1<<6); + + } else if(current_profile == 0x43) { /* BD-RE */ + if(!(flag & 2)) + mode_flag= 6; /* format to default payload size */ + if(flag&1) + mode_flag|= (1<<6); + + } else { + sprintf(xorriso->info_text, + "-format: Unsuitable media detected."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text,"Media current: %s (%4.4xh)", + current_profile_name, current_profile); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(0); + } + if(!(flag & 1)) + mode_flag|= 16; /* enable re-formatting */ + + if(xorriso->do_dummy) { + sprintf(xorriso->info_text, "-dummy mode prevents formatting of medium."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(1); + } + sprintf(xorriso->info_text, "Beginning to format medium.\n"); + Xorriso_info(xorriso, 0); + if(flag & 2) + size= in_size; + + /* Important: do not return until burn_is_aborting() was checked */ + signal_mode= 1; + ret= burn_drive_get_drive_role(drive); + if(ret == 1) + signal_mode|= 2; + Xorriso_set_signal_handling(xorriso, signal_mode); + + burn_disc_format(drive, size, mode_flag); + + start_time= time(0); + usleep(1000000); + while (burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { + Xorriso_process_msg_queues(xorriso,0); + if(p.sectors>0 && p.sector>=0) /* display 1 to 99 percent */ + percent = 1.0 + ((double) p.sector+1.0) / ((double) p.sectors) * 98.0; + sprintf(xorriso->info_text, "Formatting ( %.1f%% done in %d seconds )", + percent, (int) (time(0) - start_time)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + usleep(1000000); + } + Xorriso_process_msg_queues(xorriso,0); + if(burn_is_aborting(0)) + Xorriso_abort(xorriso, 0); /* Never comes back */ + Xorriso_set_signal_handling(xorriso, 0); + + if(burn_drive_wrote_well(drive)) { + sprintf(xorriso->info_text, "Formatting done\n"); + Xorriso_info(xorriso,0); + } else { + sprintf(xorriso->info_text, + "libburn indicates failure with formatting."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(-1); + } + + if(!(flag & 4)) { + ret= Xorriso_reaquire_outdev(xorriso, + 2 + (xorriso->in_drive_handle == xorriso->out_drive_handle)); + if(ret <= 0) + return(-1); + } + disc_state = isoburn_disc_get_status(drive); + if(disc_state==BURN_DISC_FULL && !(flag&1)) { + /* Blank because full format certification pattern might be non-zero */ + ret= Xorriso_blank_media(xorriso, 1); + if(ret <= 0) + return(0); + } + return(1); +} + + +/* @param flag bit2= formatting rather than blanking + @return 0=failure, did not touch medium , -1=failure, altered medium + 1=success, altered medium , 2=success, did not touch medium +*/ +int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag) +{ + int ret, is_formatted= -1, status, num_formats, did_work= 0; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + enum burn_disc_status disc_state; + unsigned dummy; + int current_profile; + char current_profile_name[80]; + off_t size; + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + return(0); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to blank or format", 2); + if(ret<=0) + return(0); + + burn_disc_get_profile(drive, ¤t_profile, current_profile_name); + + ret= burn_disc_get_formats(drive, &status, &size, &dummy, &num_formats); + if(ret>0) { + if(status==BURN_FORMAT_IS_FORMATTED) + is_formatted= 1; + else if(status == BURN_FORMAT_IS_UNFORMATTED) + is_formatted= 0; + } + if(current_profile == 0x12 || current_profile == 0x43) { /* DVD+RAM , BD-RE */ + if(is_formatted<0) { + sprintf(xorriso->info_text, + "-blank or -format: Unclear formatting status of %s", + current_profile_name); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + if(!is_formatted) { + ret= Xorriso_format_media(xorriso, (off_t) 0, (current_profile == 0x43)); + if(ret <= 0) + return(ret); + did_work= (ret == 1); + } + } else if(current_profile == 0x14 && (flag&4)) { /* DVD-RW sequential */ + ret= Xorriso_format_media(xorriso, (off_t) 0, 0); + if(ret <= 0) + return(ret); + did_work= (ret == 1); + } else if(current_profile == 0x41) { /* BD-R SRM */ + if(!is_formatted) { + ret= Xorriso_format_media(xorriso, (off_t) 0, 1); + if(ret <= 0) + return(ret); + did_work= (ret == 1); + } + } + + disc_state = isoburn_disc_get_status(drive); + if(disc_state != BURN_DISC_BLANK && !(flag&4)) { + ret= Xorriso_blank_media(xorriso, 1); + return(ret); + } + if(did_work) + return(1); + sprintf(xorriso->info_text, "%s as_needed: no need for action detected", + (flag&4) ? "-format" : "-blank"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + return(2); +} + + +/* @param write_start_address is valid if >=0 + @param tsize is valid if >0 + @param flag bit0= grow_overwriteable_iso + bit1= do_isosize + bit2= do_xa1 conversion +*/ +int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, + char *track_source, off_t tsize, int flag) +{ + int ret, fd, profile_number, is_cd= 0, dummy, nwa= -1; + int isosize= -1, do_isosize, is_bd= 0, signal_mode; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_write_opts *burn_options= NULL; + struct burn_disc *disc= NULL; + struct burn_session *session= NULL; + struct burn_track *track= NULL; + struct stat stbuf; + off_t fixed_size= 0; + struct burn_source *data_src= NULL, *fifo_src= NULL; + enum burn_disc_status disc_state; + char *reasons= NULL, *profile_name= NULL; + char *head_buffer= NULL; + + Xorriso_alloc_meM(reasons, char, BURN_REASONS_LEN); + Xorriso_alloc_meM(profile_name, char, 80); + Xorriso_alloc_meM(head_buffer, char, 64 * 1024); + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + {ret= 0; goto ex;} + ret= Xorriso_auto_format(xorriso, 0); + if(ret <=0 ) + {ret= 0; goto ex;} + + do_isosize= !!(flag&2); + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to burn track", 2); + if(ret<=0) + {ret= 0; goto ex;} + + ret= Xorriso_check_multi(xorriso, drive, 1); + if(ret<=0) + goto ex; + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); + if(ret<=0) + goto ex; + + disc= burn_disc_create(); + session= burn_session_create(); + ret= burn_disc_add_session(disc,session,BURN_POS_END); + if(ret==0) { + sprintf(xorriso->info_text, "Cannot add session object to disc object."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + goto ex; + } + track= burn_track_create(); + if(track_source[0] == '-' && track_source[1] == 0) { + fd= 0; + } else { + if(xorriso->fs >= 64) + fd= burn_os_open_track_src(track_source, O_RDONLY, 0); + else + fd= open(track_source, O_RDONLY); + if(fd>=0) + if(fstat(fd,&stbuf)!=-1) + if((stbuf.st_mode&S_IFMT)==S_IFREG) + fixed_size= stbuf.st_size; + } + + if(fd>=0) + data_src= burn_fd_source_new(fd, -1, fixed_size); + if(data_src==NULL) { + sprintf(xorriso->info_text, "Could not open data source "); + Text_shellsafe(track_source, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + ret= 0; goto ex; + } + if((do_isosize || xorriso->fs != 0) && xorriso->fs < 64) + xorriso->fs= 64; + if(xorriso->fs > 0) { + fifo_src= burn_fifo_source_new(data_src, 2048 + 8 * !!(flag & 4), + xorriso->fs, 1); + if(fifo_src == NULL) { + sprintf(xorriso->info_text, "Could not create fifo object of %.f MB", + ((double) xorriso->fs) / 1024.0 / 1024.0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= 0; goto ex; + } + } + xorriso->pacifier_fifo= fifo_src; + if(burn_track_set_source(track, fifo_src == NULL ? data_src : fifo_src) + != BURN_SOURCE_OK) { + sprintf(xorriso->info_text, + "Cannot attach source object to track object"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= 0; goto ex; + } + burn_track_set_cdxa_conv(track, !!(flag & 4)); + burn_session_add_track(session, track, BURN_POS_END); + burn_source_free(data_src); + + if(flag&1) + /* consider overwriteables with ISO as appendable */ + disc_state= isoburn_disc_get_status(drive); + else + /* handle overwriteables as always blank */ + disc_state= burn_disc_get_status(drive); + + if(disc_state == BURN_DISC_BLANK || disc_state == BURN_DISC_APPENDABLE) { + /* ok */; + } else { + if(disc_state == BURN_DISC_FULL) { + sprintf(xorriso->info_text, + "Closed media with data detected. Need blank or appendable media."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + if(burn_disc_erasable(drive)) { + sprintf(xorriso->info_text, "Try -blank as_needed\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + } + } else if(disc_state == BURN_DISC_EMPTY) { + sprintf(xorriso->info_text, "No media detected in drive"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } else { + sprintf(xorriso->info_text, + "Cannot recognize state of drive and media"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + ret= 0; goto ex; + } + if(isoburn_needs_emulation(drive)) + burn_write_opts_set_multi(burn_options, 0); + + if(tsize > 0) { + fixed_size= tsize; + burn_track_set_size(track, fixed_size); + } + if(do_isosize) { + ret= burn_fifo_peek_data(xorriso->pacifier_fifo, head_buffer, 64*1024, 0); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot obtain first 64 kB from input stream."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + /* read isosize from head_buffer, not from medium */ + ret= isoburn_read_iso_head(drive, 0, &isosize, head_buffer, (1<<13)); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Option -isosize given but data stream seems not to be ISO 9660"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + sprintf(xorriso->info_text, "Size of ISO 9660 image: %ds", isosize); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + fixed_size= ((off_t) (isosize)) * (off_t) 2048; + burn_track_set_size(track, fixed_size); + } + + ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2); + is_cd= (ret==2); + is_bd= (ret == 3); + + if(isoburn_needs_emulation(drive)) { + if(flag&1) { + ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &dummy, &nwa); + Xorriso_process_msg_queues(xorriso,0); + if(ret<=0) { + sprintf(xorriso->info_text, + "Cannot obtain next writeable address of emulated multi-session media\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(nwa == 32 && disc_state != BURN_DISC_APPENDABLE) + nwa= 0; /* No automatic toc emulation. Formatter might not be aware. */ + } else { + nwa= 0; + if (disc_state == BURN_DISC_APPENDABLE) { + ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &dummy, &nwa); + Xorriso_process_msg_queues(xorriso,0); + if(ret<=0) { + sprintf(xorriso->info_text, + "Cannot obtain next writeable address of emulated appendable media\n"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + } + } + burn_write_opts_set_start_byte(burn_options,((off_t) nwa) * (off_t) 2048); + } + + if(write_start_address>=0) { + nwa= write_start_address / (off_t) 2048; + if(((off_t) nwa) * (off_t) 2048 < write_start_address ) + nwa++; + burn_write_opts_set_start_byte(burn_options, ((off_t) nwa) * (off_t) 2048); + } + + if(burn_write_opts_auto_write_type(burn_options, disc, reasons, 0) == + BURN_WRITE_NONE) { + sprintf(xorriso->info_text, + "Failed to find a suitable write mode with this media.\n"); + sprintf(xorriso->info_text+strlen(xorriso->info_text), + "Reasons given:\n%s", reasons); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + ret= Xorriso_sanitize_image_size(xorriso, drive, disc, burn_options, 2); + if(ret<=0) + goto ex; + + /* Important: do not return until burn_is_aborting() was checked */ + signal_mode= 1; + ret= burn_drive_get_drive_role(drive); + if(ret == 1) + signal_mode|= 2; + Xorriso_set_signal_handling(xorriso, signal_mode); + + xorriso->run_state= 1; /* Indicate that burning has started */ + burn_disc_write(burn_options, disc); + + ret= Xorriso_pacifier_loop(xorriso, drive, 2 | (is_cd << 4) | (is_bd << 5)); + if(burn_is_aborting(0)) + Xorriso_abort(xorriso, 0); /* Never comes back */ + Xorriso_set_signal_handling(xorriso, 0); + if(ret<=0) + goto ex; + if(!burn_drive_wrote_well(drive)) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "libburn indicates failure with writing."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + + if(flag & 1) { + ret= Xorriso_update_iso_lba0(xorriso, nwa, isosize, head_buffer, NULL, + flag & 2); + if(ret <= 0) + goto ex; + } + sprintf(xorriso->info_text, "Writing to "); + Text_shellsafe(xorriso->outdev, xorriso->info_text, 1); + strcat(xorriso->info_text, " completed successfully.\n\n"); + Xorriso_info(xorriso, 0); + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso,0); + if(disc!=NULL) + burn_disc_free(disc); + if(session != NULL) + burn_session_free(session); + if(track != NULL) + burn_track_free(track); + if(burn_options != NULL) + burn_write_opts_free(burn_options); + if(xorriso->pacifier_fifo!=NULL) + burn_source_free(xorriso->pacifier_fifo); + xorriso->pacifier_fifo= NULL; + xorriso->run_state= 0; /* Indicate that burning has ended */ + Xorriso_free_meM(reasons); + Xorriso_free_meM(profile_name); + Xorriso_free_meM(head_buffer); + return(ret); +} + + +int Xorriso_relax_compliance(struct XorrisO *xorriso, char *mode, + int flag) +{ + char *npt, *cpt; + int l, was, value, ret; + struct isoburn_imgen_opts *opts= NULL; + char *msg= NULL; + off_t limit; + + was= xorriso->relax_compliance; + npt= cpt= mode; + for(; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l == 0) + continue; + if((l == 6 && strncmp(cpt, "strict", l) == 0) || + (l == 5 && strncmp(cpt, "clear", l) == 0)) { + xorriso->relax_compliance= 0; + } else if(l == 7 && strncmp(cpt, "default", l) == 0) { + xorriso->relax_compliance= Xorriso_relax_compliance_defaulT; + + } else if((l == 18 && strncmp(cpt, "untranslated_names", l) == 0) || + (l == 21 && strncmp(cpt, "untranslated_names_on", l) == 0) ) { + xorriso->untranslated_name_len = -1; + } else if((l == 22 && strncmp(cpt, "untranslated_names_off", l) == 0)) { + xorriso->untranslated_name_len = 0; + } else if((l >= 22 && strncmp(cpt, "untranslated_name_len=", 22) == 0)) { + value= -1; + sscanf(cpt + 22, "%d", &value); + /* Let libisoburn check the value */ + ret= isoburn_igopt_new(&opts, 0); + if(ret != 1) + return(-1); + ret= isoburn_igopt_set_untranslated_name_len(opts, value); + isoburn_igopt_destroy(&opts, 0); + if(ret <= 0) { /* Not a tasty value */ + xorriso->relax_compliance= was; + return(0); + } + xorriso->untranslated_name_len = value; + + } else if((l == 16 && strncmp(cpt, "allow_dir_id_ext", l) == 0) || + (l == 19 && strncmp(cpt, "allow_dir_id_ext_on", l) == 0) ) { + xorriso->relax_compliance|= isoburn_igopt_allow_dir_id_ext; + } else if((l == 20 && strncmp(cpt, "allow_dir_id_ext_off", l) == 0)) { + xorriso->relax_compliance&= ~isoburn_igopt_allow_dir_id_ext; + + } else if((l == 12 && strncmp(cpt, "omit_version", l) == 0) || + (l == 15 && strncmp(cpt, "omit_version_on", l) == 0) ) { + xorriso->relax_compliance|= isoburn_igopt_omit_version_numbers; + } else if((l == 16 && strncmp(cpt, "omit_version_off", l) == 0)) { + xorriso->relax_compliance&= ~isoburn_igopt_omit_version_numbers; + + } else if((l == 16 && strncmp(cpt, "only_iso_version", l) == 0) || + (l == 19 && strncmp(cpt, "only_iso_version_on", l) == 0) ) { + xorriso->relax_compliance|= isoburn_igopt_only_iso_versions; + } else if((l == 20 && strncmp(cpt, "only_iso_version_off", l) == 0)) { + xorriso->relax_compliance&= ~isoburn_igopt_only_iso_versions; + + } else if((l == 10 && strncmp(cpt, "deep_paths", l) == 0) || + (l == 13 && strncmp(cpt, "deep_paths_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_allow_deep_paths; + } else if(l == 14 && strncmp(cpt, "deep_paths_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_allow_deep_paths; + + } else if((l == 10 && strncmp(cpt, "long_paths", l) == 0) || + (l == 13 && strncmp(cpt, "long_paths_on", l) == 0) ) { + xorriso->relax_compliance|= isoburn_igopt_allow_longer_paths; + } else if(l == 14 && strncmp(cpt, "long_paths_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_allow_longer_paths; + + } else if((l == 10 && strncmp(cpt, "long_names", l) == 0) || + (l == 13 && strncmp(cpt, "long_names_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_max_37_char_filenames; + } else if(l == 14 && strncmp(cpt, "long_names_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_max_37_char_filenames; + + } else if((l == 13 && strncmp(cpt, "no_force_dots", l) == 0) || + (l == 16 && strncmp(cpt, "no_force_dots_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_no_force_dots; + } else if(l == 17 && strncmp(cpt, "no_force_dots_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_no_force_dots; + + } else if((l == 15 && strncmp(cpt, "no_j_force_dots", l) == 0) || + (l == 18 && strncmp(cpt, "no_j_force_dots_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_no_j_force_dots; + } else if(l == 19 && strncmp(cpt, "no_j_force_dots_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_no_j_force_dots; + + } else if((l == 9 && strncmp(cpt, "lowercase", l) == 0) || + (l == 12 && strncmp(cpt, "lowercase_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_allow_lowercase; + } else if(l == 13 && strncmp(cpt, "lowercase_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_allow_lowercase; + + } else if((l == 10 && strncmp(cpt, "full_ascii", l) == 0) || + (l == 13 && strncmp(cpt, "full_ascii_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_allow_full_ascii; + } else if(l == 14 && strncmp(cpt, "full_ascii_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_allow_full_ascii; + + } else if((l == 17 && strncmp(cpt, "joliet_long_paths", l) == 0) || + (l == 20 && strncmp(cpt, "joliet_long_paths_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_joliet_longer_paths; + } else if(l == 21 && strncmp(cpt, "joliet_long_paths_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_joliet_longer_paths; + + } else if((l == 17 && strncmp(cpt, "joliet_long_names", l) == 0) || + (l == 20 && strncmp(cpt, "joliet_long_names_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_joliet_long_names; + } else if(l == 21 && strncmp(cpt, "joliet_long_names_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_joliet_long_names; + + } else if((l == 10 && strncmp(cpt, "always_gmt", l) == 0) || + (l == 13 && strncmp(cpt, "always_gmt_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_always_gmt; + } else if(l == 14 && strncmp(cpt, "always_gmt_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_always_gmt; + + } else if((l == 9 && strncmp(cpt, "rec_mtime", l) == 0) || + (l == 12 && strncmp(cpt, "rec_mtime_on", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_dir_rec_mtime; + } else if(l == 13 && strncmp(cpt, "rec_mtime_off", l) == 0) { + xorriso->relax_compliance&= ~isoburn_igopt_dir_rec_mtime; + + } else if((l == 6 && strncmp(cpt, "old_rr", l) == 0) || + (l == 9 && strncmp(cpt, "old_rr_on", l) == 0) || + (l == 10 && strncmp(cpt, "new_rr_off", l) == 0)) { + xorriso->relax_compliance|= + isoburn_igopt_rrip_version_1_10 | isoburn_igopt_aaip_susp_1_10; + } else if((l == 10 && strncmp(cpt, "old_rr_off", l) == 0) || + (l == 9 && strncmp(cpt, "new_rr_on", l) == 0) || + (l == 6 && strncmp(cpt, "new_rr", l) == 0)) { + xorriso->relax_compliance&= + ~(isoburn_igopt_rrip_version_1_10 | isoburn_igopt_aaip_susp_1_10); + + } else if((l == 14 && strncmp(cpt, "aaip_susp_1_10", l) == 0) || + (l == 17 && strncmp(cpt, "aaip_susp_1_10_on", l) == 0) || + (l == 18 && strncmp(cpt, "aaip_susp_1_12_off", l) == 0)) { + xorriso->relax_compliance|= isoburn_igopt_aaip_susp_1_10; + } else if((l == 18 && strncmp(cpt, "aaip_susp_1_10_off", l) == 0) || + (l == 17 && strncmp(cpt, "aaip_susp_1_12_on", l) == 0) || + (l == 14 && strncmp(cpt, "aaip_susp_1_12", l) == 0)) { + xorriso->relax_compliance&= ~isoburn_igopt_aaip_susp_1_10; + + } else if((l == 11 && strncmp(cpt, "no_emul_toc", l) == 0) || + (l == 14 && strncmp(cpt, "no_emul_toc_on", l) == 0)) { + xorriso->no_emul_toc|= 1; + } else if((l == 15 && strncmp(cpt, "no_emul_toc_off", l) == 0) || + (l == 8 && strncmp(cpt, "emul_toc", l) == 0)) { + xorriso->no_emul_toc&= ~1; + + } else if((l == 13 && strncmp(cpt, "iso_9660_1999", l) == 0) || + (l == 16 && strncmp(cpt, "iso_9660_1999_on", l) == 0)) { + xorriso->do_iso1999= 1; + } else if(l == 17 && strncmp(cpt, "iso_9660_1999_off", l) == 0) { + xorriso->do_iso1999= 0; + + } else if((l >= 15 && strncmp(cpt, "iso_9660_level=", 15) == 0)) { + value= 0; + sscanf(cpt + 15, "%d", &value); + if(value == 1 || value == 2) { + limit= ((off_t) 4) * ((off_t) 1024*1024*1024) - ((off_t) 1); + xorriso->iso_level= value; + if(xorriso->file_size_limit > limit) + xorriso->file_size_limit= limit; + } else if(value == 3) { + xorriso->iso_level= value; + if(xorriso->file_size_limit < Xorriso_default_file_size_limiT) + xorriso->file_size_limit= Xorriso_default_file_size_limiT; + } else { + Xorriso_alloc_meM(msg, char, 160); + sprintf(msg, + "-compliance iso_9660_level=%d : Only 1, 2, or 3 are permissible", + value); + Xorriso_msgs_submit(xorriso, 0, msg, 0, "FAILURE", 0); + Xorriso_free_meM(msg); + msg= NULL; + xorriso->relax_compliance= was; + return(0); + } + + } else if((l == 8 && strncmp(cpt, "iso_9660", l) == 0) || + (l == 11 && strncmp(cpt, "iso_9660_on", l) == 0)) { + /* may have a meaning in future */; + } else if(l == 12 && strncmp(cpt, "iso_9660_off", l) == 0) { + /* may have a meaning in future */; + Xorriso_msgs_submit(xorriso, 0, + "-compliance -iso_9660_off : Cannot do anything else but ISO 9660", + 0, "FAILURE", 0); + xorriso->relax_compliance= was; + return(0); + + } else if((l == 9 && strncmp(cpt, "old_empty", l) == 0) || + (l == 12 && strncmp(cpt, "old_empty_on", l) == 0)) { + xorriso->do_old_empty= 1; + } else if(l == 13 && strncmp(cpt, "old_empty_off", l) == 0) { + xorriso->do_old_empty= 0; + + } else { + if(l<SfileadrL) + sprintf(xorriso->info_text, "-compliance: unknown rule '%s'", + cpt); + else + sprintf(xorriso->info_text, + "-compliance: oversized rule parameter (%d)", l); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->relax_compliance= was; + return(0); + } + } + return(1); +ex:; + Xorriso_free_meM(msg); + return(ret); +} + + +/* @return 1=ok 2=ok, is default setting */ +int Xorriso_get_relax_text(struct XorrisO *xorriso, char mode[1024], + int flag) +{ + int r; + + r= xorriso->relax_compliance; + if(r == 0) { + strcpy(mode, "strict"); + return(1); + } + strcpy(mode, "clear"); + sprintf(mode + strlen(mode), ":iso_9660_level=%d", xorriso->iso_level); + if(r & isoburn_igopt_allow_dir_id_ext) + strcat(mode, ":allow_dir_id_ext"); + if(r & isoburn_igopt_omit_version_numbers) + strcat(mode, ":omit_version"); + if(r & isoburn_igopt_only_iso_versions) + strcat(mode, ":only_iso_version"); + if(r & isoburn_igopt_allow_deep_paths) + strcat(mode, ":deep_paths"); + if(r & isoburn_igopt_allow_longer_paths) + strcat(mode, ":long_paths"); + if(r & isoburn_igopt_max_37_char_filenames) + strcat(mode, ":long_names"); + if(r & isoburn_igopt_no_force_dots) + strcat(mode, ":no_force_dots"); + if(r & isoburn_igopt_no_j_force_dots) + strcat(mode, ":no_j_force_dots"); + if(r & isoburn_igopt_allow_lowercase) + strcat(mode, ":lowercase"); + if(r & isoburn_igopt_allow_full_ascii) + strcat(mode, ":full_ascii"); + if(r & isoburn_igopt_joliet_longer_paths) + strcat(mode, ":joliet_long_paths"); + if(r & isoburn_igopt_joliet_long_names) + strcat(mode, ":joliet_long_names"); + if(r & isoburn_igopt_always_gmt) + strcat(mode, ":always_gmt"); + if(r & isoburn_igopt_dir_rec_mtime) + strcat(mode, ":rec_mtime"); + if(r & isoburn_igopt_rrip_version_1_10) { + strcat(mode, ":old_rr"); + if(!(r & isoburn_igopt_aaip_susp_1_10)) + strcat(mode, ":aaip_susp_1_10_off"); + } else { + strcat(mode, ":new_rr"); + if(r & isoburn_igopt_aaip_susp_1_10) + strcat(mode, ":aaip_susp_1_10"); + } + if(xorriso->no_emul_toc & 1) + strcat(mode, ":no_emul_toc"); + if(xorriso->untranslated_name_len != 0) + sprintf(mode + strlen(mode), ":untranslated_name_len=%d", + xorriso->untranslated_name_len); + if(xorriso->do_iso1999) + sprintf(mode + strlen(mode), ":iso_9660_1999"); + if(xorriso->do_old_empty) + sprintf(mode + strlen(mode), ":old_empty"); + return(1 + + (r == Xorriso_relax_compliance_defaulT && !(xorriso->no_emul_toc & 1) + && xorriso->untranslated_name_len == 0 && !xorriso->do_iso1999 && + xorriso->iso_level == 3)); +} + + +/* @param flag bit0= operating on newly attached boot image +*/ +int Xorriso_set_isolinux_options(struct XorrisO *xorriso, + IsoImage *image, int flag) +{ + int make_isohybrid_mbr= 0, ret, patch_table= 0, num_boots, i; + ElToritoBootImage *bootimg, **boots = NULL; + IsoFile *bootimg_node, **bootnodes = NULL; + + ret= iso_image_get_boot_image(image, &bootimg, &bootimg_node, NULL); + Xorriso_process_msg_queues(xorriso,0); + if(ret != 1) { + sprintf(xorriso->info_text, "Programming error: No boot image available in Xorriso_set_isolinux_options()"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + ret= -1; goto ex; + } + ret= iso_image_get_all_boot_imgs(image, &num_boots, &boots, &bootnodes, 0); + Xorriso_process_msg_queues(xorriso,0); + if(ret != 1) { + Xorriso_report_iso_error(xorriso, "", ret, "Cannot inquire boot images", 0, + "FATAL", 1); + ret= -1; goto ex; + } + patch_table= xorriso->patch_isolinux_image & 1; + if((flag & 1) && num_boots > 1) { + ret= el_torito_set_isolinux_options(boots[num_boots - 1], patch_table, 0); + ret= (ret == 1); goto ex; + } + + /* Handle patching of first attached boot image or of imported boot images + */ + for(i= 0; i < num_boots; i++) { + patch_table = xorriso->patch_isolinux_image & 1; + if(patch_table && !(flag & 1)) { + if(!el_torito_seems_boot_info_table(boots[i], 0)) + patch_table= 0; + else if((xorriso->patch_isolinux_image & 2) && + el_torito_get_boot_platform_id(boots[i]) == 0xef) + patch_table= 0; + } + if(i > 0 || xorriso->boot_image_isohybrid == 0) { + ret= el_torito_set_isolinux_options(boots[i], patch_table, 0); + if(ret != 1) + {ret= 0; goto ex;} + continue; + } + if(xorriso->boot_image_isohybrid == 3) { + make_isohybrid_mbr= 1; + } else { + ret= Xorriso_is_isohybrid(xorriso, bootimg_node, 0); + if(ret < 0) + {ret= 0; goto ex;} + if(ret > 0) + make_isohybrid_mbr= 1; + } + + if(xorriso->boot_image_isohybrid == 2 && !make_isohybrid_mbr) { + sprintf(xorriso->info_text, + "Isohybrid signature is demanded but not found in boot image file."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + if(make_isohybrid_mbr) { + sprintf(xorriso->info_text, "Will write isohybrid MBR."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + ret= el_torito_set_isolinux_options(bootimg, + patch_table | (make_isohybrid_mbr << 1),0); + if(ret != 1) + {ret= 0; goto ex;} + } +ex: + Xorriso_process_msg_queues(xorriso,0); + if(boots != NULL) + free(boots); + if(bootnodes != NULL) + free(bootnodes); + return(ret); +} + + +/* + @param flag bit0= obtain iso_lba from indev + bit1= head_buffer already contains a valid head + bit2= issue message about success + bit3= check whether source blocks are banned by in_sector_map +*/ +int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize, + char *head_buffer, struct CheckmediajoB *job, + int flag) +{ + int ret, full_size, i; + char *headpt; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + off_t seek_ret, to_write; + int tag_type; + uint32_t pos, range_start, range_size, next_tag; + char md5[16]; + + ret= Xorriso_may_burn(xorriso, 0); + if(ret <= 0) + return(0); + if(flag & 1) { + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to learn current session lba", 1); + if(ret<=0) + return(0); + ret= isoburn_disc_get_msc1(drive, &iso_lba); + if(ret<=0) + return(0); + drive= NULL; /* indev will not be used furtherly */ + } + if(job == NULL) { + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to update at lba 0 to 31", 2); + if(ret<=0) + return(0); + } + if(iso_lba < 32) + return(2); + + if(!(flag & 2)) { + /* head_buffer was not filled yet. Read it from output media. */ + if(burn_drive_get_drive_role(drive) == 5) /* write-only */ + return(2); + if(job != NULL && job->data_to_fd >= 0) { + if((flag & 8) && job->sector_map != NULL) { + ret= Sectorbitmap_bytes_are_set(job->sector_map, + ((off_t) iso_lba) * (off_t) 2048, + ((off_t) (iso_lba + 32)) * ((off_t) 2048) - (off_t) 1, 0); + if(ret <= 0) { + sprintf(xorriso->info_text, + "ISO image head at lba %d is marked as invalid blocks in file copy", + iso_lba); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", + 0); + return(0); + } + } + seek_ret= lseek(job->data_to_fd, ((off_t) 2048) * (off_t) iso_lba, + SEEK_SET); + if(seek_ret == -1) + ret= 0; + else + ret= read(job->data_to_fd, head_buffer, 64 * 1024); + if(ret < 64 * 1024) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot read ISO image head from file copy"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + return(0); + } + ret= isoburn_read_iso_head(drive, 0, &isosize, head_buffer, 1 << 13); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Alleged session start does not like ISO 9660."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + return(0); + } + } else { + ret= isoburn_read_iso_head(drive, iso_lba, &isosize, head_buffer, 2); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot read freshly written ISO image head"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + } + /* patch ISO header */ + full_size= iso_lba + isosize; + headpt= head_buffer + 32*1024; + for(i=0;i<4;i++) + headpt[87-i]= headpt[80+i]= (full_size >> (8*i)) & 0xff; + + + if(job != NULL) { + /* This is a check_media superblock relocation: + Invalidate eventual libisofs checksum tags. + Write only up to PVD end plus eventual invalidated tag. + */ + /* Look for volume descriptor end */ + for(i= 16; i < 32; i++) + if(((unsigned char *) head_buffer)[i * 2048] == 0xff && + strncmp(head_buffer + i * 2048 + 1, "CD001", 5) == 0) + break; + /* Check whether the next one is a libisofs checksum tag */ + if(i < 32) { + i++; + ret= iso_util_decode_md5_tag(head_buffer + i * 2048, &tag_type, &pos, + &range_start, &range_size, &next_tag, md5, 0); + if(ret != 0) /* corrupted or not: invalidate */ + memset(head_buffer + i * 2048, 0, 8); + } + to_write= 2048 * (i + 1); + + seek_ret= lseek(job->data_to_fd, (off_t) 0, SEEK_SET); + if(seek_ret == -1) + ret= 0; + else + ret= write(job->data_to_fd, head_buffer, to_write); + if(ret < to_write) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot write ISO image head to file copy"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); + return(0); + } + } else { + /* This is a regular superblock relocation. Write full 64 kB. */ + to_write= 64 * 1024; + ret= burn_random_access_write(drive, (off_t) 0, head_buffer, to_write, 1); + if(ret<=0) { + Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text, + "Cannot write new ISO image head to LBA 0"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + } + if(flag & 4) { + sprintf(xorriso->info_text, + "Overwrote LBA 0 to 31 by 64 KiB from LBA %d", iso_lba); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + } + return(1); +} + + +int Xorriso_set_system_area_path(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + char *eff_src= NULL; + + if(path[0] == 0) { + xorriso->system_area_disk_path[0]= 0; + {ret= 1; goto ex;} + } + Xorriso_alloc_meM(eff_src, char, SfileadrL); + ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, path, eff_src, 2|4|16); + if(ret < 0) + goto ex; + if(ret == 0) { + sprintf(xorriso->info_text, + "Given path does not exist on disk: -boot_image system_area="); + Text_shellsafe(eff_src, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } + if(ret == 2) { + sprintf(xorriso->info_text, + "Given path leads to a directory: -boot_image system_area="); + Text_shellsafe(eff_src, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + ret= Sfile_str(xorriso->system_area_disk_path, eff_src, 0); + if(ret <= 0) + {ret= -1; goto ex;} + ret= 1; +ex: + Xorriso_free_meM(eff_src); + return(ret); +} + + +/* @param flag bit0=force burn_disc_close_damaged() +*/ +int Xorriso_close_damaged(struct XorrisO *xorriso, int flag) +{ + int ret; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + struct burn_write_opts *burn_options= NULL; + + if(xorriso->volset_change_pending) { + sprintf(xorriso->info_text, + "Image changes pending. -commit or -rollback first"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to closed damaged session", 2); + if(ret<=0) + goto ex; + ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); + if(ret <= 0) + goto ex; + ret= burn_disc_close_damaged(burn_options, flag & 1); + Xorriso_process_msg_queues(xorriso, 0); + Xorriso_option_dev(xorriso, "", 3 | 4); /* Give up drives */ + if(ret <= 0) + goto ex; + + ret= 1; +ex:; + Xorriso_process_msg_queues(xorriso, 0); + if(burn_options != NULL) + burn_write_opts_free(burn_options); + return(ret); +} + diff --git a/libisoburn/branches/1.1.8/xorriso/write_run.h b/libisoburn/branches/1.1.8/xorriso/write_run.h new file mode 100644 index 00000000..f245f025 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/write_run.h @@ -0,0 +1,53 @@ + +/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains declarations of functions which are needed to write + sessions. +*/ + + +#ifndef Xorriso_pvt_write_run_includeD +#define Xorriso_pvt_write_run_includeD yes + + +/* CD specs say one shall not write tracks < 600 kiB */ +#define Xorriso_cd_min_track_sizE 300 + + +/* Default setting for -compliance */ +#define Xorriso_relax_compliance_defaulT \ + (isoburn_igopt_allow_deep_paths | isoburn_igopt_allow_longer_paths | \ + isoburn_igopt_always_gmt | \ + isoburn_igopt_rrip_version_1_10 | isoburn_igopt_aaip_susp_1_10 | \ + isoburn_igopt_only_iso_versions | isoburn_igopt_no_j_force_dots) + + +int Xorriso_make_write_options( + struct XorrisO *xorriso, struct burn_drive *drive, + struct burn_write_opts **burn_options, int flag); + +int Xorriso_sanitize_image_size(struct XorrisO *xorriso, + struct burn_drive *drive, struct burn_disc *disc, + struct burn_write_opts *burn_options, int flag); + +int Xorriso_auto_format(struct XorrisO *xorriso, int flag); + +int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive, + IsoImage *img, struct isoburn_imgen_opts *sopts, + int flag); + +int Xorriso_check_burn_abort(struct XorrisO *xorriso, int flag); + +int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, + int flag); + +int Xorriso_set_isolinux_options(struct XorrisO *xorriso, + IsoImage *image, int flag); + + +#endif /* ! Xorriso_pvt_write_run_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/xorrecord.1 b/libisoburn/branches/1.1.8/xorriso/xorrecord.1 new file mode 100644 index 00000000..129f8a93 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrecord.1 @@ -0,0 +1,741 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" +.\" IMPORTANT NOTE: +.\" +.\" The original of this file is kept in xorriso/xorrecord.texi +.\" This here was generated by program xorriso/make_xorriso_1 +.\" +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH XORRECORD 1 "Version 1.1.7, Oct 24, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.nh +.SH NAME +xorrecord \- Emulation of CD/DVD/BD program cdrecord by program xorriso +.SH SYNOPSIS +.B xorrecord +[ options ] dev=device [track_source] +.br +.SH DESCRIPTION +.PP +\fBxorrecord\fR +writes preformatted data to CD, DVD, and BD media. +.br +.PP +It understands some options of program cdrecord from cdrtools by +Joerg Schilling. +Its implementation is part of program xorriso which shares no source +code with cdrtools, but rather makes use of libburn for communicating +with the drive. +.br +Another, more complete cdrecord emulator is program \fBcdrskin\fR +which uses the same burn functions as \fBxorrecord\fR. +.SS +\fBMMC, Session, Track, Media types:\fR +.br +\fBMMC\fR +is a standard out of the SCSI family which defines the interaction between +computers and optical drives. Since more than a decade all CD, DVD, or BD +recorders obey this standard regardless by what bus cabling they are +attached to the computer. libburn relies on this standard compliance and +on the capability of the operating system to perform SCSI transactions +over the particular bus cabling. +.br +A \fBSession\fR is a data region on an optical disc which usually +gets written in a single sweep. It contains at least one +\fBTrack\fR which is a contiguous string of readable blocks. +\fBxorrecord\fR produces a single session with a single data track +which consists of blocks with 2048 bytes each. It chooses the write mode +automatically according to media type, medium state, and option \-multi. +.br +On CD media there are other track types, like audio, and particular write +modes like TAO and SAO. CD and DVD\- media can put more than one track into +a session. Some of these features can be addressed by program \fBcdrskin\fR. +.br +MMC describes several recordable \fBmedia types\fR which roughly form two +families. +.br +\fBSequentially recordable media\fR +are CD\-R, CD\-RW, DVD\-R, DVD\-R DL, DVD\-RW, DVD+R, DVD+R DL, BD\-R. +Except DVD\-R DL they can store more than one session if there is still +unwritten space and if the previous session was written with option +\fB\-multi\fR. CD\-RW and DVD\-RW can be blanked in order to be re\-usable +from scratch. +.br +\fBOverwritable media\fR are DVD\-RAM, DVD+RW, formatted DVD\-RW, BD\-RE. +They offer a single session with a single track for random access writing. +There is no need to blank overwritable media before re\-use. +.br +DVD\-RW media are sold in sequentially recordable state but can be +formatted once to become overwritable. See options +\fBblank=format_overwrite\fR and \fBblank=deformat\fR. +.br +If ISO 9660 filesystems are to be stored on overwritable media, then it +is possible to emulate multiple sessions, by using option +\fB\-\-grow_overriteable_iso\fR. In this case, the need for +blanking before re\-use is emulated too. +.SS +.B Drive preparation and addressing: +.PP +The drives, CD, DVD, or BD burners, are accessed via file addresses which +are specific to libburn and the operating system. Those addresses get listed +by a run of \fBxorrecord \-\-devices\fR or \fBxorriso \-device_links\fR. +.br +On GNU/Linux and FreeBSD, the user needs rw\-permission for the device file. +On Solaris, the user needs r\-permission and privilege "sys_devices", +which is usually gained by running \fBxorrecord\fR via command pfexec. +.br +These permissions resp. privileges are needed already for listing a drive. +So it might be necessary to get the overview as superuser resp. via pfexec. +.br +\fBxorrecord\fR does not perform cdrecord option \-scanbus and does +not accept the addresses of form Bus,Target,Lun which are told by \-scanbus. +If support for these addresses is necessary, consider to use program cdrskin. +.br +It is possible to let \fBxorrecord\fR work on emulated drives. +Their addresses begin by prefix "stdio:" followed by a file address. +The emulated media behavior depends on the file type. +See man xorriso for details. +.br +If standard output is chosen as emulated drive, then all program result +texts, which usually appear on standard output, will get redirected to +standard error. +.SS +\fBRelation to program xorriso:\fR +.br +\fBxorrecord\fR is actually a command mode of program \fBxorriso\fR, +which gets entered either by xorriso command "\-as cdrecord" or by +starting the program by one of the names "xorrecord", "cdrecord", +"wodim", or "cdrskin". +.br +This command mode can be left by argument "\-\-" which leads +to generic xorriso command mode. See \fBman xorriso\fR for its description. +Other than in xorriso command mode, the sequence of the cdrecord emulation +options does not matter. +All pending actions get performed in a fixed sequence before the program +run ends resp. before cdrecord emulation ends. +.SS +.br +.SH OPTIONS +.br +.PP +.TP +.B Addressing the drive: +.TP +\fB--devices\fR +Print the list of accessible CD, DVD, or BD drives to standard output. +Drives might be inaccessible if the user lacks of permissions to use them +or if the drive is in use by another program. +.br +Each accessible drive is shown by a line like: +.br + 0 \-dev '/dev/sr0' rwrw\-\- : 'TSSTcorp' 'CDDVDW SH\-S203B' +.br +The libburn address of this drive is '/dev/sr0'. 'TSSTcorp' is the +name of the vendor (in this case: Toshiba Samsung Storage Technologies +Corporation), 'CDDVDW SH\-S203B' is the model name (in this case: a DVD burner). +.TP +\fBdev=drive_address\fR +Set the libburn address of the drive to be used. +.br +E.g. on GNU/Linux: dev=/dev/sr0 +.br +E.g. on FreeBSD: dev=/dev/cd0 +.br +E.g. on Solaris: dev=/dev/rdsk/c2t2d0s2 +.br +See also above "Drive preparation and addressing". +.br +The medium in the drive should not be mounted or be otherwise in use. +.TP +.B Inquiring drive and media: +.TP +\fB\-inq\fR +Print to standard output: vendor, model name, and firmware revision +of the drive. +.TP +\fB\-checkdrive\fR +Print unconditionally that the drive supports burnfree, SAO, and TAO. +Also print the output of option \-inq. +.TP +\fB\-atip\fR +Print the output of \-checkdrive, the most capable profile of the medium +in the drive, the list of profiles which are supported by the drive, +whether it is erasable (i.e. can be blanked), the media manufacturer, and +the medium product name. +.br +Profiles are usage models, which are often tied to a particular media type +(e.g. CD\-RW), but may also apply to a family of media. E.g. profile CD\-ROM +applies to all CD media which contain data. +.TP +\fB\-toc\fR +Print a table of content of the medium in the drive. The output is not +compatible to +cdrecord option \-toc, but rather the one of \fBxorriso\fR command \-toc. +It lists the address, vendor, model name, and firmware revision of the drive. +.br +About the medium it tells product name and manufacturer, whether there +is already content written, and if so, whether the medium is closed or +appendable. Appendable media can take another session. +The amount of readable and writable data is told. +If there are sessions, then their start block address and size is reported. +If a session contains an ISO 9660 filesystem, then its Volume Id is reported. +If the medium is writable, then the next writable block address is reported. +.br +If not option \fB\-\-grow_overriteable_iso\fR is given or no ISO 9660 +file system is present on the medium, then overwritable media are reported +as being blank. This is due to the fact that they can be written from +scratch without further preparation, and that MMC does not distinguish +between data written by the most previous burn run and older data +which have not been overwritten by that burn run. +Consequently, these media are reported with 0 readable blocks, although +all their writable blocks normally are readable, too. +.TP +\fB\-msinfo\fR +Print the argument text for option \-C of programs mkisofs, genisoimage, +or xorrisofs. It consists of two numbers separated by a comma. +.br +The first number tells the first block of the first track of the last recorded +session. This is also the address used by default when operating systems +mount a medium with e.g. ISO 9660 filesystem. +.br +The second number tells the next writable address, where \fBxorrecord\fR +will begin to write the next session. +.br +This option is only valid for written, appendable media. In all other +cases it will yield no output text but will abort the program +with non\-zero exit value. +.TP +.B Settings for the burn run: +.PP +A burn run requires exactly one track source address argument, which +tells from where to read the data wich shall be put into the upcomming +session. The medium state must be either blank or appendable. +.br +Track source may be "\-" for standard input or the address of a readable +file of any type except directories. Nearly all media types accept a track +source with unpredictable byte count, like standard input or named pipes. +Nevertheless, DVD\-R DL and DVD\-RW blanked by mode deformat_quickest +demand exact in\-advance reservation of the track size, so that they either +need to be read from a source of +predictable length, or need to be accompanied by option \fBtsize=\fR or +by option \fB\-isosize\fR. +.br +Several options expect a size value as argument. A number with a trailing +letter "b" or without a trailing letter is a plain byte count. Other trailing +letters cause multiplication of the given number by a scaling factor: +.br +"k" or "K" = 1024 , "m" or "M" = 1024k , "g" or "G" = 1024m , "s" or "S" = 2048 +.br +E.g. tsize=234567s means a size of 234567 * 2048 = 480393216 bytes. +.TP +\fBblank=mode\fR +Blank a CD\-RW or DVD\-RW to make it re\-usable from scratch. +Format a DVD\-RW, DVD+RW, DVD\-RAM, BD\-R, or BD\-RE if not yet formatted. +.br +This operation normally makes any recorded data on the medium unreadable. +It is combinable with burning in the same run of \fBxorrecord\fR, +or it may be performed without a track source, leaving the medium empty. +.br +The mode given with blank= selects the particular behavior: +.RS +.TP +.br +as_needed +.br +Try to make the media ready for writing from scratch. If it needs formatting, +then format it. If it is not blank, then try to apply blank=fast. +It is a reason to abort if the mediium cannot assume thoroughly writeable +state, e.g. if it is a non\-blank write\-once. +.br +This leaves unformatted DVD\-RW in unformatted blank state. To format DVD\-RW use +blank=format_overwrite. Blank unformatted BD\-R stay unformatted. +.br +(Note: blank=as_needed is not an original cdrecord option.) +.TP +.br +all +.br +Blank an entire CD\-RW or an unformatted DVD\-RW. +.TP +.br +fast +.br +Minimally blank an entire CD\-RW or blank an unformatted DVD\-RW. +.TP +.br +deformat +.br +Like blank=all but with the additional ability to blank overwriteable DVD\-RW. +This will destroy their formatting and make them sequentially recordable. +.br +(Note: blank=deformat is not an original cdrecord options) +.TP +.br +deformat_quickest +.br +Like blank=deformat but blanking DVD\-RW only minimally. +This is faster than full blanking but yields media incapable of +writing tracks of unpredicatable size. +Multi\-session will not be possible either. +.br +(Note: blank=deformat_quickest is not an original cdrecord option.) +.TP +.br +format_overwrite +.br +Format a DVD\-RW to "Restricted Overwrite". The user should bring some patience. +.br +Format unformatted DVD+RW, BD\-RE or blank BD\-R to their default size. +It is not mandatory to do this with DVD+RW and BD\-RE media, because they +will get formatted automatically on the first write attempt. +.br +BD\-R media may be written in unformatted state. This keeps disabled the +replacement of bad blocks and enables full nominal write speed. Once BD\-R +media are written, they cannot be formatted any more. +.br +For re\-formatting already formatted media or for formatting with +non\-default size, use program \fBxorriso\fR with command \fB\-format\fR. +.br +(Note: blank=format_overwrite is not an original cdrecord options) +.RE +.TP +\fB\-multi\fR +This option keeps CD, unformatted DVD\-R[W], DVD+R, or BD\-R appendable +after the current session has been written. +Without it the disc gets closed and may not be written any more \- unless it +is a \-RW and gets blanked, which causes loss of its content. +.br +This option cannot be applied to DVD\-R DL and DVD\-RW which were blanked +by type deformat_quickest. +.br +In order to have all filesystem content accessible, the eventual ISO\-9660 +filesystem of a follow\-up +session needs to be prepared in a special way by the filesystem formatter +program. mkisofs, genisoimage, and xorrisofs expect particular info about +the situation which can be retrieved by \fBxorrecord\fR option \-msinfo. +.br +With overwriteable DVD or BD media, \-multi cannot mark the end of the session. +So when adding a new session, this end has to be determined from the payload. +Currently only ISO\-9660 filesystems can be used that way. See option +\fB\-\-grow_overwriteable_iso\fR. +.TP +\fB\-dummy\fR +Try to perform the drive operations without actually affecting the inserted +media. There is no warranty that this will work with a particular combination +of drive and media. Blanking is prevented reliably, though. +To avoid inadverted real burning, \-dummy refuses burn runs on anything but +CD\-R[W], DVD\-R[W], or emulated stdio\-drives. +.TP +\fB\-waiti\fR +Wait until input data is available at stdin or EOF occurs at stdin. +Only then begin to access any drives. +.br +One should use this if xorrisofs is working at the end of a pipe where the +feeder process reads from the drive before it starts writing its output into +xorrisofs. Example: +.br +xorrisofs ... \-C 0,12800 \-M /dev/sr0 ... | \\ +.br +xorrecord dev=/dev/sr0 ... \-waiti \- +.br +This option works even if standard input is not the track source. If no process +is piping in, then the Enter key of your terminal will act as trigger for +\fBxorrecord\fR. Note that this input line will not be consumed by +cdrskin if standard input is not the track source. It will end up as shell +command, usually. +.TP +\fBtsize=size\fR +Announce the exact size of the track source. This is necessary with +DVD\-R DL media and with quickest blanked DVD\-RW, if the size cannot be +determined in advance from the track source. E.g. if it is standard input +or a named pipe. +.br +If the track source does not deliver the predicted amount of bytes, the +remainder of the track is padded with zeros. This is not considered an error. +If on the other hand the track source delivers more than the announced bytes +then the track on media gets truncated to the predicted size and xorrecord +exits with non\-zero value. +.TP +\fB\-isosize\fR +Try to obtain the track size from the content of the track source. +This works only if the track source bears an ISO 9660 filesystem. +Any other track source content will cause the burn run to abort. +.br +If the track source is not a regular file or block device, then this option +will work only if the program's fifo size is at least 64k. See option fs=. +.TP +\fBpadsize=size\fR +Add the given amount of trailing zeros to the upcomming track. +This feature can be disabled by size 0. Default is 300 kB in order to +work around a problem with GNU/Linux which often fails to read the last few +blocks of a CD track which was written in write mode TAO. TAO is used +by \fBxorrecord\fR if the track size cannot be predicted or if the CD +medium is not blank but appendable. +.TP +\fB\-nopad\fR +The same as padsize=0. +.TP +\fB\-pad\fR +The same as padsize=15s. This was once sufficient with older GNU/Linux +kernels. Meanwhile one should at least use padsize=128k, if not padsize=300k. +.TP +\fB\-data\fR +Explicitely announce that the track source shall be recorded as data track, +and not as audio track. This option has no effect with \fBxorrecord\fR, +because there is no support for other track formats anyway. +.TP +\fBfs=size\fR +Set the size of the program fifo buffer to the given value +rather than the default of 4m. +.br +The fifo buffers a temporary surplus of track source data in order to +provide the drive with a steady stream during times of temporary lack of track +source supply. +.br +Other than cdrecord, xorrecord enables drive buffer underrun protection by +default and does not wait with writing until the fifo is full for a first +time. +On very old CD drives and slow computers, this might cause aborted burn runs. +In this case, consider to use program \fBcdrskin\fR for CD burning. +DVD and BD drives tolerate buffer underrun without problems. +.br +The larger the fifo, the longer periods of poor source supply can be +compensated. But a large fifo can deprive the operating system of read cache +for better filesystem performance. +.TP +\fBspeed=value\fR +Set the write speed. Default is 0 = maximum speed. +Speed can be given in media type dependent x\-speed numbers or as a +desired throughput per second in MMC compliant kB (= 1000) +or MB (= 1000 kB). Media x\-speed factor can be set explicity +by appending "c" for CD, "d" for DVD, "b" for BD. "x" is optional. +.br +Example speeds: +.br + 706k = 706kB/s = 4c = 4xCD +.br + 5540k = 5540kB/s = 4d = 4xDVD +.br +If there is no hint about the speed unit attached, then the +medium in the drive will decide. +Default unit is CD, 1x = 176,400 raw bytes/second. +With DVD, 1x = 1,385,000 bytes/second. +With BD, 1x = 4,495,625 bytes/second. +.br +MMC drives usually activate their own idea of speed and take +the speed value given by the burn program only as a hint +for their own decision. +.TP +\fB\-eject\fR +Eject the drive tray after alll other work is done. +.TP +.B Program version and verbosity: +.TP +\fB\-version\fR +Print to standard output a line beginning by +.br +"Cdrecord 2.01\-Emulation Copyright" +.br +and further lines which report the version of xorriso and its +supporting libraries. They also state the license under which the program +is provided, and disclaim any warranty, to the extent permitted by law. +.TP +\fB\-v\fR +Increase program verbosity by one level. There are four verbosity levels +from nearly silent to debugging verbosity. The both highest levels can +be enabled by repeated \-v or by \-vv resp. \-vvv. +.TP +\fB\-V\fR +Log SCSI commands and drive replies to standard error. +This might be of interest if \fBxorrecord\fR and a particular drive +or medium do not cooperate as expected, or if you just want to know +how libburn interacts with the drive. +To understand this extremely verbous log, one needs to read SCSI +specs SPC, SBC, and MMC. +.br +Please do not add such a log to a bug report on the first hand, +unless you want to point out a particular deviation +from said specs, or if you get asked for this log by a maintainer of +\fBxorrecord\fR who feels in charge for your bug report. +.TP +\fB\-help\fR +Print a sparse list of program options to standard error +and declare not to be cdrecord. +.TP +.B Options not compatible to cdrecord: +.TP +\fB--no_rc\fR +Only if used as first command line argument this option +prevents reading and interpretation of startup files. See section FILES below. +.TP +\fB--grow_overwriteable_iso\fR +Enable emulation of multi\-session writing on overwriteable media which +contain an ISO 9660 filesystem. This emulation is learned from growisofs \-M +but adapted to the usage model of +.br +xorrecord \-msinfo +.br +xorrisofs \-C \-M | xorrecord \-waiti \-multi \- +.br +for sequential media. +.br +\-\-grow_overwriteable_iso does not hamper the use of true multi\-session media. +I.e. it is possible to use the same \fBxorrecord\fR options with both +kinds of media +and to achieve similar results if ISO 9660 filesystem images are to be written. +This option implies option \-isosize and therefore demands that the track +source is a ISO 9660 filesystem image. +.br +With overwriteable media and no option blank=fast|all present it expands an +eventual ISO 9660 filesystem on media. It is assumed that this image's inner +size description points to the end of the valuable data. +Overwriteable media with a recognizable ISO 9660 size will be regarded as +appendable rather than as blank. I.e. options \-msinfo and \-toc will work. +\-toc will always show a single session with its size increasing with +every added ISO 9660 image. +.TP +\fBstream_recording="on"|"off"|number\fR +Mode "on" requests that compliance to the desired speed setting is +preferred over management of write errors. With DVD\-RAM and BD this can +bring effective write speed near to the nominal write speed of the media. +But it will also disable the automatic use of replacement blocks +if write errors occur. It might as well be disliked or ignored by the drive. +.br +If a number is given, then error management stays enabled for all byte +addresses below that number. Any number below 16s is the same as "off". +.TP +\fBdvd_obs="default"|"32k"|"64k"\fR +Linux specific: +Set the number of bytes to be transmitted with each write operation to DVD +or BD media. Tracks get padded up to the next multiple of this write +size. A number of 64 KB may improve throughput with bus systems which +show latency problems. The default depends on media type, option +stream_recording=, and on compile time options. +.TP +\fBwrite_start_address=value\fR +Set the block address on overwritable media where to start writing the track. +With DVD+RW, DVD\-RAM or BD\-RE, byte_offset must be aligned to 2 kiB blocks, +but better is 32 kiB on DVD and 64 kiB on BD. +With formatted DVD\-RW 32 kiB alignment is mandatory. +.br +Other media are not suitable for this option. +.TP +\fBstdio_sync="on"|"off"|number\fR +Set the number of bytes after which to force output to emulated stdio: drives. +This forcing keeps the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +.SH EXAMPLES +.SS +.B Overview of examples: +Get an overview of drives and their addresses +.br +Get info about a particular drive or loaded media +.br +Prepare CD-RW or DVD-RW for re-use, BD-R for bad block handling +.br +Format DVD-RW to avoid need for blanking before re-use +.br +De-format DVD-RW to make it capable of multi-session again +.br +Write a single ISO 9660 filesystem image +.br +Write multiple ISO 9660 sessions +.br +Write ISO 9660 session on-the-fly +.br +Write compressed afio archive on-the-fly +.br +.SS +.B Get an overview of drives and their addresses: + $ xorrecord \-\-devices +.SS +.B Get info about a particular drive and loaded media: + $ xorrecord dev=/dev/sr0 \-atip \-toc \-\-grow_overwriteable_iso +.SS +.B Prepare CD-RW or DVD-RW for re-use: + $ xorrecord \-v dev=/dev/sr0 blank=as_needed \-eject +.SS +.B Format DVD-RW to avoid need for blanking before re-use: + $ xorrecord \-v dev=/dev/sr0 blank=format_overwrite \-eject +.br +This command may also be used to format BD\-R media before first use, +in order to enable handling of write errors. Several hundred MB of spare +blocks will be reserved and write runs on such media will perform +with less than half nominal speed. +.SS +.B De-format DVD-RW to make it capable of multi-session again: + $ xorrecord \-v dev=/dev/sr0 blank=deformat +.SS +.B Write a single ISO 9660 filesystem image: + $ xorrecord \-v dev=/dev/sr0 speed=12 fs=8m \\ + blank=as_needed \-eject padsize=300k my_image.iso +.SS +.B Write multiple ISO 9660 sessions: +This is possible with all media except minimally blanked DVD\-RW and DVD\-R DL, +which cannot do multi\-session. +.br +The first session is written like in the previous example, except that +option \-multi is used. It will contain the files of hard disk +directory ./tree1 under the ISO 9660 directory /dir1: +.br + $ xorrisofs \-o image_1.iso \-J \-graft\-points /dir1=./tree1 +.br + $ xorrecord \-v dev=/dev/sr0 speed=12 fs=8m \\ +.br + \-multi \-\-grow_overwritable_iso \\ +.br + blank=as_needed \-eject padsize=300k image_1.iso +.br +For the second session xorrisofs needs to know the \-msinfo numbers +of the medium. Further it will read data from the medium by using the +system's read\-only CD\-ROM driver. +.br +It is advised to load the tray manually +or via dd by the CD\-ROM driver, rather than letting xorrecord do this +by its own SCSI driver. Many system CD\-ROM drivers do not take notice +of xorrecord's activities. +.br + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +.br +Now get the \-msinfo numbers: +.br + $ m=$(xorrecord dev=/dev/sr0 \-msinfo) +.br +and use them with xorrisofs to add ./tree2 to the image as /dir2: +.br + $ xorrisofs \-M /dev/sr0 \-C $m \-o image_2.iso \\ +.br + \-J \-graft\-points /dir2=./tree2 +.br +Now burn the new session onto the same medium. This time without blanking: +.br + $ xorrecord \-v dev=/dev/sr0 speed=12 fs=8m \\ +.br + \-multi \-\-grow_overwritable_iso \\ +.br + \-eject padsize=300k image_2.iso +.br +Operating systems which mount this medium will read the superblock +of the second session and show both directories /dir1 and /dir2. +.SS +.B Write ISO 9660 session on-the-fly: +It is possible to combine the run of \fBxorrisofs\fR and \fBxorrecord\fR +in a pipeline without storing the ISO 9660 image as file on hard disk: +.br + $ xorrisofs \-M /dev/sr0 \-C $m \\ +.br + \-J \-graft\-points /dir2=./tree2 \\ +.br + | xorrecord \-v dev=/dev/sr0 speed=12 fs=8m \\ +.br + \-waiti \-multi \-\-grow_overwritable_iso \\ +.br + \-eject padsize=300k \- +.br +This is also the main use case of program \fBxorriso\fR itself, +where this run would look like: +.br + $ xorriso \-dev /dev/sr0 \-joliet on \-speed 12 \-fs 8m \\ +.br + \-map ./tree2 /dir2 \-commit_eject all +.SS +.B Write compressed afio archive on-the-fly: +This is possible with all media except minimally blanked DVD\-RW and DVD\-R DL. +Since the compressed output stream is of very variable speed, a larger fifo +is advised. Nevertheless, this example is not suitable for very old CD drives +which have no underrun protection and thus would abort the burn run on +temporary data shortage. +.br + $ find . | afio \-oZ \- | \\ +.br + xorrecord \-v dev=/dev/sr0 speed=12 fs=64m \\ +.br + \-multi padsize=300k \- +.br +afio archives do not contain references to absolute data block addresses. So +they need no special precautions for multi\-session. One may get the session +start addresses by option \-toc, and then use dd option skip= to begin reading +at one of those addresses. E.g. for listing its content: +.br + $ dd if=/dev/sr0 bs=2048 skip=64046 | afio \-tvZ \- +.br +afio will know when the end of the archive is reached. +.SH FILES +.SS +.B Startup files: +.br +If not \-\-no_rc is given as the first argument then \fBxorrecord\fR +attempts on startup to read and execute lines from the following files: +.br + /etc/default/xorriso +.br + /etc/opt/xorriso/rc +.br + /etc/xorriso/xorriso.conf +.br + $HOME/.xorrisorc +.br +The files are read in the sequence given here, but none of them is required +to exist. The lines are not interpreted as \fBxorrecord\fR options but +as generic \fBxorriso\fR commands. See man xorriso. +.SH SEE ALSO +.TP +For generic xorriso command mode +.BR xorriso(1) +.TP +Formatting track sources for xorrecord: +.BR xorrisofs(1), +.BR mkisofs(8), +.BR genisoimage(8), +.BR afio(1), +.BR star(1) +.TP +Other programs which burn sessions to optical media +.BR growisofs(1), +.BR cdrecord(1), +.BR wodim(1), +.BR cdrskin(1) +.SH BUGS +To report bugs, request help, or suggest enhancements for \fBxorriso\fR, +please send electronic mail to the public list <bug\-xorriso@gnu.org>. +If more privacy is desired, mail to <scdbackup@gmx.net>. +.br +Please describe what you expect \fBxorriso\fR to do, +the program arguments resp. commands by which you tried to achieve it, +the messages of \fBxorriso\fR, and the undesirable outcome of your +program run. +.br +Expect to get asked more questions before solutions can be proposed. +.SH AUTHOR +Thomas Schmitt <scdbackup@gmx.net> +.br +for libburnia\-project.org +.SH COPYRIGHT +Copyright (c) 2011 Thomas Schmitt +.br +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of xorriso. If you make use +of the license to derive modified versions of xorriso then you are entitled +to modify this text under that same license. +.SH CREDITS +\fBxorriso\fR is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Thanks to Andy Polyakov who invented emulated growing, +to Derek Foreman and Ben Jansens who once founded libburn. +.br +Compliments towards Joerg Schilling whose cdrtools served me for ten years. diff --git a/libisoburn/branches/1.1.8/xorriso/xorrecord.info b/libisoburn/branches/1.1.8/xorriso/xorrecord.info new file mode 100644 index 00000000..fadcd017 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrecord.info @@ -0,0 +1,928 @@ +This is xorrecord.info, produced by makeinfo version 4.8 from +./xorrecord.texi. + +INFO-DIR-SECTION Archiving +START-INFO-DIR-ENTRY +* Xorrecord: (xorrecord). Emulates CD/DVD/BD program cdrecord +END-INFO-DIR-ENTRY + xorrecord - Emulation of CD/DVD/BD program cdrecord by program +xorriso + + Copyright (C) 2011 - 2011 Thomas Schmitt + + Permission is granted to distrubute this text freely. + + +File: xorrecord.info, Node: Top, Next: Overview, Up: (dir) + +xorrecord 1.1.7 +*************** + +xorrecord - Emulation of CD/DVD/BD program cdrecord by program xorriso + +* Menu: + +* Overview:: Overview +* Standards:: MMC, Session, Track, Media types +* Drive:: Drive preparation and addressing +* Xorriso:: Relation to program xorriso +* Options:: Options +* Examples:: Examples +* Files:: Files +* Seealso:: See also +* Bugreport:: Reporting bugs +* Legal:: Author, Copyright, Credits +* CommandIdx:: Alphabetic Command List +* ConceptIdx:: Alphabetic List of Concepts and Objects + + +File: xorrecord.info, Node: Overview, Next: Standards, Prev: Top, Up: Top + +1 Overview +********** + +`xorrecord' writes preformatted data to CD, DVD, and BD media. + +It understands some options of program cdrecord from cdrtools by Joerg +Schilling. Its implementation is part of program xorriso which shares +no source code with cdrtools, but rather makes use of libburn for +communicating with the drive. + +Another, more complete cdrecord emulator is program *cdrskin* which +uses the same burn functions as *xorrecord*. + + +File: xorrecord.info, Node: Standards, Next: Drive, Prev: Overview, Up: Top + +2 MMC, Session, Track, Media types +********************************** + +*MMC* is a standard out of the SCSI family which defines the +interaction between computers and optical drives. Since more than a +decade all CD, DVD, or BD recorders obey this standard regardless by +what bus cabling they are attached to the computer. libburn relies on +this standard compliance and on the capability of the operating system +to perform SCSI transactions over the particular bus cabling. +A *Session* is a data region on an optical disc which usually gets +written in a single sweep. It contains at least one *Track* which is a +contiguous string of readable blocks. `xorrecord' produces a single +session with a single data track which consists of blocks with 2048 +bytes each. It chooses the write mode automatically according to media +type, medium state, and option -multi. +On CD media there are other track types, like audio, and particular +write modes like TAO and SAO. CD and DVD- media can put more than one +track into a session. Some of these features can be addressed by +program *cdrskin*. + +MMC describes several recordable *media types* which roughly form two +families. +*Sequentially recordable media* are CD-R, CD-RW, DVD-R, DVD-R DL, +DVD-RW, DVD+R, DVD+R DL, BD-R. Except DVD-R DL they can store more +than one session if there is still unwritten space and if the previous +session was written with option *-multi*. CD-RW and DVD-RW can be +blanked in order to be re-usable from scratch. +*Overwritable media* are DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE. +They offer a single session with a single track for random access +writing. There is no need to blank overwritable media before re-use. +DVD-RW media are sold in sequentially recordable state but can be +formatted once to become overwritable. See options +*blank=format_overwrite* and *blank=deformat*. +If ISO 9660 filesystems are to be stored on overwritable media, then it +is possible to emulate multiple sessions, by using option +*-grow_overriteable_iso*. In this case, the need for blanking before +re-use is emulated too. + + +File: xorrecord.info, Node: Drive, Next: Xorriso, Prev: Standards, Up: Top + +3 Drive preparation and addressing +********************************** + +The drives, CD, DVD, or BD burners, are accessed via file addresses +which are specific to libburn and the operating system. Those addresses +get listed by a run of `xorrecord --devices' or `xorriso -device_links'. +On GNU/Linux and FreeBSD, the user needs rw-permission for the device +file. On Solaris, the user needs r-permission and privilege +"sys_devices", which is usually gained by running `xorrecord' via +command pfexec. +These permissions resp. privileges are needed already for listing a +drive. So it might be necessary to get the overview as superuser resp. +via pfexec. +`xorrecord' does not perform cdrecord option -scanbus and does not +accept the addresses of form Bus,Target,Lun which are told by -scanbus. +If support for these addresses is necessary, consider to use program +cdrskin. + +It is possible to let `xorrecord' work on emulated drives. Their +addresses begin by prefix "stdio:" followed by a file address. The +emulated media behavior depends on the file type. See man xorriso for +details. +If standard output is chosen as emulated drive, then all program result +texts, which usually appear on standard output, will get redirected to +standard error. + + +File: xorrecord.info, Node: Xorriso, Next: Options, Prev: Drive, Up: Top + +4 Relation to program xorriso +***************************** + +`xorrecord' is actually a command mode of program *xorriso*, which gets +entered either by xorriso command "-as cdrecord" or by starting the +program by one of the names "xorrecord", "cdrecord", "wodim", or +"cdrskin". +This command mode can be left by argument "--" which leads to generic +xorriso command mode. See *man xorriso* for its description. Other +than in xorriso command mode, the sequence of the cdrecord emulation +options does not matter. All pending actions get performed in a fixed +sequence before the program run ends resp. before cdrecord emulation +ends. + + +File: xorrecord.info, Node: Options, Next: Examples, Prev: Xorriso, Up: Top + +5 Options +********* + +* Menu: + +* DriveAddr:: Drive addressing +* Inquire:: Inquiring drive and media +* SetBurn:: Settings for the burn run +* Verbous:: Program version and verbosity +* NonCdrecord:: Options not compatible to cdrecord + + +File: xorrecord.info, Node: DriveAddr, Next: Inquire, Prev: Options, Up: Options + +5.1 Addressing the drive +======================== + + +--devices + Print the list of accessible CD, DVD, or BD drives to standard + output. Drives might be inaccessible if the user lacks of + permissions to use them or if the drive is in use by another + program. + Each accessible drive is shown by a line like: + 0 -dev '/dev/sr0' rwrw- : 'TSSTcorp' 'CDDVDW SH-S203B' + The libburn address of this drive is '/dev/sr0'. 'TSSTcorp' is the + name of the vendor (in this case: Toshiba Samsung Storage + Technologies Corporation), 'CDDVDW SH-S203B' is the model name (in + this case: a DVD burner). + +dev=drive_address + Set the libburn address of the drive to be used. + E.g. on GNU/Linux: dev=/dev/sr0 + E.g. on FreeBSD: dev=/dev/cd0 + E.g. on Solaris: dev=/dev/rdsk/c2t2d0s2 + See also above "Drive preparation and addressing". + The medium in the drive should not be mounted or be otherwise in + use. + + +File: xorrecord.info, Node: Inquire, Next: SetBurn, Prev: DriveAddr, Up: Options + +5.2 Inquiring drive and media +============================= + + +-inq + Print to standard output: vendor, model name, and firmware revision + of the drive. + +-checkdrive + Print unconditionally that the drive supports burnfree, SAO, and + TAO. Also print the output of option -inq. + +-atip + Print the output of -checkdrive, the most capable profile of the + medium in the drive, the list of profiles which are supported by + the drive, whether it is erasable (i.e. can be blanked), the media + manufacturer, and the medium product name. + Profiles are usage models, which are often tied to a particular + media type (e.g. CD-RW), but may also apply to a family of media. + E.g. profile CD-ROM applies to all CD media which contain data. + +-toc + Print a table of content of the medium in the drive. The output is + not compatible to cdrecord option -toc, but rather the one of + `xorriso' command -toc. It lists the address, vendor, model name, + and firmware revision of the drive. + About the medium it tells product name and manufacturer, whether + there is already content written, and if so, whether the medium is + closed or appendable. Appendable media can take another session. + The amount of readable and writable data is told. If there are + sessions, then their start block address and size is reported. If + a session contains an ISO 9660 filesystem, then its Volume Id is + reported. If the medium is writable, then the next writable block + address is reported. + If not option *-grow_overriteable_iso* is given or no ISO 9660 + file system is present on the medium, then overwritable media are + reported as being blank. This is due to the fact that they can be + written from scratch without further preparation, and that MMC + does not distinguish between data written by the most previous + burn run and older data which have not been overwritten by that + burn run. Consequently, these media are reported with 0 readable + blocks, although all their writable blocks normally are readable, + too. + +-msinfo + Print the argument text for option -C of programs mkisofs, + genisoimage, or xorrisofs. It consists of two numbers separated by + a comma. + The first number tells the first block of the first track of the + last recorded session. This is also the address used by default + when operating systems mount a medium with e.g. ISO 9660 + filesystem. + The second number tells the next writable address, where + `xorrecord' will begin to write the next session. + This option is only valid for written, appendable media. In all + other cases it will yield no output text but will abort the program + with non-zero exit value. + + +File: xorrecord.info, Node: SetBurn, Next: Verbous, Prev: Inquire, Up: Options + +5.3 Settings for the burn run +============================= + + A burn run requires exactly one track source address argument, + which tells from where to read the data wich shall be put into the + upcomming session. The medium state must be either blank or + appendable. + Track source may be "-" for standard input or the address of a + readable file of any type except directories. Nearly all media + types accept a track source with unpredictable byte count, like + standard input or named pipes. Nevertheless, DVD-R DL and DVD-RW + blanked by mode deformat_quickest demand exact in-advance + reservation of the track size, so that they either need to be read + from a source of predictable length, or need to be accompanied by + option *tsize=* or by option *-isosize*. + Several options expect a size value as argument. A number with a + trailing letter "b" or without a trailing letter is a plain byte + count. Other trailing letters cause multiplication of the given + number by a scaling factor: + "k" or "K" = 1024 , "m" or "M" = 1024k , "g" or "G" = 1024m , "s" + or "S" = 2048 + E.g. tsize=234567s means a size of 234567 * 2048 = 480393216 bytes. + +blank=mode + Blank a CD-RW or DVD-RW to make it re-usable from scratch. Format + a DVD-RW, DVD+RW, DVD-RAM, BD-R, or BD-RE if not yet formatted. + This operation normally makes any recorded data on the medium + unreadable. It is combinable with burning in the same run of + `xorrecord', or it may be performed without a track source, + leaving the medium empty. + The mode given with blank= selects the particular behavior: + + as_needed + Try to make the media ready for writing from scratch. If it needs + formatting, then format it. If it is not blank, then try to apply + blank=fast. It is a reason to abort if the mediium cannot assume + thoroughly writeable state, e.g. if it is a non-blank write-once. + This leaves unformatted DVD-RW in unformatted blank state. To + format DVD-RW use blank=format_overwrite. Blank unformatted BD-R + stay unformatted. + (Note: blank=as_needed is not an original cdrecord option.) + + all + Blank an entire CD-RW or an unformatted DVD-RW. + + fast + Minimally blank an entire CD-RW or blank an unformatted DVD-RW. + + deformat + Like blank=all but with the additional ability to blank + overwriteable DVD-RW. This will destroy their formatting and make + them sequentially recordable. + (Note: blank=deformat is not an original cdrecord options) + + deformat_quickest + Like blank=deformat but blanking DVD-RW only minimally. This is + faster than full blanking but yields media incapable of writing + tracks of unpredicatable size. Multi-session will not be possible + either. + (Note: blank=deformat_quickest is not an original cdrecord option.) + + format_overwrite + Format a DVD-RW to "Restricted Overwrite". The user should bring + some patience. + Format unformatted DVD+RW, BD-RE or blank BD-R to their default + size. It is not mandatory to do this with DVD+RW and BD-RE media, + because they will get formatted automatically on the first write + attempt. + BD-R media may be written in unformatted state. This keeps + disabled the replacement of bad blocks and enables full nominal + write speed. Once BD-R media are written, they cannot be formatted + any more. + For re-formatting already formatted media or for formatting with + non-default size, use program *xorriso* with command *-format*. + (Note: blank=format_overwrite is not an original cdrecord options) + +-multi + This option keeps CD, unformatted DVD-R[W], DVD+R, or BD-R + appendable after the current session has been written. Without it + the disc gets closed and may not be written any more - unless it + is a -RW and gets blanked, which causes loss of its content. + This option cannot be applied to DVD-R DL and DVD-RW which were + blanked by type deformat_quickest. + In order to have all filesystem content accessible, the eventual + ISO-9660 filesystem of a follow-up session needs to be prepared in + a special way by the filesystem formatter program. mkisofs, + genisoimage, and xorrisofs expect particular info about the + situation which can be retrieved by `xorrecord' option -msinfo. + With overwriteable DVD or BD media, -multi cannot mark the end of + the session. So when adding a new session, this end has to be + determined from the payload. Currently only ISO-9660 filesystems + can be used that way. See option *-grow_overwriteable_iso*. + +-dummy + Try to perform the drive operations without actually affecting the + inserted media. There is no warranty that this will work with a + particular combination of drive and media. Blanking is prevented + reliably, though. To avoid inadverted real burning, -dummy + refuses burn runs on anything but CD-R[W], DVD-R[W], or emulated + stdio-drives. + +-waiti + Wait until input data is available at stdin or EOF occurs at stdin. + Only then begin to access any drives. + One should use this if xorrisofs is working at the end of a pipe + where the feeder process reads from the drive before it starts + writing its output into xorrisofs. Example: + xorrisofs ... -C 0,12800 -M /dev/sr0 ... | \ + xorrecord dev=/dev/sr0 ... -waiti - + This option works even if standard input is not the track source. + If no process is piping in, then the Enter key of your terminal + will act as trigger for `xorrecord'. Note that this input line + will not be consumed by cdrskin if standard input is not the track + source. It will end up as shell command, usually. + +tsize=size + Announce the exact size of the track source. This is necessary with + DVD-R DL media and with quickest blanked DVD-RW, if the size + cannot be determined in advance from the track source. E.g. if it + is standard input or a named pipe. + If the track source does not deliver the predicted amount of + bytes, the remainder of the track is padded with zeros. This is + not considered an error. If on the other hand the track source + delivers more than the announced bytes then the track on media + gets truncated to the predicted size and xorrecord exits with + non-zero value. + +-isosize + Try to obtain the track size from the content of the track source. + This works only if the track source bears an ISO 9660 filesystem. + Any other track source content will cause the burn run to abort. + If the track source is not a regular file or block device, then + this option will work only if the program's fifo size is at least + 64k. See option fs=. + +padsize=size + Add the given amount of trailing zeros to the upcomming track. + This feature can be disabled by size 0. Default is 300 kB in order + to work around a problem with GNU/Linux which often fails to read + the last few blocks of a CD track which was written in write mode + TAO. TAO is used by `xorrecord' if the track size cannot be + predicted or if the CD medium is not blank but appendable. + +-nopad + The same as padsize=0. + +-pad + The same as padsize=15s. This was once sufficient with older + GNU/Linux kernels. Meanwhile one should at least use padsize=128k, + if not padsize=300k. + +-data + Explicitely announce that the track source shall be recorded as + data track, and not as audio track. This option has no effect with + `xorrecord', because there is no support for other track formats + anyway. + +fs=size + Set the size of the program fifo buffer to the given value rather + than the default of 4m. + The fifo buffers a temporary surplus of track source data in order + to provide the drive with a steady stream during times of + temporary lack of track source supply. + Other than cdrecord, xorrecord enables drive buffer underrun + protection by default and does not wait with writing until the + fifo is full for a first time. On very old CD drives and slow + computers, this might cause aborted burn runs. In this case, + consider to use program *cdrskin* for CD burning. DVD and BD + drives tolerate buffer underrun without problems. + The larger the fifo, the longer periods of poor source supply can + be compensated. But a large fifo can deprive the operating system + of read cache for better filesystem performance. + +speed=value + Set the write speed. Default is 0 = maximum speed. Speed can be + given in media type dependent x-speed numbers or as a desired + throughput per second in MMC compliant kB (= 1000) or MB (= 1000 + kB). Media x-speed factor can be set explicity by appending "c" + for CD, "d" for DVD, "b" for BD. "x" is optional. + Example speeds: + 706k = 706kB/s = 4c = 4xCD + 5540k = 5540kB/s = 4d = 4xDVD + If there is no hint about the speed unit attached, then the medium + in the drive will decide. Default unit is CD, 1x = 176,400 raw + bytes/second. With DVD, 1x = 1,385,000 bytes/second. With BD, 1x + = 4,495,625 bytes/second. + MMC drives usually activate their own idea of speed and take the + speed value given by the burn program only as a hint for their own + decision. + +-eject + Eject the drive tray after alll other work is done. + + +File: xorrecord.info, Node: Verbous, Next: NonCdrecord, Prev: SetBurn, Up: Options + +5.4 Program version and verbosity +================================= + + +-version + Print to standard output a line beginning by + "Cdrecord 2.01-Emulation Copyright" + and further lines which report the version of xorriso and its + supporting libraries. They also state the license under which the + program is provided, and disclaim any warranty, to the extent + permitted by law. + +-v + Increase program verbosity by one level. There are four verbosity + levels from nearly silent to debugging verbosity. The both highest + levels can be enabled by repeated -v or by -vv resp. -vvv. + +-V + Log SCSI commands and drive replies to standard error. This might + be of interest if *xorrecord* and a particular drive or medium do + not cooperate as expected, or if you just want to know how libburn + interacts with the drive. To understand this extremely verbous + log, one needs to read SCSI specs SPC, SBC, and MMC. + Please do not add such a log to a bug report on the first hand, + unless you want to point out a particular deviation from said + specs, or if you get asked for this log by a maintainer of + `xorrecord' who feels in charge for your bug report. + +-help + Print a sparse list of program options to standard error and + declare not to be cdrecord. + + +File: xorrecord.info, Node: NonCdrecord, Next: ExDevices, Prev: Verbous, Up: Options + +5.5 Options not compatible to cdrecord +====================================== + + +--no_rc + Only if used as first command line argument this option prevents + reading and interpretation of startup files. See section FILES + below. + +--grow_overwriteable_iso + Enable emulation of multi-session writing on overwriteable media + which contain an ISO 9660 filesystem. This emulation is learned + from growisofs -M but adapted to the usage model of + xorrecord -msinfo + xorrisofs -C -M | xorrecord -waiti -multi - + for sequential media. + -grow_overwriteable_iso does not hamper the use of true + multi-session media. I.e. it is possible to use the same + `xorrecord' options with both kinds of media and to achieve + similar results if ISO 9660 filesystem images are to be written. + This option implies option -isosize and therefore demands that the + track source is a ISO 9660 filesystem image. + With overwriteable media and no option blank=fast|all present it + expands an eventual ISO 9660 filesystem on media. It is assumed + that this image's inner size description points to the end of the + valuable data. Overwriteable media with a recognizable ISO 9660 + size will be regarded as appendable rather than as blank. I.e. + options -msinfo and -toc will work. -toc will always show a + single session with its size increasing with every added ISO 9660 + image. + +stream_recording="on"|"off"|number + Mode "on" requests that compliance to the desired speed setting is + preferred over management of write errors. With DVD-RAM and BD + this can bring effective write speed near to the nominal write + speed of the media. But it will also disable the automatic use of + replacement blocks if write errors occur. It might as well be + disliked or ignored by the drive. + If a number is given, then error management stays enabled for all + byte addresses below that number. Any number below 16s is the same + as "off". + +dvd_obs="default"|"32k"|"64k" + Linux specific: Set the number of bytes to be transmitted with + each write operation to DVD or BD media. Tracks get padded up to + the next multiple of this write size. A number of 64 KB may + improve throughput with bus systems which show latency problems. + The default depends on media type, option stream_recording=, and + on compile time options. + +write_start_address=value + Set the block address on overwritable media where to start writing + the track. With DVD+RW, DVD-RAM or BD-RE, byte_offset must be + aligned to 2 kiB blocks, but better is 32 kiB on DVD and 64 kiB on + BD. With formatted DVD-RW 32 kiB alignment is mandatory. + Other media are not suitable for this option. + +stdio_sync="on"|"off"|number + Set the number of bytes after which to force output to emulated + stdio: drives. This forcing keeps the memory from being clogged + with lots of pending data for slow devices. Default "on" is the + same as "16m". Forced output can be disabled by "off". + + +File: xorrecord.info, Node: Examples, Next: Files, Prev: Options, Up: Top + +6 Examples +********** + +* Menu: + +* ExDevices:: Get an overview of drives and their addresses +* ExMedium:: Get info about a particular drive or loaded media +* ExBlank:: Prepare CD-RW or DVD-RW for re-use +* ExFormat:: Format DVD-RW to avoid need for blanking before re-use +* ExDeformat:: De-format DVD-RW to make it capable of multi-session again +* ExIsoSingle:: Write a single ISO 9660 filesystem image +* ExIsoMulti:: Write multiple ISO 9660 sessions +* ExIsoFly:: Write ISO 9660 session on-the-fly +* ExAfio:: Write compressed afio archive on-the-fly + + +File: xorrecord.info, Node: ExDevices, Next: ExMedium, Prev: NonCdrecord, Up: Examples + +6.1 Get an overview of drives and their addresses +================================================= + + +$ xorrecord -devices + + +File: xorrecord.info, Node: ExMedium, Next: ExBlank, Prev: ExDevices, Up: Examples + +6.2 Get info about a particular drive and loaded media +====================================================== + + +$ xorrecord dev=/dev/sr0 -atip -toc -grow_overwriteable_iso + + +File: xorrecord.info, Node: ExBlank, Next: ExFormat, Prev: ExMedium, Up: Examples + +6.3 Prepare CD-RW or DVD-RW for re-use +====================================== + + +$ xorrecord -v dev=/dev/sr0 blank=as_needed -eject + + +File: xorrecord.info, Node: ExFormat, Next: ExDeformat, Prev: ExBlank, Up: Examples + +6.4 Format DVD-RW to avoid need for blanking before re-use +========================================================== + + +$ xorrecord -v dev=/dev/sr0 blank=format_overwrite -eject + +This command may also be used to format BD-R media before first use, in +order to enable handling of write errors. Several hundred MB of spare +blocks will be reserved and write runs on such media will perform with +less than half nominal speed. + + +File: xorrecord.info, Node: ExDeformat, Next: ExIsoSingle, Prev: ExFormat, Up: Examples + +6.5 De-format DVD-RW to make it capable of multi-session again +============================================================== + + +$ xorrecord -v dev=/dev/sr0 blank=deformat + + +File: xorrecord.info, Node: ExIsoSingle, Next: ExIsoMulti, Prev: ExDeformat, Up: Examples + +6.6 Write a single ISO 9660 filesystem image +============================================ + + +$ xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +blank=as_needed -eject padsize=300k my_image.iso + + +File: xorrecord.info, Node: ExIsoMulti, Next: ExIsoFly, Prev: ExIsoSingle, Up: Examples + +6.7 Write multiple ISO 9660 sessions +==================================== + +This is possible with all media except minimally blanked DVD-RW and +DVD-R DL, which cannot do multi-session. +The first session is written like in the previous example, except that +option -multi is used. It will contain the files of hard disk directory +./tree1 under the ISO 9660 directory /dir1: + +$ xorrisofs -o image_1.iso -J -graft-points /dir1=./tree1 +$ xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +-multi -grow_overwritable_iso \ +blank=as_needed -eject padsize=300k image_1.iso + +For the second session xorrisofs needs to know the -msinfo numbers of +the medium. Further it will read data from the medium by using the +system's read-only CD-ROM driver. +It is advised to load the tray manually or via dd by the CD-ROM driver, +rather than letting xorrecord do this by its own SCSI driver. Many +system CD-ROM drivers do not take notice of xorrecord's activities. + +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +Now get the -msinfo numbers: +$ m=$(xorrecord dev=/dev/sr0 -msinfo) + +and use them with xorrisofs to add ./tree2 to the image as /dir2: + +$ xorrisofs -M /dev/sr0 -C $m -o image_2.iso \ +-J -graft-points /dir2=./tree2 + +Now burn the new session onto the same medium. This time without +blanking: + +$ xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +-multi -grow_overwritable_iso \ +-eject padsize=300k image_2.iso + +Operating systems which mount this medium will read the superblock of +the second session and show both directories /dir1 and /dir2. + + +File: xorrecord.info, Node: ExIsoFly, Next: ExAfio, Prev: ExIsoMulti, Up: Examples + +6.8 Write ISO 9660 session on-the-fly +===================================== + +It is possible to combine the run of *xorrisofs* and `xorrecord' in a +pipeline without storing the ISO 9660 image as file on hard disk: + +$ xorrisofs -M /dev/sr0 -C $m \ +-J -graft-points /dir2=./tree2 \ +| xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +-waiti -multi -grow_overwritable_iso \ +-eject padsize=300k - + +This is also the main use case of program *xorriso* itself, where this +run would look like: + +$ xorriso -dev /dev/sr0 -joliet on -speed 12 -fs 8m \ +-map ./tree2 /dir2 -commit_eject all + + +File: xorrecord.info, Node: ExAfio, Prev: ExIsoFly, Up: Examples + +6.9 Write compressed afio archive on-the-fly +============================================ + +This is possible with all media except minimally blanked DVD-RW and +DVD-R DL. Since the compressed output stream is of very variable +speed, a larger fifo is advised. Nevertheless, this example is not +suitable for very old CD drives which have no underrun protection and +thus would abort the burn run on temporary data shortage. + +$ find . | afio -oZ - | \ +xorrecord -v dev=/dev/sr0 speed=12 fs=64m \ +-multi padsize=300k - + +afio archives do not contain references to absolute data block +addresses. So they need no special precautions for multi-session. One +may get the session start addresses by option -toc, and then use dd +option skip= to begin reading at one of those addresses. E.g. for +listing its content: + +$ dd if=/dev/sr0 bs=2048 skip=64046 | afio -tvZ - + +afio will know when the end of the archive is reached. + + +File: xorrecord.info, Node: Files, Next: Seealso, Prev: Examples, Up: Top + +7 Files +******* + +7.1 Startup Files +================= + +If not -no_rc is given as the first argument then `xorrecord' attempts +on startup to read and execute lines from the following files: + +/etc/default/xorriso +/etc/opt/xorriso/rc +/etc/xorriso/xorriso.conf +$HOME/.xorrisorc + +The files are read in the sequence given here, but none of them is +required to exist. The lines are not interpreted as `xorrecord' options +but as generic *xorriso* commands. See man xorriso. + + +File: xorrecord.info, Node: Seealso, Next: Bugreport, Prev: Files, Up: Top + +8 See also +********** + +For generic xorriso command mode + xorriso(1) + +Formatting track sources for xorrecord + xorrisofs(1), mkisofs(8), genisoimage(8), afio(1), star(1) + +Other programs which burn sessions to optical media + growisofs(1), cdrecord(1), wodim(1), cdrskin(1) + + +File: xorrecord.info, Node: Bugreport, Next: Legal, Prev: Seealso, Up: Top + +9 Reporting bugs +**************** + +To report bugs, request help, or suggest enhancements for `xorriso', +please send electronic mail to the public list <bug-xorriso@gnu.org>. +If more privacy is desired, mail to <scdbackup@gmx.net>. + +Please describe what you expect `xorriso' to do, the program arguments +resp. commands by which you tried to achieve it, the messages of +`xorriso', and the undesirable outcome of your program run. + +Expect to get asked more questions before solutions can be proposed. + + +File: xorrecord.info, Node: Legal, Next: CommandIdx, Prev: Bugreport, Up: Top + +10 Author, Copyright, Credits +***************************** + +10.1 Author +=========== + +Thomas Schmitt <scdbackup@gmx.net> +for libburnia-project.org + +10.2 Copyright +============== + +Copyright (c) 2011 Thomas Schmitt +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of xorriso. If you make +use of the license to derive modified versions of xorriso then you are +entitled to modify this text under that same license. + +10.3 Credits +============ + +`xorriso' is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Thanks to Andy Polyakov who invented emulated growing, to Derek Foreman +and Ben Jansens who once founded libburn. +Compliments towards Joerg Schilling whose cdrtools served me for ten +years. + + +File: xorrecord.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top + +11 Alphabetic Command List +************************** + +�[index�] +* Menu: + +* --devices get list of drives: DriveAddr. (line 8) +* --grow_overwriteable_iso emulate ISO 9660 multi-session: NonCdrecord. + (line 13) +* --no_rc do not execute xorriso startup files: NonCdrecord. + (line 8) +* -atip inquire medium state: Inquire. (line 16) +* -checkdrive inquire drive CD capabilities: Inquire. (line 12) +* -data explicitely announce a data track: SetBurn. (line 155) +* -dummy control write simulation: SetBurn. (line 97) +* -eject finally eject drive tray: SetBurn. (line 194) +* -help print sparse overview of options: Verbous. (line 32) +* -inq inquire drive identifiers: Inquire. (line 8) +* -isosize obtain track size from ISO 9660 superblock: SetBurn. + (line 131) +* -msinfo retrieve multi-session info: Inquire. (line 48) +* -multi keep media appendable after burn run: SetBurn. (line 80) +* -nopad disable adding of bytes to end of track: SetBurn. (line 147) +* -pad add 15 blocks to end of track: SetBurn. (line 150) +* -toc inquire medium content: Inquire. (line 25) +* -v increase program verbosity: Verbous. (line 16) +* -V log SCSI command transactions to stderr: Verbous. (line 21) +* -version report emulation and xorriso version: Verbous. (line 8) +* -waiti access drive only after stdin delivers data: SetBurn. + (line 105) +* blank= make media re-usabable or format media: SetBurn. (line 27) +* dev= address the drive to be used: DriveAddr. (line 20) +* dvd_obs= set write transaction payload size: NonCdrecord. (line 46) +* fs= set program fifo size: SetBurn. (line 161) +* padsize= add bytes to end of track: SetBurn. (line 139) +* speed= set write speed: SetBurn. (line 177) +* stdio_sync= control stdio buffer: NonCdrecord. (line 61) +* stream_recording= try to get full speed on DVD-RAM, BD: NonCdrecord. + (line 35) +* tsize= set a fixed track size: SetBurn. (line 119) +* write_start_address= set block address for write start: NonCdrecord. + (line 54) + + +File: xorrecord.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top + +12 Alphabetic List of Concepts and Objects +****************************************** + +�[index�] +* Menu: + +* Accessing drive, wait for stdin, -waiti: SetBurn. (line 105) +* Bugs, reporting: Bugreport. (line 6) +* Data track, announce, -data: SetBurn. (line 155) +* Defect management, control, stream_recording=: NonCdrecord. (line 35) +* Drive, address, dev=: DriveAddr. (line 20) +* Drive, get list of, --devices: DriveAddr. (line 8) +* Drive, inquire CD capabilities, -checkdrive: Inquire. (line 12) +* Drive, inquire identifiers, -inq: Inquire. (line 8) +* Eject, the tray, -eject: SetBurn. (line 194) +* Examples: Examples. (line 6) +* Fifo, set size, fs=: SetBurn. (line 161) +* Full speed, on DVD-RAM and BD, stream_recording=: NonCdrecord. + (line 35) +* Media types, _definiton: Standards. (line 23) +* Media, blank, blank=: SetBurn. (line 27) +* Media, format, blank=: SetBurn. (line 27) +* Media, keep appendable, -multi: SetBurn. (line 80) +* Media, make re-usable, blank=: SetBurn. (line 27) +* medium content, inquire, -toc: Inquire. (line 25) +* medium state, inquire, -atip: Inquire. (line 16) +* MMC, _definiton: Standards. (line 6) +* multi-session info, retrieve, -msinfo: Inquire. (line 48) +* Multi-session, emulate ISO 9660, --grow_overwriteable_iso: NonCdrecord. + (line 13) +* Options, overview, -help: Verbous. (line 32) +* Overwritable media, _definiton: Standards. (line 30) +* Padding, at end of track, padsize=: SetBurn. (line 139) +* Padding, disable, -nopad: SetBurn. (line 147) +* Padding, insufficient old, -pad: SetBurn. (line 150) +* Problems, reporting: Bugreport. (line 6) +* SCSI commands, log, -V: Verbous. (line 21) +* Sequentially recordable media, _definiton: Standards. (line 25) +* Session, _definiton: Standards. (line 12) +* Speed, set for writing, speed=: SetBurn. (line 177) +* Startup files, do not execute, --no_rc: NonCdrecord. (line 8) +* Track size, obtain from ISO 9660, -isosize: SetBurn. (line 131) +* Track size, set fixed, tsize=: SetBurn. (line 119) +* Track, _definiton: Standards. (line 13) +* Transaction size, set, dvd_obs=: NonCdrecord. (line 46) +* Tray, eject, -eject: SetBurn. (line 194) +* Verbosity, increase, -v: Verbous. (line 16) +* Verbosity, SCSI commands, -V: Verbous. (line 21) +* Version, report, -version: Verbous. (line 8) +* Write simulation , control, -dummy: SetBurn. (line 97) +* Write start address, set, write_start_address=: NonCdrecord. + (line 54) +* Write, buffer syncing, stdio_sync=: NonCdrecord. (line 61) +* xorriso, mkisofs emulation: Xorriso. (line 6) +* xorriso, options: Options. (line 6) + + + +Tag Table: +Node: Top401 +Node: Overview1111 +Node: Standards1632 +Node: Drive3783 +Node: Xorriso5107 +Node: Options5818 +Node: DriveAddr6186 +Node: Inquire7227 +Node: SetBurn10096 +Node: Verbous19614 +Node: NonCdrecord21024 +Node: Examples24190 +Node: ExDevices24851 +Node: ExMedium25069 +Node: ExBlank25332 +Node: ExFormat25553 +Node: ExDeformat26067 +Node: ExIsoSingle26334 +Node: ExIsoMulti26618 +Node: ExIsoFly28222 +Node: ExAfio28884 +Node: Files29865 +Node: Seealso30412 +Node: Bugreport30777 +Node: Legal31358 +Node: CommandIdx32278 +Node: ConceptIdx35045 + +End Tag Table diff --git a/libisoburn/branches/1.1.8/xorriso/xorrecord.texi b/libisoburn/branches/1.1.8/xorriso/xorrecord.texi new file mode 100644 index 00000000..a96a661e --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrecord.texi @@ -0,0 +1,1048 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename xorrecord.info +@settitle GNU xorrecord 1.1.7 +@c %**end of header +@c +@c man-ignore-lines begin +@dircategory Archiving +@direntry +* Xorrecord: (xorrecord). Emulates CD/DVD/BD program cdrecord +@end direntry +@c man-ignore-lines end +@c +@c Notes about embedded man page: +@c This texinfo code contains the necessary info to produce a man page +@c which resembles much the version of xorriso.1 from which this code +@c was originally derived in march 2010. +@c One can produce the man page by applying the following rules: +@c The first line gets discarded. +@c Line start "@c man " will become "", the remainder is put out unaltered. +@c Lines "@*" will be converted to ".br" +@c "@c man-ignore-lines N" will discard N following lines. +@c "@c man-ignore-lines begin" discards all following lines +@c up to "@c man-ignore-lines end". +@c Line blocks of "@menu" "@end menu" will be discarded. +@c "@item word words" becomes "\fBword\fR words". +@c @b{...}, @command{...}, @dfn{...}, @emph{...}, @strong{...} +@c get mapped to \fB...\fR . +@c @abbr{...}, @code{...}, @file{...}, @i{...}, @option{...}, @r{...}, +@c @ref{...}, @samp{...},@var{...}, get mapped to ... . +@c @ref{...}, @xref{...} get mapped to empty text. +@c @email{...} gets mapped to <...> . +@c Mapped {...} content is subject to the rules except {...} mapping. +@c @minus{} will become "-". +@c @@ , @{, @} will get stripped of their first @. +@c Other lines which begin by "@" will be discarded. +@c In lines not stemming from "@c man", "\" becomes "\\" +@c "-" which are not preceded by an uneven number of "\" will get +@c prepended one "\". +@c +@c +@c man .\" Hey, EMACS: -*- nroff -*- +@c man .\" +@c man .\" IMPORTANT NOTE: +@c man .\" +@c man .\" The original of this file is kept in xorriso/xorrecord.texi +@c man .\" This here was generated by program xorriso/make_xorriso_1 +@c man .\" +@c man .\" +@c man .\" First parameter, NAME, should be all caps +@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +@c man .\" other parameters are allowed: see man(7), man(1) +@c man .TH XORRECORD 1 "Version 1.1.7, Oct 24, 2011" +@c man .\" Please adjust this date whenever revising the manpage. +@c man .\" +@c man .\" Some roff macros, for reference: +@c man .\" .nh disable hyphenation +@c man .\" .hy enable hyphenation +@c man .\" .ad l left justify +@c man .\" .ad b justify to both left and right margins +@c man .\" .nf disable filling +@c man .\" .fi enable filling +@c man .\" .br insert line break +@c man .\" .sp <n> insert n+1 empty lines +@c man .\" for manpage-specific macros, see man(7) +@c man .nh +@c man-ignore-lines begin +@copying +xorrecord - Emulation of CD/DVD/BD program cdrecord by program xorriso + +Copyright @copyright{} 2011 - 2011 Thomas Schmitt + +@quotation +Permission is granted to distrubute this text freely. +@end quotation +@end copying +@c man-ignore-lines end +@titlepage +@title Manual of GNU xorriso personality xorrecord 1.1.7 +@author Thomas Schmitt +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents +@ifnottex +@node Top +@top xorrecord 1.1.7 +@c man-ignore-lines 1 + +@c man .SH NAME +xorrecord - Emulation of CD/DVD/BD program cdrecord by program xorriso +@end ifnottex +@menu +* Overview:: Overview +* Standards:: MMC, Session, Track, Media types +* Drive:: Drive preparation and addressing +* Xorriso:: Relation to program xorriso +* Options:: Options +* Examples:: Examples +* Files:: Files +* Seealso:: See also +* Bugreport:: Reporting bugs +* Legal:: Author, Copyright, Credits +* CommandIdx:: Alphabetic Command List +* ConceptIdx:: Alphabetic List of Concepts and Objects +@end menu +@node Overview, Standards, Top, Top +@chapter Overview +@c man .SH SYNOPSIS +@c man .B xorrecord +@c man [ options ] dev=device [track_source] +@c man .br +@c man .SH DESCRIPTION +@c man .PP +@command{xorrecord} +writes preformatted data to CD, DVD, and BD media. +@* +@sp 1 +@c man .PP +It understands some options of program cdrecord from cdrtools by +Joerg Schilling. +Its implementation is part of program xorriso which shares no source +code with cdrtools, but rather makes use of libburn for communicating +with the drive. +@* +@sp 1 +Another, more complete cdrecord emulator is program @strong{cdrskin} +which uses the same burn functions as @strong{xorrecord}. +@c man .SS +@node Standards, Drive, Overview, Top +@chapter MMC, Session, Track, Media types +@c man \fBMMC, Session, Track, Media types:\fR +@c man .br +@cindex MMC, _definiton +@strong{MMC} +is a standard out of the SCSI family which defines the interaction between +computers and optical drives. Since more than a decade all CD, DVD, or BD +recorders obey this standard regardless by what bus cabling they are +attached to the computer. libburn relies on this standard compliance and +on the capability of the operating system to perform SCSI transactions +over the particular bus cabling. +@* +@cindex Session, _definiton +A @strong{Session} is a data region on an optical disc which usually +gets written in a single sweep. It contains at least one +@cindex Track, _definiton +@strong{Track} which is a contiguous string of readable blocks. +@command{xorrecord} produces a single session with a single data track +which consists of blocks with 2048 bytes each. It chooses the write mode +automatically according to media type, medium state, and option -multi. +@* +On CD media there are other track types, like audio, and particular write +modes like TAO and SAO. CD and DVD- media can put more than one track into +a session. Some of these features can be addressed by program @strong{cdrskin}. +@* +@sp 1 +@cindex Media types, _definiton +MMC describes several recordable @strong{media types} which roughly form two +families. +@* +@cindex Sequentially recordable media, _definiton +@strong{Sequentially recordable media} +are CD-R, CD-RW, DVD-R, DVD-R DL, DVD-RW, DVD+R, DVD+R DL, BD-R. +Except DVD-R DL they can store more than one session if there is still +unwritten space and if the previous session was written with option +@strong{-multi}. CD-RW and DVD-RW can be blanked in order to be re-usable +from scratch. +@* +@cindex Overwritable media, _definiton +@strong{Overwritable media} are DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE. +They offer a single session with a single track for random access writing. +There is no need to blank overwritable media before re-use. +@* +DVD-RW media are sold in sequentially recordable state but can be +formatted once to become overwritable. See options +@strong{blank=format_overwrite} and @strong{blank=deformat}. +@* +If ISO 9660 filesystems are to be stored on overwritable media, then it +is possible to emulate multiple sessions, by using option +@strong{--grow_overriteable_iso}. In this case, the need for +blanking before re-use is emulated too. +@c man .SS +@sp 1 +@c man .B Drive preparation and addressing: +@node Drive, Xorriso, Standards, Top +@chapter Drive preparation and addressing +@c man .PP +The drives, CD, DVD, or BD burners, are accessed via file addresses which +are specific to libburn and the operating system. Those addresses get listed +by a run of @command{xorrecord --devices} or @command{xorriso -device_links}. +@* +On GNU/Linux and FreeBSD, the user needs rw-permission for the device file. +On Solaris, the user needs r-permission and privilege "sys_devices", +which is usually gained by running @command{xorrecord} via command pfexec. +@* +These permissions resp. privileges are needed already for listing a drive. +So it might be necessary to get the overview as superuser resp. via pfexec. +@* +@command{xorrecord} does not perform cdrecord option -scanbus and does +not accept the addresses of form Bus,Target,Lun which are told by -scanbus. +If support for these addresses is necessary, consider to use program cdrskin. +@* +@sp 1 +It is possible to let @command{xorrecord} work on emulated drives. +Their addresses begin by prefix "stdio:" followed by a file address. +The emulated media behavior depends on the file type. +See man xorriso for details. +@* +If standard output is chosen as emulated drive, then all program result +texts, which usually appear on standard output, will get redirected to +standard error. +@c man .SS +@node Xorriso, Options, Drive, Top +@chapter Relation to program xorriso +@c man \fBRelation to program xorriso:\fR +@c man .br +@cindex xorriso, mkisofs emulation +@command{xorrecord} is actually a command mode of program @strong{xorriso}, +which gets entered either by xorriso command "-as cdrecord" or by +starting the program by one of the names "xorrecord", "cdrecord", +"wodim", or "cdrskin". +@* +This command mode can be left by argument "@minus{}@minus{}" which leads +to generic xorriso command mode. See @strong{man xorriso} for its description. +Other than in xorriso command mode, the sequence of the cdrecord emulation +options does not matter. +All pending actions get performed in a fixed sequence before the program +run ends resp. before cdrecord emulation ends. +@c man .SS +@node Options, Examples, Xorriso, top +@chapter Options +@cindex xorriso, options +@c man .br +@c man .SH OPTIONS +@c man .br +@menu +* DriveAddr:: Drive addressing +* Inquire:: Inquiring drive and media +* SetBurn:: Settings for the burn run +* Verbous:: Program version and verbosity +* NonCdrecord:: Options not compatible to cdrecord +@end menu +@c man .PP +@c man .TP +@c man .B Addressing the drive: +@node DriveAddr, Inquire, Options, Options +@section Addressing the drive +@table @asis +@sp 1 +@c man .TP +@item @minus{}@minus{}devices +@kindex @minus{}@minus{}devices get list of drives +@cindex Drive, get list of, @minus{}@minus{}devices +Print the list of accessible CD, DVD, or BD drives to standard output. +Drives might be inaccessible if the user lacks of permissions to use them +or if the drive is in use by another program. +@* +Each accessible drive is shown by a line like: +@* + 0 -dev '/dev/sr0' rwrw-- : 'TSSTcorp' 'CDDVDW SH-S203B' +@* +The libburn address of this drive is '/dev/sr0'. 'TSSTcorp' is the +name of the vendor (in this case: Toshiba Samsung Storage Technologies +Corporation), 'CDDVDW SH-S203B' is the model name (in this case: a DVD burner). +@c man .TP +@item dev=drive_address +@kindex dev= address the drive to be used +@cindex Drive, address, dev= +Set the libburn address of the drive to be used. +@* +E.g. on GNU/Linux: dev=/dev/sr0 +@* +E.g. on FreeBSD: dev=/dev/cd0 +@* +E.g. on Solaris: dev=/dev/rdsk/c2t2d0s2 +@* +See also above "Drive preparation and addressing". +@* +The medium in the drive should not be mounted or be otherwise in use. +@end table +@c man .TP +@c man .B Inquiring drive and media: +@node Inquire, SetBurn, DriveAddr, Options +@section Inquiring drive and media +@table @asis +@sp 1 +@c man .TP +@item -inq +@kindex -inq inquire drive identifiers +@cindex Drive, inquire identifiers, -inq +Print to standard output: vendor, model name, and firmware revision +of the drive. +@c man .TP +@item -checkdrive +@kindex -checkdrive inquire drive CD capabilities +@cindex Drive, inquire CD capabilities, -checkdrive +Print unconditionally that the drive supports burnfree, SAO, and TAO. +Also print the output of option -inq. +@c man .TP +@item -atip +@kindex -atip inquire medium state +@cindex medium state, inquire, -atip +Print the output of -checkdrive, the most capable profile of the medium +in the drive, the list of profiles which are supported by the drive, +whether it is erasable (i.e. can be blanked), the media manufacturer, and +the medium product name. +@* +Profiles are usage models, which are often tied to a particular media type +(e.g. CD-RW), but may also apply to a family of media. E.g. profile CD-ROM +applies to all CD media which contain data. +@c man .TP +@item -toc +@kindex -toc inquire medium content +@cindex medium content, inquire, -toc +Print a table of content of the medium in the drive. The output is not +compatible to +cdrecord option -toc, but rather the one of @command{xorriso} command -toc. +It lists the address, vendor, model name, and firmware revision of the drive. +@* +About the medium it tells product name and manufacturer, whether there +is already content written, and if so, whether the medium is closed or +appendable. Appendable media can take another session. +The amount of readable and writable data is told. +If there are sessions, then their start block address and size is reported. +If a session contains an ISO 9660 filesystem, then its Volume Id is reported. +If the medium is writable, then the next writable block address is reported. +@* +If not option @strong{--grow_overriteable_iso} is given or no ISO 9660 +file system is present on the medium, then overwritable media are reported +as being blank. This is due to the fact that they can be written from +scratch without further preparation, and that MMC does not distinguish +between data written by the most previous burn run and older data +which have not been overwritten by that burn run. +Consequently, these media are reported with 0 readable blocks, although +all their writable blocks normally are readable, too. +@c man .TP +@item -msinfo +@kindex -msinfo retrieve multi-session info +@cindex multi-session info, retrieve, -msinfo +Print the argument text for option -C of programs mkisofs, genisoimage, +or xorrisofs. It consists of two numbers separated by a comma. +@* +The first number tells the first block of the first track of the last recorded +session. This is also the address used by default when operating systems +mount a medium with e.g. ISO 9660 filesystem. +@* +The second number tells the next writable address, where @command{xorrecord} +will begin to write the next session. +@* +This option is only valid for written, appendable media. In all other +cases it will yield no output text but will abort the program +with non-zero exit value. +@end table +@c man .TP +@c man .B Settings for the burn run: +@node SetBurn, Verbous, Inquire, Options +@section Settings for the burn run +@table @asis +@c man .PP +A burn run requires exactly one track source address argument, which +tells from where to read the data wich shall be put into the upcomming +session. The medium state must be either blank or appendable. +@* +Track source may be "-" for standard input or the address of a readable +file of any type except directories. Nearly all media types accept a track +source with unpredictable byte count, like standard input or named pipes. +Nevertheless, DVD-R DL and DVD-RW blanked by mode deformat_quickest +demand exact in-advance reservation of the track size, so that they either +need to be read from a source of +predictable length, or need to be accompanied by option @strong{tsize=} or +by option @strong{-isosize}. +@* +Several options expect a size value as argument. A number with a trailing +letter "b" or without a trailing letter is a plain byte count. Other trailing +letters cause multiplication of the given number by a scaling factor: +@* +"k" or "K" = 1024 , "m" or "M" = 1024k , "g" or "G" = 1024m , "s" or "S" = 2048 +@* +E.g. tsize=234567s means a size of 234567 * 2048 = 480393216 bytes. +@sp 1 +@c man .TP +@item blank=mode +@kindex blank= make media re-usabable or format media +@cindex Media, blank, blank= +@cindex Media, make re-usable, blank= +@cindex Media, format, blank= +Blank a CD-RW or DVD-RW to make it re-usable from scratch. +Format a DVD-RW, DVD+RW, DVD-RAM, BD-R, or BD-RE if not yet formatted. +@* +This operation normally makes any recorded data on the medium unreadable. +It is combinable with burning in the same run of @command{xorrecord}, +or it may be performed without a track source, leaving the medium empty. +@* +The mode given with blank= selects the particular behavior: +@c man .RS +@c man .TP +@* +@sp 1 +as_needed +@* +Try to make the media ready for writing from scratch. If it needs formatting, +then format it. If it is not blank, then try to apply blank=fast. +It is a reason to abort if the mediium cannot assume thoroughly writeable +state, e.g. if it is a non-blank write-once. +@* +This leaves unformatted DVD-RW in unformatted blank state. To format DVD-RW use +blank=format_overwrite. Blank unformatted BD-R stay unformatted. +@* +(Note: blank=as_needed is not an original cdrecord option.) +@c man .TP +@* +@sp 1 +all +@* +Blank an entire CD-RW or an unformatted DVD-RW. +@c man .TP +@sp 1 +@* +fast +@* +Minimally blank an entire CD-RW or blank an unformatted DVD-RW. +@c man .TP +@sp 1 +@* +deformat +@* +Like blank=all but with the additional ability to blank overwriteable DVD-RW. +This will destroy their formatting and make them sequentially recordable. +@* +(Note: blank=deformat is not an original cdrecord options) +@c man .TP +@sp 1 +@* +deformat_quickest +@* +Like blank=deformat but blanking DVD-RW only minimally. +This is faster than full blanking but yields media incapable of +writing tracks of unpredicatable size. +Multi-session will not be possible either. +@* +(Note: blank=deformat_quickest is not an original cdrecord option.) +@c man .TP +@sp 1 +@* +format_overwrite +@* +Format a DVD-RW to "Restricted Overwrite". The user should bring some patience. +@* +Format unformatted DVD+RW, BD-RE or blank BD-R to their default size. +It is not mandatory to do this with DVD+RW and BD-RE media, because they +will get formatted automatically on the first write attempt. +@* +BD-R media may be written in unformatted state. This keeps disabled the +replacement of bad blocks and enables full nominal write speed. Once BD-R +media are written, they cannot be formatted any more. +@* +For re-formatting already formatted media or for formatting with +non-default size, use program @strong{xorriso} with command @strong{-format}. +@* +(Note: blank=format_overwrite is not an original cdrecord options) +@c man .RE +@c man .TP +@item -multi +@kindex -multi keep media appendable after burn run +@cindex Media, keep appendable, -multi +This option keeps CD, unformatted DVD-R[W], DVD+R, or BD-R appendable +after the current session has been written. +Without it the disc gets closed and may not be written any more - unless it +is a -RW and gets blanked, which causes loss of its content. +@* +This option cannot be applied to DVD-R DL and DVD-RW which were blanked +by type deformat_quickest. +@* +In order to have all filesystem content accessible, the eventual ISO-9660 +filesystem of a follow-up +session needs to be prepared in a special way by the filesystem formatter +program. mkisofs, genisoimage, and xorrisofs expect particular info about +the situation which can be retrieved by @command{xorrecord} option -msinfo. +@* +With overwriteable DVD or BD media, -multi cannot mark the end of the session. +So when adding a new session, this end has to be determined from the payload. +Currently only ISO-9660 filesystems can be used that way. See option +@strong{--grow_overwriteable_iso}. +@c man .TP +@item -dummy +@kindex -dummy control write simulation +@cindex Write simulation , control, -dummy +Try to perform the drive operations without actually affecting the inserted +media. There is no warranty that this will work with a particular combination +of drive and media. Blanking is prevented reliably, though. +To avoid inadverted real burning, -dummy refuses burn runs on anything but +CD-R[W], DVD-R[W], or emulated stdio-drives. +@c man .TP +@item -waiti +@kindex -waiti access drive only after stdin delivers data +@cindex Accessing drive, wait for stdin, -waiti +Wait until input data is available at stdin or EOF occurs at stdin. +Only then begin to access any drives. +@* +One should use this if xorrisofs is working at the end of a pipe where the +feeder process reads from the drive before it starts writing its output into +xorrisofs. Example: +@* +xorrisofs ... -C 0,12800 -M /dev/sr0 ... | \ +@* +xorrecord dev=/dev/sr0 ... -waiti - +@* +This option works even if standard input is not the track source. If no process +is piping in, then the Enter key of your terminal will act as trigger for +@command{xorrecord}. Note that this input line will not be consumed by +cdrskin if standard input is not the track source. It will end up as shell +command, usually. +@c man .TP +@item tsize=size +@kindex tsize= set a fixed track size +@cindex Track size, set fixed, tsize= +Announce the exact size of the track source. This is necessary with +DVD-R DL media and with quickest blanked DVD-RW, if the size cannot be +determined in advance from the track source. E.g. if it is standard input +or a named pipe. +@* +If the track source does not deliver the predicted amount of bytes, the +remainder of the track is padded with zeros. This is not considered an error. +If on the other hand the track source delivers more than the announced bytes +then the track on media gets truncated to the predicted size and xorrecord +exits with non-zero value. +@c man .TP +@item -isosize +@kindex -isosize obtain track size from ISO 9660 superblock +@cindex Track size, obtain from ISO 9660, -isosize +Try to obtain the track size from the content of the track source. +This works only if the track source bears an ISO 9660 filesystem. +Any other track source content will cause the burn run to abort. +@* +If the track source is not a regular file or block device, then this option +will work only if the program's fifo size is at least 64k. See option fs=. +@c man .TP +@item padsize=size +@kindex padsize= add bytes to end of track +@cindex Padding, at end of track, padsize= +Add the given amount of trailing zeros to the upcomming track. +This feature can be disabled by size 0. Default is 300 kB in order to +work around a problem with GNU/Linux which often fails to read the last few +blocks of a CD track which was written in write mode TAO. TAO is used +by @command{xorrecord} if the track size cannot be predicted or if the CD +medium is not blank but appendable. +@c man .TP +@item -nopad +@kindex -nopad disable adding of bytes to end of track +@cindex Padding, disable, -nopad +The same as padsize=0. +@c man .TP +@item -pad +@kindex -pad add 15 blocks to end of track +@cindex Padding, insufficient old, -pad +The same as padsize=15s. This was once sufficient with older GNU/Linux +kernels. Meanwhile one should at least use padsize=128k, if not padsize=300k. +@c man .TP +@item -data +@kindex -data explicitely announce a data track +@cindex Data track, announce, -data +Explicitely announce that the track source shall be recorded as data track, +and not as audio track. This option has no effect with @command{xorrecord}, +because there is no support for other track formats anyway. +@c man .TP +@item fs=size +@kindex fs= set program fifo size +@cindex Fifo, set size, fs= +Set the size of the program fifo buffer to the given value +rather than the default of 4m. +@* +The fifo buffers a temporary surplus of track source data in order to +provide the drive with a steady stream during times of temporary lack of track +source supply. +@* +Other than cdrecord, xorrecord enables drive buffer underrun protection by +default and does not wait with writing until the fifo is full for a first +time. +On very old CD drives and slow computers, this might cause aborted burn runs. +In this case, consider to use program @strong{cdrskin} for CD burning. +DVD and BD drives tolerate buffer underrun without problems. +@* +The larger the fifo, the longer periods of poor source supply can be +compensated. But a large fifo can deprive the operating system of read cache +for better filesystem performance. +@c man .TP +@item speed=value +@kindex speed= set write speed +@cindex Speed, set for writing, speed= +Set the write speed. Default is 0 = maximum speed. +Speed can be given in media type dependent x-speed numbers or as a +desired throughput per second in MMC compliant kB (= 1000) +or MB (= 1000 kB). Media x-speed factor can be set explicity +by appending "c" for CD, "d" for DVD, "b" for BD. "x" is optional. +@* +Example speeds: +@* + 706k = 706kB/s = 4c = 4xCD +@* + 5540k = 5540kB/s = 4d = 4xDVD +@* +If there is no hint about the speed unit attached, then the +medium in the drive will decide. +Default unit is CD, 1x = 176,400 raw bytes/second. +With DVD, 1x = 1,385,000 bytes/second. +With BD, 1x = 4,495,625 bytes/second. +@* +MMC drives usually activate their own idea of speed and take +the speed value given by the burn program only as a hint +for their own decision. +@c man .TP +@item -eject +@kindex -eject finally eject drive tray +@cindex Eject, the tray, -eject +@cindex Tray, eject, -eject +Eject the drive tray after alll other work is done. +@end table +@c man .TP +@c man .B Program version and verbosity: +@node Verbous, NonCdrecord, SetBurn, Options +@section Program version and verbosity +@table @asis +@sp 1 +@c man .TP +@item -version +@kindex -version report emulation and xorriso version +@cindex Version, report, -version +Print to standard output a line beginning by +@* +"Cdrecord 2.01-Emulation Copyright" +@* +and further lines which report the version of xorriso and its +supporting libraries. They also state the license under which the program +is provided, and disclaim any warranty, to the extent permitted by law. +@c man .TP +@item -v +@kindex -v increase program verbosity +@cindex Verbosity, increase, -v +Increase program verbosity by one level. There are four verbosity levels +from nearly silent to debugging verbosity. The both highest levels can +be enabled by repeated -v or by -vv resp. -vvv. +@c man .TP +@item -V +@kindex -V log SCSI command transactions to stderr +@cindex Verbosity, SCSI commands, -V +@cindex SCSI commands, log, -V +Log SCSI commands and drive replies to standard error. +This might be of interest if @strong{xorrecord} and a particular drive +or medium do not cooperate as expected, or if you just want to know +how libburn interacts with the drive. +To understand this extremely verbous log, one needs to read SCSI +specs SPC, SBC, and MMC. +@* +Please do not add such a log to a bug report on the first hand, +unless you want to point out a particular deviation +from said specs, or if you get asked for this log by a maintainer of +@command{xorrecord} who feels in charge for your bug report. +@c man .TP +@item -help +@kindex -help print sparse overview of options +@cindex Options, overview, -help +Print a sparse list of program options to standard error +and declare not to be cdrecord. +@end table +@c man .TP +@c man .B Options not compatible to cdrecord: +@node NonCdrecord, ExDevices, Verbous, Options +@section Options not compatible to cdrecord +@table @asis +@sp 1 +@c man .TP +@item @minus{}@minus{}no_rc +@kindex @minus{}@minus{}no_rc do not execute xorriso startup files +@cindex Startup files, do not execute, @minus{}@minus{}no_rc +Only if used as first command line argument this option +prevents reading and interpretation of startup files. See section FILES below. +@c man .TP +@item @minus{}@minus{}grow_overwriteable_iso +@kindex @minus{}@minus{}grow_overwriteable_iso emulate ISO 9660 multi-session +@cindex Multi-session, emulate ISO 9660, @minus{}@minus{}grow_overwriteable_iso +Enable emulation of multi-session writing on overwriteable media which +contain an ISO 9660 filesystem. This emulation is learned from growisofs -M +but adapted to the usage model of +@* +xorrecord -msinfo +@* +xorrisofs -C -M | xorrecord -waiti -multi - +@* +for sequential media. +@* +--grow_overwriteable_iso does not hamper the use of true multi-session media. +I.e. it is possible to use the same @command{xorrecord} options with both +kinds of media +and to achieve similar results if ISO 9660 filesystem images are to be written. +This option implies option -isosize and therefore demands that the track +source is a ISO 9660 filesystem image. +@* +With overwriteable media and no option blank=fast|all present it expands an +eventual ISO 9660 filesystem on media. It is assumed that this image's inner +size description points to the end of the valuable data. +Overwriteable media with a recognizable ISO 9660 size will be regarded as +appendable rather than as blank. I.e. options -msinfo and -toc will work. +-toc will always show a single session with its size increasing with +every added ISO 9660 image. +@c man .TP +@item stream_recording="on"|"off"|number +@kindex stream_recording= try to get full speed on DVD-RAM, BD +@cindex Full speed, on DVD-RAM and BD, stream_recording= +@cindex Defect management, control, stream_recording= +Mode "on" requests that compliance to the desired speed setting is +preferred over management of write errors. With DVD-RAM and BD this can +bring effective write speed near to the nominal write speed of the media. +But it will also disable the automatic use of replacement blocks +if write errors occur. It might as well be disliked or ignored by the drive. +@* +If a number is given, then error management stays enabled for all byte +addresses below that number. Any number below 16s is the same as "off". +@c man .TP +@item dvd_obs="default"|"32k"|"64k" +@kindex dvd_obs= set write transaction payload size +@cindex Transaction size, set, dvd_obs= +Linux specific: +Set the number of bytes to be transmitted with each write operation to DVD +or BD media. Tracks get padded up to the next multiple of this write +size. A number of 64 KB may improve throughput with bus systems which +show latency problems. The default depends on media type, option +stream_recording=, and on compile time options. +@c man .TP +@item write_start_address=value +@kindex write_start_address= set block address for write start +@cindex Write start address, set, write_start_address= +Set the block address on overwritable media where to start writing the track. +With DVD+RW, DVD-RAM or BD-RE, byte_offset must be aligned to 2 kiB blocks, +but better is 32 kiB on DVD and 64 kiB on BD. +With formatted DVD-RW 32 kiB alignment is mandatory. +@* +Other media are not suitable for this option. +@c man .TP +@item stdio_sync="on"|"off"|number +@kindex stdio_sync= control stdio buffer +@cindex Write, buffer syncing, stdio_sync= +Set the number of bytes after which to force output to emulated stdio: drives. +This forcing keeps the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +@end table +@node Examples, Files, Options, Top +@chapter Examples +@c man .SH EXAMPLES +@c man .SS +@c man .B Overview of examples: +@c man Get an overview of drives and their addresses +@c man .br +@c man Get info about a particular drive or loaded media +@c man .br +@c man Prepare CD-RW or DVD-RW for re-use, BD-R for bad block handling +@c man .br +@c man Format DVD-RW to avoid need for blanking before re-use +@c man .br +@c man De-format DVD-RW to make it capable of multi-session again +@c man .br +@c man Write a single ISO 9660 filesystem image +@c man .br +@c man Write multiple ISO 9660 sessions +@c man .br +@c man Write ISO 9660 session on-the-fly +@c man .br +@c man Write compressed afio archive on-the-fly +@c man .br +@cindex Examples +@menu +* ExDevices:: Get an overview of drives and their addresses +* ExMedium:: Get info about a particular drive or loaded media +* ExBlank:: Prepare CD-RW or DVD-RW for re-use +* ExFormat:: Format DVD-RW to avoid need for blanking before re-use +* ExDeformat:: De-format DVD-RW to make it capable of multi-session again +* ExIsoSingle:: Write a single ISO 9660 filesystem image +* ExIsoMulti:: Write multiple ISO 9660 sessions +* ExIsoFly:: Write ISO 9660 session on-the-fly +* ExAfio:: Write compressed afio archive on-the-fly +@end menu +@c man .SS +@c man .B Get an overview of drives and their addresses: +@node ExDevices, ExMedium, NonCdrecord, Examples +@section Get an overview of drives and their addresses +@sp 1 + $ xorrecord --devices +@c man .SS +@c man .B Get info about a particular drive and loaded media: +@node ExMedium, ExBlank, ExDevices, Examples +@section Get info about a particular drive and loaded media +@sp 1 + $ xorrecord dev=/dev/sr0 -atip -toc --grow_overwriteable_iso +@c man .SS +@c man .B Prepare CD-RW or DVD-RW for re-use: +@node ExBlank, ExFormat, ExMedium, Examples +@section Prepare CD-RW or DVD-RW for re-use +@sp 1 + $ xorrecord -v dev=/dev/sr0 blank=as_needed -eject +@c man .SS +@c man .B Format DVD-RW to avoid need for blanking before re-use: +@node ExFormat, ExDeformat, ExBlank, Examples +@section Format DVD-RW to avoid need for blanking before re-use +@sp 1 + $ xorrecord -v dev=/dev/sr0 blank=format_overwrite -eject +@* +@sp 1 +This command may also be used to format BD-R media before first use, +in order to enable handling of write errors. Several hundred MB of spare +blocks will be reserved and write runs on such media will perform +with less than half nominal speed. +@c man .SS +@c man .B De-format DVD-RW to make it capable of multi-session again: +@node ExDeformat, ExIsoSingle, ExFormat, Examples +@section De-format DVD-RW to make it capable of multi-session again +@sp 1 + $ xorrecord -v dev=/dev/sr0 blank=deformat +@c man .SS +@c man .B Write a single ISO 9660 filesystem image: +@node ExIsoSingle, ExIsoMulti, ExDeformat, Examples +@section Write a single ISO 9660 filesystem image +@sp 1 + $ xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ + blank=as_needed -eject padsize=300k my_image.iso +@c man .SS +@c man .B Write multiple ISO 9660 sessions: +@node ExIsoMulti, ExIsoFly, ExIsoSingle, Examples +@section Write multiple ISO 9660 sessions +This is possible with all media except minimally blanked DVD-RW and DVD-R DL, +which cannot do multi-session. +@* +The first session is written like in the previous example, except that +option -multi is used. It will contain the files of hard disk +directory ./tree1 under the ISO 9660 directory /dir1: +@* +@sp 1 + $ xorrisofs -o image_1.iso -J -graft-points /dir1=./tree1 +@* + $ xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +@* + -multi --grow_overwritable_iso \ +@* + blank=as_needed -eject padsize=300k image_1.iso +@* +@sp 1 +For the second session xorrisofs needs to know the -msinfo numbers +of the medium. Further it will read data from the medium by using the +system's read-only CD-ROM driver. +@* +It is advised to load the tray manually +or via dd by the CD-ROM driver, rather than letting xorrecord do this +by its own SCSI driver. Many system CD-ROM drivers do not take notice +of xorrecord's activities. +@* +@sp 1 + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +@* +Now get the -msinfo numbers: +@* + $ m=$(xorrecord dev=/dev/sr0 -msinfo) +@* +@sp 1 +and use them with xorrisofs to add ./tree2 to the image as /dir2: +@* +@sp 1 + $ xorrisofs -M /dev/sr0 -C $m -o image_2.iso \ +@* + -J -graft-points /dir2=./tree2 +@* +@sp 1 +Now burn the new session onto the same medium. This time without blanking: +@* +@sp 1 + $ xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +@* + -multi --grow_overwritable_iso \ +@* + -eject padsize=300k image_2.iso +@* +@sp 1 +Operating systems which mount this medium will read the superblock +of the second session and show both directories /dir1 and /dir2. +@c man .SS +@c man .B Write ISO 9660 session on-the-fly: +@node ExIsoFly, ExAfio, ExIsoMulti, Examples +@section Write ISO 9660 session on-the-fly +It is possible to combine the run of @strong{xorrisofs} and @command{xorrecord} +in a pipeline without storing the ISO 9660 image as file on hard disk: +@* +@sp 1 + $ xorrisofs -M /dev/sr0 -C $m \ +@* + -J -graft-points /dir2=./tree2 \ +@* + | xorrecord -v dev=/dev/sr0 speed=12 fs=8m \ +@* + -waiti -multi --grow_overwritable_iso \ +@* + -eject padsize=300k - +@* +@sp 1 +This is also the main use case of program @strong{xorriso} itself, +where this run would look like: +@* +@sp 1 + $ xorriso -dev /dev/sr0 -joliet on -speed 12 -fs 8m \ +@* + -map ./tree2 /dir2 -commit_eject all +@c man .SS +@c man .B Write compressed afio archive on-the-fly: +@node ExAfio, , ExIsoFly, Examples +@section Write compressed afio archive on-the-fly +This is possible with all media except minimally blanked DVD-RW and DVD-R DL. +Since the compressed output stream is of very variable speed, a larger fifo +is advised. Nevertheless, this example is not suitable for very old CD drives +which have no underrun protection and thus would abort the burn run on +temporary data shortage. +@* +@sp 1 + $ find . | afio -oZ - | \ +@* + xorrecord -v dev=/dev/sr0 speed=12 fs=64m \ +@* + -multi padsize=300k - +@* +@sp 1 +afio archives do not contain references to absolute data block addresses. So +they need no special precautions for multi-session. One may get the session +start addresses by option -toc, and then use dd option skip= to begin reading +at one of those addresses. E.g. for listing its content: +@* +@sp 1 + $ dd if=/dev/sr0 bs=2048 skip=64046 | afio -tvZ - +@* +@sp 1 +afio will know when the end of the archive is reached. +@c man .SH FILES +@node Files, Seealso, Examples, Top +@chapter Files +@c man .SS +@c man .B Startup files: +@section Startup Files +@* +If not --no_rc is given as the first argument then @command{xorrecord} +attempts on startup to read and execute lines from the following files: +@* +@sp 1 + /etc/default/xorriso +@* + /etc/opt/xorriso/rc +@* + /etc/xorriso/xorriso.conf +@* + $HOME/.xorrisorc +@* +@sp 1 +The files are read in the sequence given here, but none of them is required +to exist. The lines are not interpreted as @command{xorrecord} options but +as generic @strong{xorriso} commands. See man xorriso. +@c man .SH SEE ALSO +@c man .TP +@c man For generic xorriso command mode +@c man .BR xorriso(1) +@c man .TP +@c man Formatting track sources for xorrecord: +@c man .BR xorrisofs(1), +@c man .BR mkisofs(8), +@c man .BR genisoimage(8), +@c man .BR afio(1), +@c man .BR star(1) +@c man .TP +@c man Other programs which burn sessions to optical media +@c man .BR growisofs(1), +@c man .BR cdrecord(1), +@c man .BR wodim(1), +@c man .BR cdrskin(1) +@c man-ignore-lines begin +@node Seealso, Bugreport, Files, Top +@chapter See also +@table @asis +@item For generic xorriso command mode +xorriso(1) +@item Formatting track sources for xorrecord +xorrisofs(1), +mkisofs(8), +genisoimage(8), +afio(1), +star(1) +@item Other programs which burn sessions to optical media +growisofs(1), +cdrecord(1), +wodim(1), +cdrskin(1) +@end table +@c man-ignore-lines end +@c man .SH BUGS +@node Bugreport, Legal, Seealso, Top +@chapter Reporting bugs +@cindex Bugs, reporting +@cindex Problems, reporting +To report bugs, request help, or suggest enhancements for @command{xorriso}, +please send electronic mail to the public list @email{bug-xorriso@@gnu.org}. +If more privacy is desired, mail to @email{scdbackup@@gmx.net}. +@* +@sp 1 +Please describe what you expect @command{xorriso} to do, +the program arguments resp. commands by which you tried to achieve it, +the messages of @command{xorriso}, and the undesirable outcome of your +program run. +@* +@sp 1 +Expect to get asked more questions before solutions can be proposed. +@c man .SH AUTHOR +@node Legal, CommandIdx, Bugreport, Top +@chapter Author, Copyright, Credits +@section Author +Thomas Schmitt <scdbackup@@gmx.net> +@* +for libburnia-project.org +@c man .SH COPYRIGHT +@section Copyright +Copyright (c) 2011 Thomas Schmitt +@* +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of xorriso. If you make use +of the license to derive modified versions of xorriso then you are entitled +to modify this text under that same license. +@c man .SH CREDITS +@section Credits +@command{xorriso} is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Thanks to Andy Polyakov who invented emulated growing, +to Derek Foreman and Ben Jansens who once founded libburn. +@* +Compliments towards Joerg Schilling whose cdrtools served me for ten years. +@c man-ignore-lines begin + +@node CommandIdx, ConceptIdx, Legal, Top +@chapter Alphabetic Command List +@printindex ky + +@node ConceptIdx,, CommandIdx, top +@chapter Alphabetic List of Concepts and Objects +@printindex cp + +@c man-ignore-lines end +@bye diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso.1 b/libisoburn/branches/1.1.8/xorriso/xorriso.1 new file mode 100644 index 00000000..63dfa7ec --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso.1 @@ -0,0 +1,4782 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" +.\" IMPORTANT NOTE: +.\" +.\" The original of this file is kept in xorriso/xorriso.texi +.\" This here was generated by program xorriso/make_xorriso_1 +.\" +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH XORRISO 1 "Version 1.1.7, Oct 26, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.nh +.SH NAME +xorriso \- creates, loads, manipulates and writes ISO 9660 filesystem images +with Rock Ridge extensions. +.SH SYNOPSIS +.B xorriso +.RI [ settings | actions ] +.br +.SH DESCRIPTION +.PP +\fBxorriso\fR +is a program which copies file objects from POSIX compliant +filesystems into Rock Ridge enhanced ISO 9660 filesystems and allows +session\-wise manipulation of such filesystems. It can load the management +information of existing ISO images and it writes the session results to +optical media or to filesystem objects. +.br +Vice versa \fBxorriso\fR is able to copy file objects out of ISO 9660 +filesystems. +.PP +A special property of \fBxorriso\fR is that it needs neither an external +ISO 9660 +formatter program nor an external burn program for CD, DVD or BD but rather +incorporates the libraries of libburnia\-project.org . +.SS +.B Overview of features: +.br +Operates on an existing ISO image or creates a new one. +.br +Copies files from disk filesystem into the ISO image. +.br +Copies files from ISO image to disk filesystem (see osirrox). +.br +Renames or deletes file objects in the ISO image. +.br +Changes file properties in the ISO image. +.br +Updates ISO subtrees incrementally to match given disk subtrees. +.br +Writes result either as completely new image or as add\-on session +to optical media or filesystem objects. +.br +Can activate ISOLINUX and GRUB boot images via El Torito and MBR. +.br +Can perform multi\-session tasks as emulation of mkisofs and cdrecord. +.br +Can record and restore hard links and ACL. +.br +Content may get zisofs compressed or filtered by external processes. +.br +Can issue commands to mount older sessions on GNU/Linux or FreeBSD. +.br +Can check media for damages and copy readable blocks to disk. +.br +Can attach MD5 checksums to each data file and the whole session. +.br +Scans for optical drives, blanks re\-useable optical media. +.br +Reads its instructions from command line arguments, dialog, and files. +.br +Provides navigation commands for interactive ISO image manipulation. +.br +Adjustable thresholds for abort, exit value, and problem reporting. +.SS +.B General information paragraphs: +.br +Session model +.br +Media types and states +.br +Creating, Growing, Modifying, Blind Growing +.br +Libburn drives +.br +Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr +.br +Command processing +.br +Dialog, Readline, Result pager +.sp 1 +Maybe you first want to have a look at section EXAMPLES near the end of +this text before reading the next few hundred lines of background information. +.SS +\fBSession model:\fR +.br +Unlike other filesystems, ISO 9660 is not intended for read\-write operation but +rather for being generated in a single sweep and being written to media as a +\fBsession\fR. +.br +The data content of the session is called filesystem \fBimage\fR. +.PP +The written image in its session can then be mounted by the operating system +for being used read\-only. GNU/Linux is able to mount ISO images from block +devices, which may represent optical media, other media or via a loop device +even from regular disk files. FreeBSD mounts ISO images from devices that +represent arbitrary media or from regular disk files. +.PP +This session usage model has been extended on CD media by the concept of +\fBmulti\-session\fR , +which allows to add information to the CD and gives the mount programs +of the operating systems the addresses of the entry points of each +session. The mount programs recognize block devices which represent +CD media and will by default mount the image in the last session. +.br +This session usually contains an updated directory tree for the whole medium +which governs the data contents in all recorded sessions. +So in the view of the mount program all sessions of a particular medium +together form a single filesystem image. +.br +Adding a session to an existing ISO image is in this text referred as +\fBgrowing\fR. +.br +The multi\-session model of the MMC standard does not apply to all media +types. But program growisofs by Andy Polyakov showed how to extend this +functionality to overwriteable media or disk files which carry valid ISO 9660 +filesystems. +.PP +\fBxorriso\fR provides growing as well as an own method named +\fBmodifying\fR which produces a completely new ISO image from the old +one and the modifications. +See paragraph Creating, Growing, Modifying, Blind Growing below. +.PP +\fBxorriso\fR adopts the concept of multi\-session by loading an +image directory tree if present, +by allowing to manipulate it by several actions, +and by writing the new image to the target medium. +.br +The first session of a \fBxorriso\fR run begins by the definition of +the input drive with the ISO image or by the definition of an output drive. +The session ends by command \-commit which triggers writing. A \-commit is +done automatically when the program ends regularly. +.PP +After \-commit a new session begins with the freshly written one as input. +A new input drive can only be chosen as long as the loaded ISO image was +not altered. Pending alteration can be revoked by command \-rollback. +.PP +Writing a session to the target is supposed to be very expensive in terms of +time and of consumed space on appendable or write\-once media. Therefore all +intended manipulations of a particular ISO image should be done in a single +session. But in principle it is possible +to store intermediate states and to continue with image manipulations. +.SS +.B Media types and states: +There are two families of media in the MMC standard: +.br +\fBMulti\-session media\fR are CD\-R, CD\-RW, DVD\-R, DVD+R, DVD+R/DL, BD\-R, and +unformatted DVD\-RW. These media provide a table of content which +describes their existing sessions. See option \fB\-toc\fR. +.br +Similar to multi\-session media are DVD\-R DL and minimally blanked DVD\-RW. +They allow only a single session of which the size must be known in advance. +\fBxorriso\fR will write onto them only if option \-close is set to "on". +.br +\fBOverwriteable media\fR are DVD\-RAM, DVD+RW, BD\-RE, and formatted DVD\-RW. +They allow random write access but do not provide information about their +session history. If they contain one or more ISO 9660 sessions and if the +first session was written by \fBxorriso\fR, then a table of content can +be emulated. Else only a single overall session will be visible. +.br +DVD\-RW media can be formatted by \-format "full". +They can be made unformatted by \-blank "deformat". +.br +Regular files and block devices are handled as overwriteable media. +Pipes and other writeable file types are handled as blank multi\-session media. +.PP +These media can assume several states in which they offer different +capabilities. +.br +\fBBlank\fR media can be written from scratch. They contain no ISO image +suitable for \fBxorriso\fR. +.br +Blank is the state of newly purchased optical media. +With used CD\-RW and DVD\-RW it can be achieved by action \-blank "as_needed". +Overwriteable media are considered blank if they are new or if they have +been marked as blank by \fBxorriso\fR. +Action \-blank "as_needed" can be used to do this marking on overwriteable +media, or to apply mandatory formatting to new media if necessary. +.br +\fBAppendable\fR media accept further sessions. Either they are MMC +multi\-session media in appendable state, or they are overwriteable media +which contain an ISO image suitable for \fBxorriso\fR. +.br +Appendable is the state after writing a session with option \-close off. +.br +\fBClosed\fR media cannot be written. They may contain an ISO image suitable +for \fBxorriso\fR. +.br +Closed is the state of DVD\-ROM media and of multi\-session media which were +written with option \-close on. If the drive is read\-only hardware then it will +probably show any media as closed CD\-ROM resp. DVD\-ROM. +.br +Overwriteable media assume this state in such read\-only drives or if they +contain unrecognizable data in the first 32 data blocks. +.br +Read\-only drives may or may not show session histories of multi\-session +media. Often only the first and the last session are visible. Sometimes +not even that. Option \-rom_toc_scan might or might not help in such cases. +.SS +.B Creating, Growing, Modifying, Blind Growing: +.br +A new empty ISO image gets \fBcreated\fR +if there is no input drive with a valid ISO 9660 image when the first time +an output drive is defined. This is achieved by option \-dev on blank media +or by option \-outdev on media in any state. +.br +The new empty image can be populated with directories and files. +Before it can be written, the medium in the output drive must get into +blank state if it was not blank already. +.PP +If there is a input drive with a valid ISO image, then this image gets loaded +as foundation for manipulations and extension. The constellation of input +and output drive determines which write method will be used. +They have quite different capabilities and constraints. +.PP +The method of \fBgrowing\fR adds new data to the existing data on the +medium. These data comprise of new file content and they override the existing +ISO 9660 + Rock Ridge directory tree. It is possible to hide files from +previous sessions but they still exist on the medium and with many types of +optical media it is quite easy to recover them by mounting older sessions. +.br +Growing is achieved by option \-dev. +.PP +The write method of \fBmodifying\fR produces compact filesystem +images with no outdated files or directory trees. Modifying can write its +images to target media which are completely unsuitable for multi\-session +operations. E.g. DVD\-RW which were treated with \-blank deformat_quickest, +DVD\-R DL, named pipes, character devices, sockets. +On the other hand modified sessions cannot be written to appendable media +but to blank media only. +.br +So for this method one needs either two optical drives or has to work with +filesystem objects as source and/or target medium. +.br +Modifying takes place if input drive and output drive are not the same and +if option \-grow_blindly is set to its default "off". +This is achieved by options \-indev and \-outdev. +.PP +If option \-grow_blindly is set to a non\-negative number and if \-indev and +\-outdev are both set to different drives, then \fBblind growing\fR is +performed. It produces an add\-on session which is ready for being written +to the given block address. This is the usage model of +.br + mkisofs \-M $indev \-C $msc1,$msc2 \-o $outdev +.br +which gives much room for wrong parameter combinations and should thus only be +employed if a strict distinction between ISO formatter \fBxorriso\fR +and the burn program is desired. \-C $msc1,$msc2 is equivalent to: +.br + \-load sbsector $msc1 \-grow_blindly $msc2 +.SS +.B Libburn drives: +.br +Input drive, i.e. source of an existing or empty ISO image, can be any random +access readable libburn drive: optical media with readable data, +blank optical media, regular files, block devices. +.PP +Output drive, i.e. target for writing, can be any libburn drive. +Some drive types do not support the method of growing but only the methods +of modifying and blind growing. They all are suitable for newly created images. +.br +All drive file objects have to offer rw\-permission to the user of +\fBxorriso\fR. +Even those which will not be useable for reading an ISO image. +.PP +MMC compliant (i.e. optical) drives on GNU/Linux usually get addressed by +the path of their block device or of their generic character device. E.g. +.br + \-dev /dev/sr0 +.br + \-dev /dev/hdc +.br + \-dev /dev/sg2 +.br +On FreeBSD the device files have names like +.br + \-dev /dev/cd0 +.br +On OpenSolaris: +.br + \-dev /dev/rdsk/c4t0d0s2 +.br +Get a list of accessible drives by command +.br + \-device_links +.br +It might be necessary to do this as +\fBsuperuser\fR +in order to see all drives and to then allow rw\-access for the intended users. +Consider to bundle the authorized users in a group like old "floppy". +.PP +Filesystem objects of nearly any type can be addressed by prefix "stdio:" and +their path in the filesystem. E.g.: +.br + \-dev stdio:/dev/sdc +.br +The default setting of \-drive_class allows to address files outside the +/dev tree without that prefix. E.g.: +.br + \-dev /tmp/pseudo_drive +.br +If path leads to a regular file or to a block device then the emulated drive +is random access readable and can be used for the method of growing if it +already contains a valid ISO 9660 image. Any other file type is not readable +via "stdio:" and can only be used as target for the method of modifying or +blind growing. +Non\-existing paths in existing directories are handled as empty regular files. +.PP +A very special kind of pseudo drive are open file descriptors. They are +depicted by "stdio:/dev/fd/" and descriptor number (see man 2 open). +.br +Addresses "\-" or "stdio:/dev/fd/1" depict standard output, which normally is +the output channel for result texts. +To prevent a fatal intermingling of ISO image and text messages, all result +texts get redirected to stderr if \-*dev "\-" or "stdio:/dev/fd/1" is among +the start arguments of the program. +.br +Standard output is currently suitable for creating one session +per program run without dialog. Use in other situations is discouraged +and several restrictions apply: +.br +It is not allowed to use standard output as pseudo drive if it was not +among the start arguments. Do not try to fool this ban via backdoor addresses +to stdout. +.br +If stdout is used as drive, then \-use_readline is permanently disabled. +Use of backdoors can cause severe memory and/or tty corruption. +.PP +Be aware that especially the superuser can write into any accessible file or +device by using its path with the "stdio:" prefix. By default any address +in the /dev tree without prefix "stdio:" will work only if it leads to a MMC +drive. +.br +One may use option +\fB\-ban_stdio_write\fR +to surely prevent this risk and to allow only MMC drives. +.br +One may prepend "mmc:" to a path to surely disallow any automatic "stdio:". +.br +By option \-drive_class one may ban certain paths or allow access without +prefix "stdio:" to other paths. +.SS +.B Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr: +.br +\fBRock Ridge\fR +is the name of a set of additional information which enhance +an ISO 9660 filesystem so that it can represent a POSIX compliant filesystem +with ownership, access permissions, symbolic links, and other attributes. +.br +This is what \fBxorriso\fR uses for a decent representation of the disk +files within the ISO image. Rock Ridge information is produced with any +\fBxorriso\fR image. +.PP +\fBxorriso\fR is not named "porriso" because POSIX only guarantees +14 characters +of filename length. It is the X/Open System Interface standard XSI which +demands a file name length of up to 255 characters and paths of up to 1024 +characters. Rock Ridge fulfills this demand. +.PP +An \fBEl Torito\fR +boot record points the BIOS bootstrapping facility to one or more boot +images, which are binary program files stored in the ISO image. +The content of the boot image files is not in the scope of El Torito. +.br +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images. +\fBxorriso\fR is able to create or maintain an El Torito object which +makes such an image bootable. For details see option \-boot_image. +.br +It is possible to make ISO images bootable from USB stick or other +hard\-disk\-like media by \-boot_image argument system_area= . This installs +a Master Boot Record which may get adjusted according to the needs +of GRUB resp. ISOLINUX. +An \fBMBR\fR contains boot code and a partition table. It does not hamper +CDROM booting. The new MBR of a follow\-up session can get in effect +only on overwriteable media. +.br +Emulation \-as mkisofs supports the example options out of the ISOLINUX wiki, +the options used in GRUB script grub\-mkrescue, and the example in the +FreeBSD AvgLiveCD wiki. +.br +There is support for boot facilities other than PC BIOS: +EFI, MIPS Big Endian (SGI), MIPS Little Endian (DEC), SUN SPARC. +.br +.PP +\fBACL\fR +are an advanced way of controlling access permissions to file objects. Neither +ISO 9660 nor Rock Ridge specify a way to record ACLs. So libisofs has +introduced a standard conformant extension named AAIP for that purpose. +It uses this extension if enabled by option +\fB\-acl\fR. +.br +AAIP enhanced images are supposed to be mountable normally, but one cannot +expect that the mounted filesystem will show and respect the ACLs. +For now, only \fBxorriso\fR is able to retrieve those ACLs. +It can bring them into +effect when files get restored to an ACL enabled file system or it can +print them in a format suitable for tool setfacl. +.br +Files with ACL show as group permissions the setting of entry "mask::" if +that entry exists. Nevertheless the non\-listed group members get handled +according to entry "group::". When removing ACL from a file, +\fBxorriso\fR brings "group::" into effect. +.br +Recording and restoring of ACLs from and to local files works currently +only on GNU/Linux and FreeBSD. +.PP +\fBxattr\fR (aka EA, or extattr) +are pairs of name and value which can be attached to file objects. AAIP is +able to represent them and \fBxorriso\fR allows to record and restore +pairs which +have names out of the user namespace. I.e. those which begin with "user.", +like "user.x" or "user.whatever". Name has to be a 0 terminated string. +Value may be any array of bytes which does not exceed the size of 4095 bytes. +xattr processing happens only if it is enabled by option +\fB\-xattr\fR. +.br +As with ACL, currently only \fBxorriso\fR is able to retrieve xattr +from AAIP enhanced images, to restore them to xattr capable file systems, +or to print them. +.br +Recording and restoring of xattr from and to local files works currently +only on GNU/Linux and FreeBSD, where they are known as extattr. +.SS +.B Command processing: +.br +Commands are either actions which happen immediately or settings which +influence following actions. So their sequence does matter. +.br +Commands consist of a command word, +followed by zero or more parameter words. If the list of parameter words +is of variable length (indicated by "[...]" or "[***]") then it has to be +terminated by either the \fBlist delimiter\fR, or the end of argument list, +or an end of an input line. +.PP +At program start the list delimiter is the word "\-\-". +This may be changed by option \-list_delimiter in order to allow +"\-\-" as argument in a list of variable length. +It is advised to reset the delimiter to "\-\-" immediately +afterwards. +.br +For brevity the list delimiter is referred as "\-\-" +throughout this text. +.br +The list delimiter is silently tolerated if it appears after the parameters of +a command with a fixed list length. It is handled as normal text if it +appears among the arguments of such a command. +.PP +\fBPattern expansion\fR +converts a list of pattern words into a list of existing file addresses. +Unmatched pattern words appear themselves in that result list, though. +.br +Pattern matching supports the usual shell parser wildcards '*' '?' '[xyz]' +and respects '/' as separator which may only be matched literally. +.br +It is a property of some particular commands and not a general +feature. It gets controlled by commands \-iso_rr_pattern and \-disk_pattern. +Commands which may use pattern expansion all have variable argument +lists which are marked in this man page by "[***]" rather than "[...]". +.br +Some other commands perform pattern matching unconditionally. +.PP +Command and parameter words are either read from program arguments, where one +argument is one word, or from quoted input lines where words are recognized +similar to the quotation rules of a shell parser. +.br +\fBxorriso\fR is not a shell, although it might appear so on first glimpse. +Be aware that the interaction of quotation marks and pattern symbols like "*" +differs from the usual shell parsers. In \fBxorriso\fR, a quotation mark +does not make a pattern symbol literal. +.PP +\fBQuoted input\fR +converts whitespace separated text pieces into words. +The double quotation mark " and the single quotation mark ' can be used to +enclose whitespace and make it part of words (e.g. of file names). Each mark +type can enclose the marks of the other type. A trailing backslash \\ outside +quotations or an open quotation cause the next input line to be appended. +.br +Quoted input accepts any ASCII character except NUL (0) as content of quotes. +Nevertheless it can be cumbersome for the user to produce those characters +at all. Therefore quoted input and program arguments allow optional +\fBBackslash Interpretation\fR +which can represent all ASCII characters except NUL (0) by backslash codes +as in $'...' of bash. +.br +It is not enabled by default. See option \-backslash_codes. +.PP +When the program starts then it first looks for argument \-no_rc. If this is +not present then it looks for its startup files and +reads their content as command input lines. Then it interprets +the program arguments as commands and parameters. Finally it enters +dialog mode if command \-dialog "on" was executed up to then. +.PP +The program ends either by command \-end, or by the end of program arguments +if not dialog was enabled up to that moment, or by a problem +event which triggers the threshold of command \-abort_on. +.SS +.B Dialog, Readline, Result pager: +.br +Dialog mode prompts for a quoted input line, parses it into words, and performs +them as commands with their parameters. It provides assisting services +to make dialog more comfortable. +.PP +Readline is an enhancement for the input line. You may know it already from +the bash shell. Whether it is available in \fBxorriso\fR depends on the +availability +of package readline\-dev at the time when \fBxorriso\fR was built from +its sourcecode. +.br +It allows to move the cursor over the text in the line by help of the +Leftward and the Rightward arrow key. +Text may be inserted at the cursor position. The Delete key removes the +character under the cursor. Upward and Downward arrow keys navigate through +the history of previous input lines. +.br +See man readline +for more info about libreadline. +.PP +Option \-page activates a built\-in result text pager which may be convenient in +dialog. After an action has put out the given number of terminal lines, +the pager prompts the user for a line of input. +.br +An empty line lets \fBxorriso\fR resume work until the next page is put out. +.br +The single character "@" disables paging for the current action. +.br +"@@@", "x", "q", "X", or "Q" urge the current action to abort and suppress +further result output. +.br +Any other line will be interpreted as new dialog line. The current action +is urged to abort. Afterwards, the input line is executed. +.PP +Some actions apply paging to their info output, too. +.br +The urge to abort may or may not be obeyed by the current action. All actions +try to abort as soon as possible. +.br +.SH OPTIONS +.br +All command words are shown with a leading dash although this dash is not +mandatory for the option to be recognized. Nevertheless within option \-as +the dashes of the emulated options are mandatory. +.br +Normally any number of leading dashes is ignored with command words and +inner dashes are interpreted as underscores. +.TP +.B Aquiring source and target drive: +.PP +The effect of aquiring a drive may depend on several options in the +next paragraph "Influencing the behavior of image loading". +If desired, their enabling commands have to be performed before the +commands which aquire the drive. +.TP +\fB\-dev\fR address +Set input and output drive to the same address and load an ISO image if it +is present. +If there is no ISO image then create a blank one. +Set the image expansion method to growing. +.br +This is only allowed as long as no changes are pending in the currently +loaded ISO image. If changes are pending, then one has to perform \-commit +or \-rollback first. +.br +Special address string "\-" means standard output, to which several restrictions +apply. See above paragraph "Libburn drives". +.br +An empty address string "" gives up the current device +without aquiring a new one. +.TP +\fB\-indev\fR address +Set input drive and load an ISO image if present. +If the new input drive differs +from \-outdev then switch from growing to modifying or to blind growing. +It depends on the setting of \-grow_blindly which of both gets activated. +The same rules and restrictions apply as with \-dev. +.TP +\fB\-outdev\fR address +Set output drive and if it differs from the input drive then switch from +growing to modifying or to blind growing. Unlike \-dev and \-indev this action +does not load a new ISO image. So it can be performed even if there are pending +changes. +.br +\-outdev can be performed without previous \-dev or \-indev. In that case an +empty ISO image with no changes pending is created. It can either be populated +by help of \-map, \-add et.al. or it can be discarded silently if \-dev or \-indev +are performed afterwards. +.br +Special address string "\-" means standard output, to which several restrictions +apply. See above paragraph "Libburn drives". +.br +An empty address string "" gives up the current output drive +without aquiring a new one. No writing is possible without an output drive. +.TP +\fB\-grow_blindly\fR "off"|predicted_nwa +If predicted_nwa is a non\-negative number then perform blind growing rather +than modifying if \-indev and \-outdev are set to different drives. +"off" or "\-1" switch to modifying, which is the default. +.br +predicted_nwa is the block address where the add\-on session of blind +growing will finally end up. It is the responsibility of the user to ensure +this final position and the presence of the older sessions. Else the +overall ISO image will not be mountable or will produce read errors when +accessing file content. \fBxorriso\fR will write the session to the address +as obtained from examining \-outdev and not necessarily to predicted_nwa. +.br +During a run of blind growing, the input drive is given up before output +begins. The output drive is given up when writing is done. +.TP +.B Influencing the behavior of image loading: +.PP +The following options should normally be performed before loading an image +by aquiring an input drive. In rare cases it is desirable to activate +them only after image loading. +.TP +\fB\-load\fR entity id +Load a particular (possibly outdated) ISO session from \-dev or \-indev. +Usually all available sessions are shown with option \-toc. +.br +entity depicts the kind of addressing. id depicts the particular +address. The following entities are defined: +.br +"auto" with any id addresses the last session in \-toc. This is the default. +.br +"session" with id being a number as of a line "ISO session", column "Idx". +.br +"track" with id being a number as of a line "ISO track", column "Idx". +.br +"lba" or "sbsector" with a number as of a line "ISO ...", column "sbsector". +.br +"volid" with a search pattern for a text as of a line "ISO ...", +column "Volume Id". +.br +Adressing a non\-existing entity or one which does not represent an ISO +image will either abandon \-indev or at least lead to a blank image. +.br +If an input drive is set at the moment when \-load is executed, then the +addressed ISO image is loaded immediately. Else, the setting will be pending +until the next \-dev or \-indev. After the image has been loaded once, the +setting is valid for \-rollback until next \-dev or \-indev, where it +will be reset to "auto". +.TP +\fB\-displacement\fR [-]lba +Compensate a displacement of the image versus the start address +for which the image was prepared. This affects only loading of ISO images +and reading of their files. The multi\-session method of growing is not allowed +as long as \-displacement is non\-zero. I.e. \-indev and \-outdev must be +different. The displacement gets reset to 0 before the drive +gets re\-aquired after writing. +.br +Examples: +.br +If a track of a CD starts at block 123456 and gets copied to a disk file +where it begins at block 0, then this copy can be loaded with +\-displacement \-123456. +.br +If an ISO image was written onto a partition with offset of 640000 blocks of +512 bytes, then it can be loaded from the base device by \-displacement 160000. +.br +In both cases, the ISO sessions should be self contained, i.e. not add\-on +sessions to an ISO image outside their track resp. partition. +.TP +\fB\-drive_class\fR "harmless"|"banned"|"caution"|"clear_list" disk_pattern +Add a drive path pattern to one of the safety lists or make those lists empty. +There are three lists defined which get tested in the following sequence: +.br +If a drive address path matches the "harmless" list then the drive will be +accepted. If it is not a MMC device then the prefix "stdio:" will be prepended +automatically. This list is empty by default. +.br +Else if the path matches the "banned" list then the drive will not be +accepted by \fBxorriso\fR but rather lead to a FAILURE event. +This list is empty by default. +.br +Else if the path matches the "caution" list and if it is not a MMC device, +then its address must have the prefix "stdio:" or it will be rejected. +This list has by default one entry: "/dev". +.br +If a drive path matches no list then it is considered "harmless". By default +these are all paths which do not begin with directory "/dev". +.br +A path matches a list if one of its parent paths or itself matches a list +entry. Address prefix "stdio:" or "mmc:" will be ignored when +testing for matches. +.br +By pseudo\-class "clear_list" and pseudo\-patterns "banned", "caution", +"harmless", or "all", the lists may be made empty. +.br +E.g.: \-drive_class clear_list banned +.br +One will normally define the \-drive_class lists in one of the \fBxorriso\fR +Startup Files. +.br +Note: This is not a security feature but rather a bumper for the superuser to +prevent inadverted mishaps. For reliably blocking access to a device file you +have to deny its rw\-permissions in the filesystem. +.TP +\fB\-assert_volid\fR pattern severity +Refuse to load ISO images with volume ids which do not match the given +search pattern. When refusing an image, give up the input drive and issue +an event of the given severity (like FAILURE, see \-abort_on). An empty search +pattern accepts any image. +.br +This option does not hamper the creation of an empty image from blank +input media and does not discard an already loaded image. +.TP +\fB\-in_charset\fR character_set_name +Set the character set from which to convert file names when loading an +image. See paragraph "Character sets" for more explanations. +When loading the written image after \-commit the setting of \-out_charset +will be copied to \-in_charset. +.TP +\fB\-auto_charset\fR "on"|"off" +Enable or disable recording and interpretation of the output character +set name in an xattr attribute of the image root directory. If enabled and +if a recorded character set name is found, then this name will be used as +namoe of the input character set when reading an image. +.br +Note that the default output charset is the local character set of the +terminal where \fBxorriso\fR runs. Before attributing this local +character set +to the produced ISO image, check whether the terminal properly displays +all intended filenames, especially exotic national characters. +.TP +\fB\-hardlinks\fR mode[:mode...] +Enable or disable loading and recording of hardlink relations. +.br +In default mode "off", iso_rr files lose their inode numbers at image load +time. Each iso_rr file object which has no inode number at image generation +time will get a new unique inode number if \-compliance is set to new_rr. +.br +Mode "on" preserves inode numbers from the loaded image if such numbers +were recorded. +When committing a session it searches for families of iso_rr files +which stem from the same disk file, have identical content filtering and have +identical properties. The family members all get the same inode number. +Whether these numbers are respected at mount time depends on the operating +system. +.br +Commands \-update and \-update_r track splits and fusions of hard links in +filesystems which have stable device and inode numbers. This can cause +automatic last minute changes before the session gets written. Command +\-hardlinks "perform_update" may be used to do these changes earlier, +e.g. if you need to apply filters to all updated files. +.br +Mode "without_update" avoids hardlink processing during update commands. +Use this if your filesystem situation does not allow \-disk_dev_ino "on". +.br +\fBxorriso\fR commands which extract files from an ISO image try to +hardlink files +with identical inode number. The normal scope of this operation is from +image load to image load. One may give up the accumulated hard link addresses +by \-hardlinks "discard_extract". +.br +A large number of hardlink families may exhaust \-temp_mem_limit +if not \-osirrox "sort_lba_on" and \-hardlinks "cheap_sorted_extract" +are both in effect. This restricts hard linking to other files restored by +the same single extract command. \-hardlinks "normal_extract" re\-enables +wide and expensive hardlink accumulation. +.br +.TP +\fB\-acl\fR "on"|"off" +Enable or disable processing of ACLs. +If enabled, then \fBxorriso\fR will obtain ACLs from disk file objects, +store ACLs in the ISO image using the libisofs specific AAIP format, +load AAIP data from ISO images, test ACL during file comparison, +and restore ACLs to disk files when extracting them from ISO images. +See also options \-getfacl, \-setfacl. +.TP +\fB\-xattr\fR "on"|"off" +Enable or disable processing of xattr attributes in user namespace. +If enabled, then \fBxorriso\fR will handle xattr similar to ACL. +See also options \-getfattr, \-setfattr and above paragraph about xattr. +.TP +\fB\-md5\fR "on"|"all"|"off"|"load_check_off" +Enable or disable processing of MD5 checksums for the overall session and for +each single data file. If enabled then images with checksum tags get loaded +only if the tags of superblock and directory tree match properly. The MD5 +checksums of data files and whole session get loaded from the image if there +are any. +.br +With options \-compare and \-update the recorded MD5 of a file +will be used to avoid content reading from the image. Only the disk file +content will be read and compared with that MD5. This can save much time +if \-disk_dev_ino "on" is not suitable. +.br +At image generation time they are computed for each file which gets its data +written into the new session. The checksums of files which have their data +in older sessions get copied into the new session. Superblock, tree and whole +session get a checksum tag each. +.br +Mode "all" will additionally check during image generation whether the checksum +of a data file changed between the time when its reading began and the time +when it ended. This implies reading every file twice. +.br +Mode "load_check_off" together with "on" or "all" will load recorded MD5 sums +but not test the recorded checksum tags of superblock and directory tree. +This is necessary if growisofs was used as burn program, because it does +not overwrite the superblock checksum tag of the first session. +Therefore load_check_off is in effect when \fBxorriso\fR \-as mkisofs +option \-M is performed. +.br +The test can be re\-enabled by mode "load_check_on". +.br +Checksums can be exploited via options \-check_md5, \-check_md5_r, via find +actions get_md5, check_md5, and via \-check_media. +.TP +\fB\-for_backup\fR +Enable all extra features which help to produce or to restore backups with +highest fidelity of file properties. +Currently this is a shortcut for: \-hardlinks on \-acl on \-xattr on \-md5 on. +.TP +\fB\-disk_dev_ino\fR "on"|"ino_only"|"off" +Enable or disable processing of recorded file identification numbers +(dev_t and ino_t). If enabled they are stored as xattr and allow +to substantially accelerate file comparison. The root node gets a global start +timestamp. If during comparison a file with younger timestamps is found in the +ISO image, then it is suspected to have inconsistent content. +.br +If device numbers and inode numbers of the disk filesystems are persistent +and if no irregular alterations of timestamps or system clock happen, +then potential content changes can be detected without reading that content. +File content change is assumed if any of mtime, ctime, device number or inode +number have changed. +.br +Mode "ino_only" replaces the precondition that device numbers are stable by the +precondition that mount points in the compared tree always lead to the +same filesystems. Use this if mode "on" always sees all files changed. +.br +The speed advantage appears only if the loaded session was produced with +\-disk_dev_ino "on" too. +.br +Note that \-disk_dev_ino "off" is totally in effect only if \-hardlinks is "off", +too. +.TP +\fB\-rom_toc_scan\fR "on"|"force"|"off"[:"emul_on"|"emul_off"] +Read\-only drives do not tell the actual media type but show any media as +ROM (e.g. as DVD\-ROM). The session history of MMC multi\-session media might +be truncated to first and last session or even be completely false. +(The emulated history of overwriteable media is not affected by this.) +.br +To have in case of failure a chance of getting the session history and +especially the address of the last session, there is a scan for ISO 9660 +filesystem headers which might help but also might yield worse results +than the drive's table of content. At its end it can cause read attempts +to invalid addresses and thus ugly drive behavior. +Setting "on" enables that scan for alleged read\-only media. +.br +Some operating systems are not able to mount the most recent session of +multi\-session DVD or BD. If on such a system \fBxorriso\fR has no own MMC +capabilities then it may still find that session from a scanned table of +content. Setting "force" handles any media like a ROM medium with setting "on". +.br +On the other hand the emulation of session history on overwriteable media +can hamper reading of partly damaged media. Setting "off:emul_off" disables +the elsewise trustworthy table\-of\-content scan for those media. +.br +To be in effect, the \-rom_toc_scan setting has to be made before the \-*dev +command which aquires drive and medium. +.TP +\fB\-calm_drive\fR "in"|"out"|"all"|"revoke"|"on"|"off" +Reduce drive noise until it is actually used again. Some drives stay alert +for substantial time after they have been used for reading. This reduces +the startup time for the next drive operation but can be loud and waste +energy if no i/o with the drive is expected to happen soon. +.br +Modes "in", "out", "all" immediately calm down \-indev, \-outdev, resp. both. +Mode "revoke" immediately alerts both. +Mode "on" causes \-calm_drive to be performed automatically after each \-dev, +\-indev, and \-outdev. Mode "off" disables this. +.TP +\fB\-ban_stdio_write\fR +Allow for writing only the usage of MMC optical drives. Disallow +to write the result into files of nearly arbitrary type. +Once set, this command cannot be revoked. +.TP +\fB\-early_stdio_test\fR "on"|"appendable_wo"|"off" +If enabled by "on" then regular files and block devices get tested for +effective access permissions. This implies to try opening those files for +writing, which otherwise will happen only later and only if actual +writing is desired. +.br +The test result is used for classifying the pseudo drives as overwriteable, +read\-only, write\-only, or uselessly empty. This may lead to earlier detection +of severe problems, and may avoid some less severe error events. +.br +Mode "appendable_wo" is like "on" with the additional property that +non\-empty write\-only files are regarded as appendable rather than blank. +.TP +.B Inserting files into ISO image: +.PP +The following commands expect file addresses of two kinds: +.br +\fBdisk_path\fR +is a path to an object in the local filesystem tree. +.br +\fBiso_rr_path\fR +is the Rock Ridge name of a file object in the ISO image. (Do not +confuse with the lowlevel ISO 9660 names visible if Rock Ridge gets ignored.) +.PP +Note that in the ISO image you are as powerful as the superuser. Access +permissions of the existing files in the image do not apply to your write +operations. They are intended to be in effect with the read\-only mounted image. +.PP +If the iso_rr_path of a newly inserted file leads to an existing +file object in the ISO image, then the following collision handling +happens: +.br +If both objects are directories then they get merged by recursively inserting +the subobjects from filesystem into ISO image. +If other file types collide then the setting of command +\fB\-overwrite\fR +decides. +.br +Renaming of files has similar collision handling, but directories can only +be replaced, not merged. Note that if the target directory exists, then \-mv +inserts the source objects into this directory rather than attempting +to replace it. +.PP +The commands in this section alter the ISO image and not the local filesystem. +.TP +\fB\-disk_pattern\fR "on"|"ls"|"off" +Set the pattern expansion mode for the disk_path arguments of several +commands which support this feature. +.br +Setting "off" disables this feature for all commands which are marked in this +man page by "disk_path [***]" or "disk_pattern [***]". +.br +Setting "on" enables it for all those commands. +.br +Setting "ls" enables it only for those which are marked by +"disk_pattern [***]". +.br +Default is "ls". +.TP +\fB\-add\fR pathspec [...] | disk_path [***] +Insert the given files or directory trees from filesystem +into the ISO image. +.br +If \-pathspecs is set to "on" then pattern expansion is always disabled and +character '=' has a special meaning. It separates the ISO image path +from the disk path: +.br +iso_rr_path=disk_path +.br +The separator '=' can be escaped by '\\'. +If iso_rr_path does not begin with '/' then \-cd is prepended. +If disk_path does not begin with '/' then \-cdx is prepended. +.br +If no '=' is given then the word is used as both, iso_rr_path and disk path. +If in this case the word does not begin with '/' then \-cdx is prepended to +the disk_path and \-cd is prepended to the iso_rr_path. +.br +If \-pathspecs is set to "off" then \-disk_pattern expansion applies, if enabled. +The resulting words are used as both, iso_rr_path and disk path. Relative +path words get prepended the setting of \-cdx to disk_path and the setting +of \-cd to iso_rr_path. +.TP +\fB\-add_plainly\fR mode +If set to mode "unknown" then any command word that does not begin with "\-" and +is not recognized as known command will be subject to a virtual \-add command. +I.e. it will be used as pathspec or as disk_path and added to the image. +If enabled, \-disk_pattern expansion applies to disk_paths. +.br +Mode "dashed" is similar to "unknown" but also adds unrecognized command +words even if they begin with "\-". +.br +Mode "any" announces that all further words are to be added as pathspecs +or disk_paths. This does not work in dialog mode. +.br +Mode "none" is the default. It prevents any words from being understood +as files to add, if they are not parameters to appropriate commands. +.TP +\fB\-path_list\fR disk_path +Like \-add but read the parameter words from file disk_path +or standard input if disk_path is "\-". +The list must contain exactly one pathspec resp. disk_path pattern per line. +.TP +\fB\-quoted_path_list\fR disk_path +Like \-path_list but with quoted input reading rules. Lines get split into +parameter words for \-add. Whitespace outside quotes is discarded. +.TP +\fB\-map\fR disk_path iso_rr_path +Insert file object disk_path into the ISO image as iso_rr_path. If disk_path +is a directory then its whole sub tree is inserted into the ISO image. +.TP +\fB\-map_single\fR disk_path iso_rr_path +Like \-map, but if disk_path is a directory then its sub tree is not inserted. +.TP +\fB\-map_l\fR disk_prefix iso_rr_prefix disk_path [***] +Perform \-map with each of the disk_path arguments. iso_rr_path will be +composed from disk_path by replacing disk_prefix by iso_rr_prefix. +.TP +\fB\-update\fR disk_path iso_rr_path +Compare file object disk_path with file object iso_rr_path. If they do not +match, then perform the necessary image manipulations to make iso_rr_path +a matching copy of disk_path. By default this comparison will imply lengthy +content reading before a decision is made. Options \-disk_dev_ino or \-md5 may +accelerate comparison if they were already in effect when the loaded session +was recorded. +.br +If disk_path is a directory and iso_rr_path does not exist yet, then the +whole subtree will be inserted. Else only directory attributes will be +updated. +.TP +\fB\-update_r\fR disk_path iso_rr_path +Like \-update but working recursively. I.e. all file objects below both +addresses get compared whether they have counterparts below the other address +and whether both counterparts match. If there is a mismatch then the necessary +update manipulation is done. +.br +Note that the comparison result may depend on option \-follow. Its setting +should always be the same as with the first adding of disk_path as iso_rr_path. +.br +If iso_rr_path does not exist yet, then it gets added. If disk_path does not +exist, then iso_rr_path gets deleted. +.TP +\fB\-update_l\fR disk_prefix iso_rr_prefix disk_path [***] +Perform \-update_r with each of the disk_path arguments. iso_rr_path will be +composed from disk_path by replacing disk_prefix by iso_rr_prefix. +.TP +\fB\-cut_out\fR disk_path byte_offset byte_count iso_rr_path +Map a byte interval of a regular disk file into a regular file in the ISO +image. +This may be necessary if the disk file is larger than a single medium, or if +it exceeds the traditional limit of 2 GiB \- 1 for old operating systems, +or the limit of 4 GiB \- 1 for newer ones. Only the newest Linux kernels +seem to read properly files >= 4 GiB \- 1. +.br +A clumsy remedy for this limit is to backup file pieces and to concatenate +them at restore time. A well tested chopping size is 2047m. +It is permissible to request a higher byte_count than available. The +resulting file will be truncated to the correct size of a final piece. +To request a byte_offset higher than available yields no file in +the ISO image but a SORRY event. +E.g: +.br + \-cut_out /my/disk/file 0 2047m \\ +.br + /file/part_1_of_3_at_0_with_2047m_of_5753194821 \\ +.br + \-cut_out /my/disk/file 2047m 2047m \\ +.br + /file/part_2_of_3_at_2047m_with_2047m_of_5753194821 \\ +.br + \-cut_out /my/disk/file 4094m 2047m \\ +.br + /file/part_3_of_3_at_4094m_with_2047m_of_5753194821 +.br +While option \-split_size is set larger than 0, and if all pieces of a file +reside in the same ISO directory with no other files, and if the names look +like above, then their ISO directory will be recognized and handled like a +regular file. This affects options \-compare*, \-update*, and overwrite +situations. +See option \-split_size for details. +.TP +\fB\-cpr\fR disk_path [***] iso_rr_path +Insert the given files or directory trees from filesystem +into the ISO image. +.br +The rules for generating the ISO addresses are similar as with +shell command cp \-r. Nevertheless, directories of the iso_rr_path +are created if necessary. Especially a not yet existing iso_rr_path +will be handled as directory if multiple disk_paths are present. +The leafnames of the multiple disk_paths will be grafted under that +directory as would be done with an existing directory. +.br +If a single disk_path is present then a non\-existing iso_rr_path will +get the same type as the disk_path. +.br +If a disk_path does not begin with '/' then \-cdx is prepended. +If the iso_rr_path does not begin with '/' then \-cd is prepended. +.TP +\fB\-mkdir\fR iso_rr_path [...] +Create empty directories if they do not exist yet. +Existence as directory generates a WARNING event, existence as +other file causes a FAILURE event. +.TP +\fB\-clone\fR iso_rr_path_original iso_rr_path_copy +Create a copy of the ISO file object iso_rr_path_original with the new +address iso_rr_path_copy. If the original is a directory then copy all +files and directories underneath. If iso_rr_path_original is a boot catalog +file, then it gets not copied but is silently ignored. +.br +The copied ISO file objects have the same attributes. Copied data files +refer to the same content source as their originals. +The copies may then be manipulated independendly of their originals. +.br +This command will refuse execution if the address iso_rr_path_copy +already exists in the ISO tree. +.TP +\fB\-cp_clone\fR iso_rr_path_original [***] iso_rr_path_dest +Create copies of one or more ISO file objects as with command \-clone. +In case of collision merge directories with existing ones, but do not overwrite +existing ISO file objects. +.br +The rules for generating the copy addresses are the same as with +command \-cpr (see above) resp. shell command cp \-r. Other than with \-cpr, +relative iso_rr_path_original will get prepended the \-cd path and not +the \-cdx path. Consider to \-mkdir iso_rr_path_dest before \-cp_clone +so the copy address does not depend on the number of iso_rr_path_original +arguments. +.TP +.B Settings for file insertion: +.TP +\fB\-file_size_limit\fR value [value [...]] -- +Set the maximum permissible size for a single data file. The values get +summed up for the actual limit. If the only value is "off" then the file +size is not limited by \fBxorriso\fR. +Default is a limit of 100 extents, 4g \-2k each: +.br + \-file_size_limit 400g \-200k \-\- +.br +When mounting ISO 9660 filesystems, old operating systems can handle only files +up to 2g \-1 \-\-. Newer ones are good up to 4g \-1 \-\-. +You need quite a new Linux kernel to read correctly the final bytes +of a file >= 4g if its size is not aligned to 2048 byte blocks. +.br +\fBxorriso\fR's own data read capabilities are not affected by +operating system size limits. Such limits apply to mounting only. Nevertheless, +the target filesystem of an \-extract must be able to take the file size. +.TP +\fB\-not_mgt\fR code[:code[...]] +Control the behavior of the exclusion lists. +.br +Exclusion processing happens before disk_paths get mapped to the ISO image +and before disk files get compared with image files. +The absolute disk path of the source is matched against the \-not_paths list. +The leafname of the disk path is matched against the patterns in the \-not_leaf +list. If a match is detected then the disk path will not be regarded as an +existing file and not be added to the ISO image. +.br +Several codes are defined. +The _on/_off settings persist until they are revoked by their_off/_on +counterparts. +.br +"erase" empties the lists which were accumulated by \-not_paths and \-not_leaf. +.br +"reset" is like "erase" but also re\-installs default behavior. +.br +"off" disables exclusion processing temporarily without invalidating +the lists and settings. +.br +"on" re\-enables exclusion processing. +.br +"param_off" applies exclusion processing only to paths below disk_path +parameter of commands. I.e. explicitly given disk_paths are exempted +from exclusion processing. +.br +"param_on" applies exclusion processing to command parameters as well as +to files below such parameters. +.br +"subtree_off" with "param_on" excludes parameter paths only if they +match a \-not_paths item exactly. +.br +"subtree_on" additionally excludes parameter paths which lead to a file +address below any \-not_paths item. +.br +"ignore_off" treats excluded disk files as if they were missing. I.e. they +get reported with \-compare and deleted from the image with \-update. +.br +"ignore_on" keeps excluded files out of \-compare or \-update activities. +.TP +\fB\-not_paths\fR disk_path [***] +Add the given paths to the list of excluded absolute disk paths. If a given +path is relative, then the current \-cdx is prepended to form an absolute path. +Pattern matching, if enabled, happens at definition time and not when exclusion +checks are made. +.br +(Do not forget to end the list of disk_paths by "\-\-") +.TP +\fB\-not_leaf\fR pattern +Add a single shell parser style pattern to the list of exclusions for +disk leafnames. These patterns are evaluated when the exclusion checks are +made. +.TP +\fB\-not_list\fR disk_path +Read lines from disk_path and use each of them either as \-not_paths argument, +if they contain a / character, or as \-not_leaf pattern. +.TP +\fB\-quoted_not_list\fR disk_path +Like \-not_list but with quoted input reading rules. Each word is +handled as one argument for \-not_paths resp. \-not_leaf. +.TP +\fB\-follow\fR occasion[:occasion[...]] +Enable or disable resolution of symbolic links and mountpoints under +disk_paths. This applies to actions \-add, \-du*x, \-ls*x, \-findx, +and to \-disk_pattern expansion. +.br +There are two kinds of follow decisison to be made: +.br +"link" is the hop from a symbolic link to its target file object. +If enabled then symbolic links are handled as their target file objects, +else symbolic links are handled as themselves. +.br +"mount" is the hop from one filesystem to another subordinate filesystem. +If enabled then mountpoint directories are handled as any other directory, +else mountpoints are handled as empty directories if they are encountered in +directory tree traversals. +.br +Less general than above occasions: +.br +"pattern" is mount and link hopping, but only during \-disk_pattern expansion. +.br +"param" is link hopping for parameter words (after eventual pattern expansion). +If enabled then \-ls*x will show the link targets rather than the links +themselves. \-du*x, \-findx, and \-add will process the link targets but not +follow links in an eventual directory tree below the targets (unless "link" +is enabled). +.br +Occasions can be combined in a colon separated list. All occasions +mentioned in the list will then lead to a positive follow decision. +.br +"off" prevents any positive follow decision. Use it if no other occasion +applies. +.br +Shortcuts: +.br +"default" is equivalent to "pattern:mount:limit=100". +.br +"on" always decides positive. Equivalent to "link:mount". +.br + +Not an occasion but an optional setting is: +.br +"limit="<number> which sets the maximum number of link hops. +A link hop consists of a sequence of symbolic links and a final target +of different type. Nevertheless those hops can loop. Example: +.br + $ ln \-s .. uploop +.br +Link hopping has a built\-in loop detection which stops hopping at the first +repetition of a link target. Then the repeated link is handled as itself +and not as its target. +Regrettably one can construct link networks which +cause exponential workload before their loops get detected. +The number given with "limit=" can curb this workload at the risk of truncating +an intentional sequence of link hops. +.TP +\fB\-pathspecs\fR "on"|"off" +Control parameter interpretation with \fBxorriso\fR +actions \-add and \-path_list. +.br +"on" enables pathspecs of the form +\fBtarget=source\fR +like with program mkisofs \-graft\-points. +It also disables \-disk_pattern expansion for command \-add. +.br +"off" disables pathspecs of the form target=source +and re\-enables \-disk_pattern expansion. +.TP +\fB\-overwrite\fR "on"|"nondir"|"off" +Allow or disallow to overwrite existing files in the +ISO image by files with the same name. +.br +With setting "off", name collisions cause FAILURE events. +With setting "nondir", only directories are protected by such events, other +existing file types get treated with \-rm before the new file gets added. +Setting "on" allows automatic \-rm_r. I.e. a non\-directory can replace an +existing directory and all its subordinates. +.br +If restoring of files is enabled, then the overwrite rule applies to the +target file objects on disk as well, but "on" is downgraded to "nondir". +.TP +\fB\-split_size\fR number["k"|"m"] +Set the threshold for automatic splitting of regular files. Such splitting +maps a large disk file onto a ISO directory with several part files in it. +This is necessary if the size of the disk file exceeds \-file_size_limit. +Older operating systems can handle files in mounted ISO 9660 filesystems +only if they are smaller than 2 GiB resp. 4 GiB. +.br +Default is 0 which will exclude files larger than \-file_size_limit by a +FAILURE event. +A well tested \-split_size is 2047m. Sizes above \-file_size_limit are not +permissible. +.br +While option \-split_size is set larger than 0 such a directory with split +file pieces will be recognized and handled like a regular file by options +\-compare* , \-update*, and in overwrite situations. There are \-ossirox +options "concat_split_on" and "concat_split_off" which control the handling +when files get restored to disk. +.br +In order to be recognizable, the names of the part files have to +describe the splitting by 5 numbers: +.br + part_number,total_parts,byte_offset,byte_count,disk_file_size +.br +which are embedded in the following text form: +.br + part_#_of_#_at_#_with_#_of_# +.br +Scaling characters like "m" or "k" are taken into respect. +All digits are interpreted as decimal, even if leading zeros are present. +.br +E.g: /file/part_1_of_3_at_0_with_2047m_of_5753194821 +.br +No other files are allowed in the directory. All parts have to be present and +their numbers have to be plausible. E.g. byte_count must be valid as \-cut_out +argument and their contents may not overlap. +.TP +.B File manipulations: +.PP +The following commands manipulate files in the ISO image, regardless whether +they stem from the loaded image or were newly inserted. +.PP +.TP +\fB\-iso_rr_pattern\fR "on"|"ls"|"off" +Set the pattern expansion mode for the iso_rr_path arguments of several +commands which support this feature. +.br +Setting "off" disables pattern expansion for all commands which are marked +in this man page by "iso_rr_path [***]" or "iso_rr_pattern [***]". +.br +Setting "on" enables it for all those commands. +.br +Setting "ls" enables it only for those which are marked by +"iso_rr_pattern [***]". +.br +Default is "on". +.TP +\fB\-rm\fR iso_rr_path [***] +Delete the given files from the ISO image. +.br +Note: This does not free any space on the \-indev medium, even if +the deletion is committed to that same medium. +.br +The image size will shrink if the image is written to a different +medium in modification mode. +.TP +\fB\-rm_r\fR iso_rr_path [***] +Delete the given files or directory trees from the ISO image. +See also the note with option \-rm. +.TP +\fB\-rmdir\fR iso_rr_path [***] +Delete empty directories. +.TP +\fB\-mv\fR iso_rr_path [***] iso_rr_path +Rename the given file objects in the ISO tree to the last +argument in the list. Use the same rules as with shell command mv. +.br +If pattern expansion is enabled and if the last argument contains wildcard +characters then it must match exactly one existing file address, or else the +command fails with a FAILURE event. +.TP +\fB\-chown\fR uid iso_rr_path [***] +Set ownership of file objects in the ISO image. uid may either be a decimal +number or the name of a user known to the operating system. +.TP +\fB\-chown_r\fR uid iso_rr_path [***] +Like \-chown but affecting all files below eventual directories. +.TP +\fB\-chgrp\fR gid iso_rr_path [***] +Set group attribute of file objects in the ISO image. gid may either be a +decimal number or the name of a group known to the operating system. +.TP +\fB\-chgrp_r\fR gid iso_rr_path [***] +Like \-chgrp but affecting all files below eventual directories. +.TP +\fB\-chmod\fR mode iso_rr_path [***] +Equivalent to shell command chmod in the ISO image. +mode is either an octal number beginning with "0" or a comma separated +list of statements of the form [ugoa]*[+\-=][rwxst]* . +.br +Like: go\-rwx,u+rwx . +.br +\fBPersonalities\fR: +u=user, g=group, o=others, a=all +.br +\fBOperators\fR: ++ adds given permissions, \- revokes given permissions, += revokes all old permissions and then adds the given ones. +.br +\fBPermissions\fR: +r=read, w=write, x=execute|inspect, s=setuid|setgid, t=sticky bit +.br +For octal numbers see man 2 stat. +.TP +\fB\-chmod_r\fR mode iso_rr_path [***] +Like \-chmod but affecting all files below eventual directories. +.TP +\fB\-setfacl\fR acl_text iso_rr_path [***] +Attach the given ACL to the given iso_rr_paths. If the files already have +ACLs, then those get deleted before the new ones get into effect. +If acl_text is empty, or contains the text "clear" or the text +"\-\-remove\-all", +then the existing ACLs will be removed and no new ones will be +attached. Any other content of acl_text will be interpreted as a list of +ACL entries. It may be in the long multi\-line format as put out by \-getfacl +but may also be abbreviated as follows: +.br +ACL entries are separated by comma or newline. If an entry is empty text or +begins with "#" then it will be ignored. A valid entry has to begin +by a letter out of {ugom} for "user", "group", "other", "mask". It has to +contain two colons ":". A non\-empty text between those ":" gives a user id +resp. group id. After the second ":" there may be letters out of {rwx\- #}. +The first three give read, write resp. execute permission. +Letters "\-", " " and TAB are ignored. "#" causes the rest of the entry to +be ignored. Letter "X" or any other letters are not supported. Examples: +.br + g:toolies:rw,u:lisa:rw,u:1001:rw,u::wr,g::r,o::r,m::rw +.br + group:toolies:rw\-,user::rw\-,group::r\-\-,other::r\-\-,mask::rw\- +.br +A valid entry may be prefixed by "d", some following characters and ":". +This indicates that the entry goes to the "default" ACL rather than to the +"access" ACL. Example: +.br + u::rwx,g::rx,o::,d:u::rwx,d:g::rx,d:o::,d:u:lisa:rwx,d:m::rwx +.TP +\fB\-setfacl_r\fR acl_text iso_rr_path [***] +Like \-setfacl but affecting all files below eventual directories. +.TP +\fB\-setfacl_list\fR disk_path +Read the output of \-getfacl_r or shell command getfacl \-R and apply it to the +iso_rr_paths as given in lines beginning with "# file:". This will change +ownership, group and ACL of the given files. +If disk_path is "\-" then lines are read from standard input. Line "@" ends the +list, "@@@" aborts without changing the pending iso_rr_path. +.br +Since \-getfacl and getfacl \-R strip leading "/" from file paths, the setting of +\-cd does always matter. +.TP +\fB\-setfattr\fR [-]name value iso_rr_path [***] +Attach the given xattr pair of name and value to the given iso_rr_paths. +If the given name is prefixed by "\-", then the pair with that name gets +removed from the xattr list. If name is "\-\-remove\-all" +then all user namespace +xattr of the given iso_rr_paths get deleted. In case of deletion, value must +be an empty text. +.br +Only names from the user namespace are allowed. I.e. a name has to begin with +"user.", like "user.x" or "user.whatever". +.br +Values and names undergo the normal input processing of \fBxorriso\fR. +See also option \-backslash_codes. Other than with option \-setfattr_list, +the byte value 0 cannot be expressed via \-setfattr. +.TP +\fB\-setfattr_r\fR [-]name value iso_rr_path [***] +Like \-setfattr but affecting all files below eventual directories. +.TP +\fB\-setfattr_list\fR disk_path +Read the output of \-getfattr_r or shell command getfattr \-Rd and apply it to +the iso_rr_paths as given in lines beginning with "# file:". All previously +existing user space xattr of the given iso_rr_paths will be deleted. +If disk_path is "\-" then lines are read from standard input. +.br +Since \-getfattr and getfattr \-Rd strip leading "/" from file paths, the setting +of \-cd does always matter. +.br +Empty input lines and lines which begin by "#" will be ignored +(except "# file:"). Line "@" ends the list, "@@@" aborts without changing +the pending iso_rr_path. Other input lines must have the form +.br + name="value" +.br +Name must be from user namespace. I.e. user.xyz where xyz should consist of +printable characters only. The separator "=" is not allowed in names. +Value may contain any kind of bytes. It must be in quotes. Trailing +whitespace after the end quote will be ignored. Non\-printables bytes and quotes +must be represented as \\XYZ by their octal ASCII code XYZ. +Use code \\000 for 0\-bytes. +.TP +\fB\-alter_date\fR type timestring iso_rr_path [***] +Alter the date entries of a file in the ISO image. type is +one of "a", "m", "b" for access time, modification time, +both times. +.br +timestring may be in the following formats +(see also section EXAMPLES): +.br +As expected by program date: + MMDDhhmm[[CC]YY][.ss]] +.br +As produced by program date: +.br + [Day] MMM DD hh:mm:ss [TZON] YYYY +.br +Relative times counted from current clock time: +.br + +|\-Number["s"|"h"|"d"|"w"|"m"|"y"] +.br +where "s" means seconds, "h" hours, "d" days, "w" weeks, "m"=30d, +"y"=365.25d plus 1d added to multiplication result. +.br +Absolute seconds counted from Jan 1 1970: +.br + =Number +.br +\fBxorriso\fR's own timestamps: +.br + YYYY.MM.DD[.hh[mm[ss]]] +.br +scdbackup timestamps: +.br + YYMMDD[.hhmm[ss]] +.br +where "A0" is year 2000, "B0" is 2010, etc. +.TP +\fB\-alter_date_r\fR type timestring iso_rr_path [***] +Like \-alter_date but affecting all files below eventual directories. +.TP +\fB\-hide\fR hide_state iso_rr_path [***] +Prevent the names of the given files from showing up in the directory trees +of ISO 9660 and/or Joliet when the image gets written. +The data content of such hidden files will be included in the +resulting image, even if they do not show up in any directory. +But you will need own means to find nameless data in the image. +.br +Warning: Data which are hidden from the ISO 9660 tree will not be copied +by the write method of modifying. +.br +Possible values of hide_state are: "iso_rr" for hiding from ISO 9660 tree, +"joliet" for Joliet tree, "on" for both trees. "off" means visibility in +both directory trees. +.br +This command does not apply to the boot catalog. +Rather use: \-boot_image "any" "cat_hidden=on" +.TP +.B Tree traversal command -find: +.PP +.TP +\fB\-find\fR iso_rr_path [test [op] [test ...]] [-exec action [params]] -- +A restricted substitute for shell command find in the ISO image. +It performs an action on matching file objects at or below iso_rr_path. +.br +If not used as last command in the line then the argument list +needs to get terminated by "\-\-". +.br +Tests are optional. If they are omitted then action is applied to all file +objects. If tests are given then they form together an expression. +The action is applied only if the expression matches the file object. Default +expression operator between tests is \-and, i.e. the expression matches only +if all its tests match. +.br +Available tests are: +.br +\fB\-name\fR pattern : +Matches if pattern matches the file leaf name. +.br +\fB\-wholename\fR pattern : +Matches if pattern matches the file path as it would be printed by action +"echo". Character '/' is not special but can be matched by wildcards. +.br +\fB\-disk_name\fR pattern : +Like \-name but testing the leaf name of the file source on disk. +Can be true only for data files which stem not from the loaded image. +.br +\fB\-type\fR type_letter : +Matches files of the given type: +"block", "char", "dir", "pipe", "file", "link", "socket", "eltorito", +and "Xotic" which matches what is not matched by the other types. +.br +Only the first letter is interpreted. E.g.: \-find / \-type d +.br +\fB\-damaged\fR : +Matches files which use data blocks marked as damaged by a previous +run of \-check_media. The damage info vanishes when a new ISO image gets +loaded. +.br +Note that a MD5 session mismatch marks all files of the session as damaged. +If finer distinction is desired, perform \-md5 off before \-check_media. +.br +\fB\-pending_data\fR : +Matches files which get their content from outside the loaded ISO image. +.br +\fB\-lba_range\fR start_lba block_count : +Matches files which use data blocks within the range of start_lba +and start_lba+block_count\-1. +.br +\fB\-has_acl\fR : +Matches files which have a non\-trivial ACL. +.br +\fB\-has_xattr\fR : +Matches files which have xattr name\-value pairs from user namespace. +.br +\fB\-has_aaip\fR : +Matches files which have ACL or any xattr. +.br +\fB\-has_any_xattr\fR : +Matches files which have any xattr other than ACL. +.br +\fB\-has_md5\fR : +Matches data files which have MD5 checksums. +.br +\fB\-has_filter\fR : +Matches files which are filtered by \-set_filter. +.br +\fB\-hidden\fR hide_state : +Matches files which are hidden in "iso_rr" tree, in "joliet" tree, +in both trees ("on"), or not hidden in any tree ("off"). +Those which are hidden in some tree match \-not \-hidden "off". +.br +\fB\-prune\fR : +If this test is reached and the tested file is a directory then \-find will not +dive into that directory. This test itself does always match. +.br +\fB\-decision\fR "yes"|"no" : +If this test is reached then the evaluation ends immediately and action +is performed if the decision is "yes" or "true". See operator \-if. +.br +\fB\-true\fR and \fB\-false\fR : +Always match resp. match not. Evaluation goes on. +.br +\fB\-sort_lba\fR : +Always match. This causes \-find to perform its action in a sequence sorted by +the ISO image block addresses of the files. It may improve throughput with +actions which read data from optical drives. Action will always get the +absolute path as parameter. +.br +Available operators are: +.br +\fB\-not\fR : +Matches if the next test or sub expression does not match. +Several tests do this specifically: +.br +\-undamaged, \-lba_range with negative start_lba, \-has_no_acl, \-has_no_xattr, +\-has_no_aaip, \-has_no_filter . +.br +\fB\-and\fR : +Matches if both neighboring tests or expressions match. +.br +\fB\-or\fR : +Matches if at least one of both neighboring tests or expressions matches. +.br +\fB\-sub\fR ... \fB\-subend\fR or \fB(\fR ... \fB)\fR : +Enclose a sub expression which gets evaluated first before it +is processed by neighboring operators. +Normal precedence is: \-not, \-or , \-and. +.br +\fB\-if\fR ... \fB\-then\fR\ ... \fB\-elseif\fR ... \fB\-then\fR ... +\fB\-else\fR ... \fB\-endif\fR : +Enclose one or more sub expressions. If the \-if expression matches, then +the \-then expression is evaluated as the result of the whole expression +up to \-endif. Else the next \-elseif expression is evaluated and if it matches, +its \-then expression. Finally in case of no match, the \-else expression +is evaluated. +There may be more than one \-elseif. Neither \-else nor \-elseif are mandatory. +If \-else is missing and would be hit, then the result is a non\-match. +.br +\-if\-expressions are the main use case for above test \-decision. + +Default action is \fBecho\fR, +i.e. to print the address of the found file. Other actions are certain +\fBxorriso\fR commands which get performed on the found files. +These commands +may have specific parameters. See also their particular descriptions. +.br +\fBchown\fR and \fBchown_r\fR +change the ownership and get the user id +as parameter. E.g.: \-exec chown thomas \-\- +.br +\fBchgrp\fR and \fBchgrp_r\fR +change the group attribute and get the group id +as parameter. E.g.: \-exec chgrp_r staff \-\- +.br +\fBchmod\fR and \fBchmod_r\fR +change access permissions and get a mode string +as parameter. E.g.: \-exec chmod a\-w,a+r \-\- +.br +\fBalter_date\fR and \fBalter_date_r\fR +change the timestamps. They get a type +character and a timestring as parameters. +.br +E.g.: \-exec alter_date "m" "Dec 30 19:34:12 2007" \-\- +.br +\fBlsdl\fR +prints file information like shell command ls \-dl. +.br +\fBcompare\fR +performs command \-compare with the found file address as +iso_rr_path and the corresponding file address below its argument +disk_path_start. For this the iso_rr_path of the \-find command gets +replaced by the disk_path_start. +.br +E.g.: \-find /thomas \-exec compare /home/thomas \-\- +.br +\fBupdate\fR +performs command \-update with the found file address as +iso_rr_path. The corresponding file address is determined like with above +action "compare". +.br +\fBupdate_merge\fR +is like update but does not delete the found file if it is missing on disk. +It may be run several times and records with all visited files whether their +counterpart on disk has already been seen by one of the update_merge runs. +Finally, a \-find run with action "rm_merge" may remove all files that +saw no counterpart on disk. +.br +Up to the next "rm_merge" or "clear_merge" all newly inserted files will +get marked as having a disk counterpart. +.br +\fBrm\fR +removes the found iso_rr_path from the image if it is not a directory +with files in it. I.e. this "rm" includes "rmdir". +.br +\fBrm_r\fR +removes the found iso_rr_path from the image, including whole +directory trees. +.br +\fBrm_merge\fR +removes the found iso_rr_path if it was visited by one or more previous actions +"update_merge" and saw no counterpart on disk in any of them. The marking from +the update actions is removed in any case. +.br +\fBclear_merge\fR +removes an eventual marking from action "update_merge". +.br +\fBreport_damage\fR +classifies files whether they hit a data block that is +marked as damaged. The result is printed together with the address +of the first damaged byte, the maximum span of damages, file size, and the +path of the file. +.br +\fBreport_lba\fR +prints files which are associated to image data blocks. +It tells the logical block address, the block number, the byte size, +and the path of each file. There may be reported more than one +line per file if the file is very large. In this case each line has a +different extent number in column "xt". +.br +\fBgetfacl\fR +prints access permissions in ACL text form to the result channel. +.br +\fBsetfacl\fR +attaches ACLs after removing existing ones. The new +ACL is given in text form as defined with option \-setfacl. +.br +E.g.: \-exec setfacl u:lisa:rw,u::rw,g::r,o::\-,m::rw \-\- +.br +\fBgetfattr\fR +prints xattr name\-value pairs from user namespace +to the result channel. +.br +\fBget_any_xattr\fR +prints xattr name\-value pairs from any namespace +except ACL to the result channel. This is mostly for debugging of +namespace "isofs". +.br +\fBlist_extattr\fR mode +prints a script to the result channel, which would use FreeBSD command +setextattr to set the file's xattr name\-value pairs of user namespace. +Parameter mode controls the form of the output of names and values. +Default mode "e" prints harmless characters in shell quotation marks, +but represents texts with octal 001 to 037 and 0177 to 0377 by an embedded +echo \-e command. +Mode "q" prints any characters in shell quotation marks. This might not be +terminal\-safe but should work in script files. +Mode "r" uses no quotation marks. Not safe. +Mode "b" prints backslash encoding. Not suitable for shell parsing. +.br +E.g. \-exec list_extattr e \-\- +.br +Option \-backslash_codes does not affect the output. +.br +\fBget_md5\fR +prints the MD5 sum, if recorded, together with file path. +.br +\fBcheck_md5\fR +compares the MD5 sum, if recorded, with the file content +and reports if mismatch. +.br +E.g.: \-find / \-not \-pending_data \-exec check_md5 FAILURE \-\- +.br +\fBmake_md5\fR +equips a data file with an MD5 sum of its content. Useful to +upgrade the files in the loaded image to full MD5 coverage by the next +commit with \-md5 "on". +.br +E.g.: \-find / \-type f \-not \-has_md5 \-exec make_md5 \-\- +.br +\fBsetfattr\fR +sets or deletes xattr name value pairs. +.br +E.g.: \-find / \-has_xattr \-exec setfattr \-\-remove\-all '' \-\- +.br +\fBset_filter\fR +applies or removes filters. +.br +E.g.: \-exec set_filter \-\-zisofs \-\- +.br +\fBmkisofs_r\fR +applies the rules of mkisofs \-r to the file object: +.br +user id and group id become 0, all r\-permissions get granted, all w denied. +If there is any x\-permission, then all three x get granted. +s\- and t\-bits get removed. +.br +\fBsort_weight\fR +attributes a LBA weight number to regular files. +.br +The number may range from \-2147483648 to 2147483647. The higher it is, the +lower will be the block address of the file data in the emerging ISO image. +Currently the boot catalog has a hardcoded weight of 1 billion. +Normally it should occupy the block with the lowest possible address. +Data files get added or loaded with initial weight 0. +.br +E.g.: \-exec sort_weight 3 \-\- +.br +\fBshow_stream\fR +shows the content stream chain of a data file. +.br +\fBhide\fR +brings the file into one of the hide states "on", "iso_rr", "joliet", "off". +.br +E.g.: +.br + \-find / \-disk_name *_secret \-exec hide on +.br +\fBestimate_size\fR +prints a lower and an upper estimation of the number of blocks which the +found files together will occupy in the emerging ISO image. +This does not account for the superblock, +for the directories in the \-find path, or for image padding. +.br +\fBfind\fR +performs another run of \-find on the matching file address. +It accepts the same params as \-find, except iso_rr_path. +.br +E.g.: +.br + \-find / \-name '???' \-type d \-exec find \-name '[abc]*' \-exec chmod a\-w,a+r \-\- +.TP +.B Filters for data file content: +.PP +\fBFilters\fR may be installed between data files in the ISO image and their +content source outside the image. They may also be used vice versa between +data content in the image and target files on disk. +.br +Built\-in filters are "\-\-zisofs" and +"\-\-zisofs\-decode". The former is to be +applied via \-set_filter, the latter is automatically applied if zisofs +compressed content is detected with a file when loading the ISO image. +.br +Another built\-in filter pair is "\-\-gzip" +and "\-\-gunzip" with suffix ".gz". +They behave about like external gzip and gunzip but avoid forking a process +for each single file. So they are much faster if there are many small files. +.PP +.TP +\fB\-external_filter\fR name option[:option] program_path [arguments] -- +Register a content filter by associating a name with a program path, +program arguments, and some behavioral options. Once registered it can be +applied to multiple data files in the ISO image, regardless whether their +content resides in the loaded ISO image or in the local filesystem. +External filter processes may produce synthetic file content by reading the +original content from stdin and writing to stdout whatever they want. +They must deliver the same output on the same input in repeated runs. +.br +Options are: +.br + "default" means that no other option is intended. +.br + "suffix=..." sets a file name suffix. If it is not empty then it will be +appended to the file name or removed from it. +.br + "remove_suffix" will remove a file name suffix +rather than appending it. +.br + "if_nonempty" will leave 0\-sized files unfiltered. +.br + "if_reduction" will try filtering and revoke it if the content size does not +shrink. +.br + "if_block_reduction" will revoke if the number of 2 kB blocks does not shrink. +.br + "used=..." is ignored. Command \-status shows it with the number of +files which currently have the filter applied. +.br +Examples: +.br + \-external_filter bzip2 suffix=.bz2:if_block_reduction \\ +.br + /usr/bin/bzip2 \-\- +.br + \-external_filter bunzip2 suffix=.bz2:remove_suffix \\ +.br + /usr/bin/bunzip2 \-\- +.TP +\fB\-unregister_filter\fR name +Remove an \-external_filter registration. This is only possible if the filter +is not applied to any file in the ISO image. +.TP +\fB\-close_filter_list\fR +Irrevocably ban commands \-external_filter and \-unregister_filter, +but not \-set_filter. Use this to prevent external filtering in general or +when all intended filters are registered. +External filters may also be banned totally at compile time of +\fBxorriso\fR. +By default they are banned if \fBxorriso\fR runs under setuid permission. +.TP +\fB\-set_filter\fR name iso_rr_path [***] +Apply an \-external_filter or a built\-in filter to the given data files in the +ISO image. +If the filter suffix is not empty , then it will be applied to the file name. +Renaming only happens if the filter really gets attached and is not revoked by +its options. +By default files which already bear the suffix will not get filtered. The +others will get the suffix appended to their names. +If the filter has option "remove_suffix", then the filter will only be +applied if the suffix is present and can be removed. +Name oversize or collision caused by suffix change will prevent filtering. +.br +With most filter types this command will immediately run the filter once for +each file in order to determine the output size. +Content reading operations like \-extract , \-compare and image generation will +perform further filter runs and deliver filtered content. +.br +At image generation time the filter output must still be the same as the +output from the first run. Filtering for image generation does not happen +with files from the loaded ISO image if the write method of growing is in +effect (i.e \-indev and \-outdev are identical). +.br +The reserved filter name "\-\-remove\-all\-filters" revokes +filtering. This will revoke suffix renamings as well. +Use "\-\-remove\-all\-filters+" to +prevent any suffix renaming. +.TP +\fB\-set_filter_r\fR name iso_rr_path [***] +Like \-set_filter but affecting all data files below eventual directories. +.TP +.B Writing the result, drive control: +.PP +(see also paragraph about settings below) +.TP +\fB\-rollback\fR +Discard the manipulated ISO image and reload it from \-indev. +(Use \-rollback_end if immediate program end is desired.) +.TP +\fB\-commit\fR +Perform the write operation. Afterwards, if \-outdev is readable, make it +the new \-dev and load the image from there. +Switch to growing mode. +(A subsequent \-outdev will activate modification mode or blind growing.) +\-commit is performed automatically at end of program if there +are uncommitted manipulations pending. +.br +So, to perform a final write operation with no new \-dev +and no new loading of image, rather execute option \-end. +If you want to go on without image loading, execute \-commit_eject "none". +To eject after write without image loading, use \-commit_eject "all". +.br +To suppress a final write, execute \-rollback_end. +.br + +Writing can last quite a while. It is not unnormal with several +types of media that there is no progress visible for the first +few minutes or that the drive gnaws on the medium for a few +minutes after all data have been transmitted. +\fBxorriso\fR and the drives are in a client\-server relationship. +The drives have much freedom about what to do with the media. +Some combinations of drives and media simply do not work, +despite the promises by their vendors. +If writing fails then try other media or another drive. The reason +for such failure is hardly ever in the code of the various +burn programs but you may well try some of those listed below +under SEE ALSO. +.TP +\fB\-eject\fR "in"|"out"|"all" +Eject the medium in \-indev, resp. \-outdev, resp. both drives. +Note: It is not possible yet to effectively eject disk files. +.TP +\fB\-commit_eject\fR "in"|"out"|"all"|"none" +Combined \-commit and \-eject. When writing has finished do not make +\-outdev the new \-dev, and load no ISO image. Rather eject +\-indev and/or \-outdev. Give up any non\-ejected drive. +.TP +\fB\-blank\fR mode +Make media ready for writing from scratch (if not \-dummy is activated). +.br +This affects only the \-outdev not the \-indev. +If both drives are the same and if the ISO image was altered +then this command leads to a FAILURE event. +Defined modes are: + as_needed, fast, all, deformat, deformat_quickest +.br +"as_needed" cares for used CD\-RW, DVD\-RW and for used overwriteable media +by applying \-blank "fast". It applies \-format "full" to yet unformatted +DVD\-RAM and BD\-RE. Other media in blank state are gracefully ignored. +Media which cannot be made ready for writing from scratch cause a FAILURE +event. +.br +"fast" makes CD\-RW and unformatted DVD\-RW re\-usable, or invalidates +overwriteable ISO images. "all" might work more thoroughly and need more time. +.br +"deformat" converts overwriteable DVD\-RW into unformatted ones. +.br +"deformat_quickest" is a faster way to deformat or blank DVD\-RW +but produces media which are only suitable for a single session. +Some drives announce this state by not offering feature 21h, +but some drives offer it anyway. +If feature 21h is missing, then \fBxorriso\fR +will refuse to write on DVD\-RW if not option \-close is set to "on". +.br +The progress reports issued by some drives while blanking are +quite unrealistic. Do not conclude success or failure from the +reported percentages. Blanking was successful if no SORRY event or +worse occured. +.TP +\fB\-format\fR mode +Convert unformatted DVD\-RW into overwriteable ones, "de\-ice" DVD+RW, format +newly purchased BD\-RE or BD\-R, re\-format DVD\-RAM or BD\-RE. +.br +Defined modes are: +.br + as_needed, full, fast, by_index_<num>, fast_by_index_<num> +.br +"as_needed" formats yet unformatted DVD\-RW, DVD\-RAM, BD\-RE, or blank +unformatted BD\-R. Other media are left untouched. +.br +"full" (re\-)formats DVD\-RW, DVD+RW, DVD\-RAM, BD\-RE, or blank unformatted BD\-R. +.br +"fast" does the same as "full" but tries to be quicker. +.br +"by_index_" selects a format out of the descriptor list issued by option +\-list_formats. The index number from that list is to be appended to the +mode word. E.g: "by_index_3". +.br +"fast_by_index_" does the same as "by_index_" but tries to be quicker. +.br +"by_size_" selects a format out of the descriptor list which provides at +least the given size. That size is to be appended to the mode word. +E.g: "by_size_4100m". This applies to media with Defect Management. +.br +"fast_by_size_" does the same as "by_size_" but tries to be quicker. +.br +The formatting action has no effect on media if \-dummy is activated. +.br +Formatting is normally needed only once during the lifetime of a medium, +if ever. But it is a reason for re\-formatting if: +.br + DVD\-RW was deformatted by \-blank, +.br + DVD+RW has read failures (re\-format before next write), +.br + DVD\-RAM or BD\-RE shall change their amount of defect reserve. +.br +BD\-R may be written unformatted or may be formatted before first use. +Formatting activates Defect Management which tries to catch and repair +bad spots on media during the write process at the expense of half speed +even with flawless media. +.br +The progress reports issued by some drives while formatting are +quite unrealistic. Do not conclude success or failure from the +reported percentages. Formatting was successful if no SORRY event +or worse occured. Be patient with apparently frozen progress. +.TP +\fB\-list_formats\fR +Put out a list of format descriptors as reported by the output drive for +the current medium. The list gives the index number after "Format idx", +a MMC format code, the announced size in blocks (like "2236704s") +and the same size in MiB. +.br +MMC format codes are manifold. Most important are: +"00h" general formatting, "01h" increases reserve space for DVD\-RAM, +"26h" for DVD+RW, "30h" for BD\-RE with reserve space, +"31h" for BD\-RE without reserve space, "32h" for BD\-R. +.br +Smaller format size with DVD\-RAM, BD\-RE, or BD\-R means more reserve space. +.TP +\fB\-list_speeds\fR +Put out a list of speed values as reported by the output drive with +the loaded medium. This does not necessarily mean that the medium is writable +or that these speeds are actually achievable. Especially the +lists reported with empty drive or with ROM media obviously advertise +speeds for other media. +.br +It is not mandatory to use speed values out of the listed range. +The drive is supposed to choose a safe speed that is as near to the desired +speed as possible. +.br +At the end of the list, "Write speed L" and "Write speed H" +are the best guesses for lower and upper speed limit. +"Write speed l" and "Write speed h" may appear only with CD +and eventually override the list of other speed offers. +.TP +\fB\-close_damaged\fR "as_needed"|"force" +Try to close the upcomming track and session if the drive reported the medium +as damaged. This may apply to CD\-R, CD\-RW, DVD\-R, DVD\-RW, DVD+R, DVD+R DL, +or BD\-R media. It is indicated by warning messages when the drive gets +aquired, and by a remark "but next track is damaged" with the line +"Media status :" of command \-toc. +.br +The setting of option \-close determines whether the medium stays appendable. +.br +Mode "as_needed" gracefully refuses on media which are not reported as +damaged. Mode "force" attempts the close operation even with media which +appear undamaged. +.br +No image changes are allowed to be pending before this command is performed. +After closing was attempted, both drives are given up. +.TP +\fB\-list_profiles\fR "in"|"out"|"all" +Put out a list of media types supported by \-indev, resp. \-outdev, resp. both. +The currently recognized type is marked by text "(current)". +.TP +.B Settings for result writing: +.PP +Rock Ridge info will be generated by the program unconditionally. +ACLs will be written according to the setting of option \-acl. +.TP +\fB\-joliet\fR "on"|"off" +If enabled by "on", generate Joliet tree additional to ISO 9660 + Rock Ridge +tree. +.TP +\fB\-compliance\fR rule[:rule...] +Adjust the compliance to specifications of ISO 9660 and its contemporary +extensions. In some +cases it is worth to deviate a bit in order to circumvent bugs of the intended +reader system or to get unofficial extra features. +.br +There are several adjustable rules which have a keyword each. If they +are mentioned with this option then their rule gets added to the relaxation +list. This list can be erased by rules "strict" or "clear". It can be reset +to its start setting by "default". All of the following relaxation rules +can be revoked individually by appending "_off". Like "deep_paths_off". +.br +Rule keywords are: +.br +"iso_9660_level="number chooses level 1 with ISO names of the form 8.3 +and \-file_size_limit <= 4g \- 1, or level 2 with ISO names up to +length 32 and the same \-file_size_limit, or level 3 with ISO names up to +length 32 and \-file_size_limit >= 400g \-200k. If necessary \-file_size_limit +gets adjusted. +.br +"allow_dir_id_ext" allows ISO names of directories to have a name extension +as with other file types. It does not force dots and it omits the version +number, though. This is a bad tradition of mkisofs which violates ECMA\-119. +Especially ISO level 1 only allows 8 characters in a directory name and +not 8.3. +.br +"omit_version" does not add versions (";1") to ISO and Joliet file names. +.br +"only_iso_version" does not add versions (";1") to Joliet file names. +.br +"deep_paths" allows ISO file paths deeper than 8 levels. +.br +"long_paths" allows ISO file paths longer than 255 characters. +.br +"long_names" allows up to 37 characters with ISO file names. +.br +"no_force_dots" does not add a dot to ISO file names which have none. +.br +"no_j_force_dots" does not add a dot to Joliet file names which have none. +.br +"lowercase" allows lowercase characters in ISO file names. +.br +"full_ascii" allows all ASCII characters in ISO file names. +.br +"untranslated_names" might be dangerous for inadverted reader programs +which rely on the restriction to at most 37 characters in ISO file names. +This option allows ISO file names up to 96 characters with no character +conversion. If a file name has more characters, then image production will +fail deliberately. +.br +"untranslated_name_len="number enables untranslated_names with a smaller limit +for the length of file names. 0 disables this feature, \-1 chooses maximum +length limit, numbers larger than 0 give the desired length limit. +.br +"joliet_long_names" allows Joliet leaf names up to 103 characters rather +than 64. +.br +"joliet_long_paths" allows Joliet paths longer than 240 characters. +.br +"always_gmt" stores timestamps in GMT representation with timezone 0. +.br +"rec_mtime" records with ISO files the disk file's mtime and not the +creation time of the image. +.br +"new_rr" uses Rock Ridge version 1.12 (suitable for GNU/Linux but not for older +FreeBSD or for Solaris). This implies "aaip_susp_1_10_off" which may be changed +by subsequent "aaip_susp_1_10". +.br +Default is "old_rr" which uses Rock Ridge version 1.10. This implies also +"aaip_susp_1_10" which may be changed by subsequent "aaip_susp_1_10_off". +.br +"aaip_susp_1_10" allows AAIP to be written as unofficial extension of RRIP +rather than as official extension under SUSP\-1.12. +.br +"no_emul_toc" saves 64 kB with the first session on overwriteable media +but makes the image incapable of displaying its session history. +.br +"iso_9660_1999" causes the production of an additional directory tree +compliant to ISO 9660:1999. It can record long filenames for readers which +do not understand Rock Ridge. +.br +"old_empty" uses the old way of of giving block addresses in the range +of [0,31] to files with no own data content. The new way is to have +a dedicated block to which all such files will point. +.br +Default setting is +.br + "clear:only_iso_version:deep_paths:long_paths:no_j_force_dots: +.br + always_gmt:old_rr". +.br +Note: The term "ISO file" means the plain ISO 9660 names and attributes +which get visible if the reader ignores Rock Ridge. +.TP +\fB\-volid\fR text +Specify the volume ID. \fBxorriso\fR accepts any text up to 32 characters, +but according to rarely obeyed specs stricter rules apply: +.br +ECMA 119 demands ASCII characters out of [A\-Z0\-9_]. Like: "IMAGE_23" +.br +Joliet allows 16 UCS\-2 characters. Like: "Windows name" +.br +Be aware that the volume id might get used automatically as name of the +mount point when the medium is inserted into a playful computer system. +.br +If an ISO image gets loaded while the volume ID is set to default "ISOIMAGE" +or to "", then the volume ID of the loaded image will become the effective +volume id for the next write run. But as soon as command \-volid is performed +afterwards, this pending id is overridden by the new setting. +.br +Consider this when setting \-volid "ISOIMAGE" before executing \-dev, \-indev, +or \-rollback. +If you insist in \-volid "ISOIMAGE", set it again after those commands. +.TP +\fB\-volset_id\fR text +Set the volume set id string to be written with the next \-commit. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +.TP +\fB\-publisher\fR text +Set the publisher id string to be written with the next \-commit. This may +identify the person or organisation who specified what shall be recorded. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +.TP +\fB\-application_id\fR text +Set the application id string to be written with the next \-commit. This may +identify the specification of how the data are recorded. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +.br +The special text "@xorriso@" gets converted to the id string of +\fBxorriso\fR +which is normally written as \-preparer_id. It is a wrong tradition to write +the program id as \-application_id. +.TP +\fB\-system_id\fR text +Set the system id string to be written with the next \-commit. This may +identify the system which can recognize and act upon the content of the +System Area in image blocks 0 to 15. +Permissible are up to 32 characters. This setting gets overridden by +image loading. +.TP +\fB\-volume_date\fR type timestring +Set one of the four overall timestamps for subsequent image writing. +Available types are: +.br +"c" time when the volume was created. +.br +"m" time when volume was last modified. +.br +"x" time when the information in the volume expires. +.br +"f" time since when the volume is effectively valid. +.br +"uuid" sets a timestring that overrides "c" and "m" times literally. +It must consist of 16 decimal digits which form YYYYMMDDhhmmsscc, with +YYYY between 1970 and 2999. Time zone is GMT. +It is supposed to match this GRUB line: +.br + search \-\-fs\-uuid \-\-set YYYY\-MM\-DD\-hh\-mm\-ss\-cc +.br +E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). +.br +Timestrings for the other types may be given as with option \-alter_date. +They are prone to timezone computations. The timestrings "default" or +"overridden" cause default settings: "c" and "m" will show the current time +of image creation. "x" and "f" will be marked as insignificant. +"uuid" will be deactivated. +.TP +\fB\-copyright_file\fR text +Set the copyright file name to be written with the next \-commit. This should +be the ISO 9660 path of a file in the image which contains a copyright +statement. +Permissible are up to 37 characters. This setting gets overridden by +image loading. +.TP +\fB\-abstract_file\fR text +Set the abstract file name to be written with the next \-commit. This should +be the ISO 9660 path of a file in the image which contains an abstract +statement about the image content. +Permissible are up to 37 characters. This setting gets overridden by +image loading. +.TP +\fB\-biblio_file\fR text +Set the biblio file name to be written with the next \-commit. This should +be the ISO 9660 path of a file in the image which contains bibliographic +records. +Permissible are up to 37 characters. This setting gets overridden by +image loading. +.TP +\fB\-preparer_id\fR +Set the preparer id string to be written with the next \-commit. This may +identify the person or other entity which controls the preparation of the data +which shall be recorded. Normally this should be the id of \fBxorriso\fR +and not of the person or program which operates \fBxorriso\fR. +Please avoid to change it. Permissible are up to 128 characters. +.br +The special text "@xorriso@" gets converted to the id string of +\fBxorriso\fR which is default at program startup. +.br +Unlike other id strings, this setting is not influenced by image loading. +.TP +\fB\-out_charset\fR character_set_name +Set the character set to which file names get converted when writing an +image. See paragraph "Character sets" for more explanations. +When loading the written image after \-commit the setting of \-out_charset +will be copied to \-in_charset. +.TP +\fB\-uid\fR uid +User id to be used for all files when the new ISO tree gets written to media. +.TP +\fB\-gid\fR gid +Group id to be used for all files when the new ISO tree gets written to media. +.TP +\fB\-zisofs\fR option[:options] +Set global parameters for zisofs compression. This data format is recognized +and transparently uncompressed by some Linux kernels. It is to be applied +via option \-set_filter with built\-in filter "\-\-zisofs". +Parameters are: +.br + "level="[0\-9] zlib compression: 0=none, 1=fast,..., 9=slow +.br + "block_size="32k|64k|128k size of compression blocks +.br + "by_magic=on" enables an expensive test at image generation time which checks +files from disk whether they already are zisofs compressed, e.g. by program +mkzftree. +.br + "default" same as "level=6:block_size=32k:by_magic=off" +.TP +\fB\-speed\fR number[k|m|c|d|b] +Set the burn speed. Default is 0 = maximum speed. +Speed can be given in media dependent numbers or as a +desired throughput per second in MMC compliant kB (= 1000) +or MB (= 1000 kB). Media x\-speed factor can be set explicity +by "c" for CD, "d" for DVD, "b" for BD, "x" is optional. +.br +Example speeds: +.br + 706k = 706kB/s = 4c = 4xCD +.br + 5540k = 5540kB/s = 4d = 4xDVD +.br +If there is no hint about the speed unit attached, then the +medium in the \-outdev will decide. Default unit is CD = 176.4k. +.br +MMC drives usually activate their own idea of speed and take +the speed value given by the burn program only as upper limit +for their own decision. +.TP +\fB\-stream_recording\fR "on"|"off"|"full"|"data"|number +Setting "on" tries to circumvent the management of defects on DVD\-RAM, BD\-RE, +or BD\-R. Defect management keeps partly damaged media usable. But it reduces +write speed to half nominal speed even if the medium is in perfect shape. +For the case of flawless media, one may use \-stream_recording "on" to get +full speed. +.br +"full" tries full speed with all write operations, whereas "on" does this +only above byte address 32s. One may give a number of at least 16s +in order to set an own address limit. +.br +"data" causes full speed to start when superblock and directory entries are +written and writing of file content blocks begins. +.TP +\fB\-dvd_obs\fR "default"|"32k"|"64k" +GNU/Linux specific: +Set the number of bytes to be transmitted with each write operation to DVD +or BD media. A number of 64 KB may improve throughput with bus systems which +show latency problems. The default depends on media type, on option +\-stream_recording , and on compile time options. +.TP +\fB\-stdio_sync\fR "on"|"off"|number +Set the number of bytes after which to force output to stdio: pseudo drives. +This forcing keeps the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +.TP +\fB\-dummy\fR "on"|"off" +If "on" then simulate burning or refuse with FAILURE event if +no simulation is possible, do neither blank nor format. +.TP +\fB\-fs\fR number["k"|"m"] +Set the size of the fifo buffer which smoothens the data +stream from ISO image generation to media burning. Default +is 4 MiB, minimum 64 kiB, maximum 1 GiB. +The number may be followed by letter "k" or "m" +which means unit is kiB (= 1024) or MiB (= 1024 kiB). +.TP +\fB\-close\fR "on"|"off" +If "on" then mark the written medium as not appendable +any more (if possible at all with the given type of target media). +.br +This is the contrary of cdrecord, wodim, cdrskin option \-multi, +and is one aspect of growisofs option \-dvd\-compat. +.TP +\fB\-padding\fR number["k"|"m"]|"included"|"appended" +Append the given number of extra bytes to the image stream. +This is a traditional remedy for a traditional bug in block +device read drivers. Needed only for CD recordings in TAO mode. +Since one can hardly predict on what media an image might end up, +\fBxorriso\fR adds the traditional 300k of padding by default to +all images. +.br +For images which will never get to a CD it is safe to use \-padding 0 . +.br +Normally padding is not written as part of the ISO image but appended +after the image end. This is \-padding mode "appended". +.br +Emulation command \-as "mkisofs" and command \-jigdo cause padding to be +written as part of the image. +The same effect is achieved by \-padding mode "included". +.TP +.B Bootable ISO images: +.PP +Contrary to published specifications many BIOSes will load an El Torito +record from the first session on media and not from the last one, which +gets mounted by default. This makes no problems with overwriteable media, +because they appear to inadverted readers as one single session. +.br +But with multi\-session media CD\-R[W], DVD\-R[W], DVD+R, it implies that the +whole bootable system has to reside already in the first session and that +the last session still has to bear all files which the booted system expects +after mounting the ISO image. +.br +If a boot image from ISOLINUX or GRUB is known to be present on media then +it is advised to patch it +when a follow\-up session gets written. But one should not rely on the +capability to influence the bootability of the existing sessions, unless one +can assume overwriteable media. +.br +There are booting mechanisms which do not use an El Torito record but rather +start at the first bytes of the image: PC\-BIOS MBR for hard\-disk\-like devices, +MIPS Volume Header for old SGI computers, DEC Boot Block for old DECstation, +SUN Disk Label for SPARC machines. +.br +The boot firmware EFI may use programs which are located in a FAT filesystem +and announced by an MBR partition table entry. +.br +.TP +\fB\-boot_image\fR "any"|"isolinux"|"grub" +.br + "discard"|"keep"|"patch"|"show_status"|bootspec|"next" +.br +Define the handling of a set of El Torito boot images which +has been read from an existing ISO image or define how to make a prepared +boot image file set bootable. Such file sets get produced by ISOLINUX or GRUB. +.br +Each \-boot_image command has two arguments: type and setting. More than one +\-boot_image command may be used to define the handling of one or more boot +images. Sequence matters. +.br +Types \fBisolinux\fR and \fBgrub\fR care for known peculiarities. +Type \fBany\fR makes +no assumptions about the origin of the boot images. +.br + +El Torito boot images of any type can be newly inserted, or discarded, +or patched, or kept unaltered. +Whether to patch or to keep depends on whether +the boot images contain boot info tables. +.br +A boot info table needs to be patched when the boot image gets newly +introduced into the ISO image or if an existing image gets relocated. +This is automatically done if type "isolinux" or "grub" +is given, but not with "any". +.br +If patching is enabled, then boot images from previous sessions will +be checked whether they seem to bear a boot info table. If not, +then they stay unpatched. This check is not infallible. So if +you do know that the images need no patching, use "any" "keep". +"grub" "patch" will not patch EFI images (platform_id=0xef). +.br +Most safe is the default: \-boot_image "any" "discard". +.br +Advised for GRUB : \-boot_image "grub" "patch" +.br +For ISOLINUX : \-boot_image "isolinux" "patch" +.br +\fBshow_status\fR will print what is known about the loaded boot images +and their designated fate. +.br + +A \fBbootspec\fR is a word of the form name=valuei. It is used to describe +the parameters of a boot image by an El Torito record or a MBR. +The names "dir", "bin_path", "efi_path" lead to El Torito bootable images. +Name "system_area" activates a given file as MBR. +.br +On all media types this is possible within the first session. In further +sessions an existing boot image can get replaced by a new one, but depending +on the media type this may have few effect at boot time. See above. +.br +The boot image and its supporting files have to be added to the ISO image by +normal means (image loading, \-map, \-add, ...). In case of ISOLINUX the files +should reside either in ISO image directory /isolinux or in /boot/isolinux . +In that case it suffices to use as bootspec the text "dir=/isolinux" or +"dir=/boot/isolinux". E.g.: +.br + \-boot_image isolinux dir=/boot/isolinux +.br +which bundles these individual settings: +.br + \-boot_image isolinux bin_path=/boot/isolinux/isolinux.bin +.br + \-boot_image isolinux cat_path=/boot/isolinux/boot.cat +.br + \-boot_image isolinux load_size=2048 +.br + \-boot_image any boot_info_table=on +.br +An El Torito boot catalog file gets inserted into the ISO image with address +\fBcat_path=\fR at \-commit time. +It is subject to normal \-overwrite and \-reassure processing if there is already +a file with the same name. +The catalog lists the boot images and is read by the boot facility to choose +one of the boot images. But it is not necessary that it appears in the +directory tree at all. One may hide it in all trees by \fBcat_hidden=on\fR. +Other possible values are "iso_rr", "joliet", and the default "off". +.br +\fBbin_path=\fR depicts a boot image file, a binary program which is to be +started by the hardware boot facility (e.g. the BIOS) at boot time. +.br +\fBefi_path=\fR depicts a boot image file that is ready for EFI booting. +Its load_size is determined automatically, no boot info table gets +written, no boot medium gets emulated, platform_id is 0xef. +.br +\fBemul_type=\fR can be one of "no_emulation", "hard_disk", "diskette". +It controls the boot medium emulation code of a boot image. +The default "no_emulation" is suitable for ISOLINUX, GRUB, FreeBSD cdboot. +.br +\fBload_size=\fR is a value which depends on the boot image. +Default 2048 should be overridden only if a better value is known. +.br +\fBboot_info_table=on\fR may be used to apply patching to a boot image which +is given by "any" "bin_path=". "boot_info_table=off" disables patching. +.br +\fBplatform_id=\fR defines by two hex digits the Platform ID of the +boot image. "00" is 80x86 PC\-BIOS, "01" is PowerPC, "02" is Mac, "ef" is EFI. +.br +\fBid_string=\fRtext|56_hexdigits defines the ID string of the boot catalog +section where the boot image will be listed. If the value consists of 56 +characters [0\-9A\-Fa\-f] then it is converted into 28 bytes, else the first +28 characters become the ID string. +The ID string of the first boot image becomes the overall catalog ID. +It is limited to 24 characters. Other id_strings become section IDs. +.br +\fBsel_crit=\fRhexdigits defines the Selection Criteria of the boot image. +Up to 20 bytes get read from the given characters [0\-9A\-Fa\-f]. +They get attributed to the boot image entry in the catalog. +.br +\fBnext\fR ends the definition of a boot image and starts a new one. +Any following \-bootimage bootspecs will affect the new image. +The first "next" discards loaded boot images and their catalog. +.br +\fBdiscard\fR gives up an existing boot catalog and its boot images. +.br +\fBkeep\fR keeps or copies boot images unaltered and writes a new catalog. +.br +\fBpatch\fR applies patching to existing boot images +if they seem to bear a boot info table. +.br +\fBsystem_area=\fRdisk_path copies at most 32768 bytes from the given +disk file to the very start of the ISO image. +This System Area is reserved for system dependent boot software, e.g. an MBR +which can be used to boot from USB stick or hard disk. +.br +Other than a El Torito boot image, the file disk_path needs not to be added +to the ISO image. +.br +\-boot_image isolinux system_area= implies "partition_table=on". +.br +\fBpartition_table=on\fR causes a simple partition table to be written +into bytes 446 to 511 of the System Area. +.br +With type "isolinux" it shows a partition that begins at byte 0 and it causes +the LBA of the first boot image to be written into the MBR. For the first +session this works only if also "system_area=" and "bin_path=" or "dir=" +is given. +.br +With types "any" and "grub" it shows a single +partiton which starts at byte 512 and ends where the ISO image ends. +This works with or without system_area= or boot image. +.br +In follow\-up sessions the existing System Area is preserved by default. +If types "isolinux" or "grub" are set to "patch", then "partition_table=on" +is activated without new boot image. +In this case the existing System Area gets checked whether it bears addresses +and sizes as if it had been processed by "partition_table=on". If so, +then those parameters get updated when the new System Area is written. +.br +Special "system_area=/dev/zero" causes 32k of NUL\-bytes. +Use this to discard an MBR which was loaded with the ISO image. +.br +\fBpartition_offset=\fR2kb_block_adr causes a partition table with a single +partition that begins at the given block address. This is counted in 2048 byte +blocks, not in 512 byte blocks. If the block address is non\-zero then it must +be at least 16. A non\-zero partition offset causes two superblocks to be +generated and two sets of directory trees. The image is then mountable from its +absolute start as well as from the partition start. +.br +The offset value of an ISO image gets preserved when a new session is added. +So the value defined here is only in effect if a new ISO image gets written. +.br +\fBpartition_hd_cyl=\fRnumber gives the number of heads per cylinder for +the partition table. 0 chooses a default value. Maximum is 255. +.br +\fBpartition_sec_hd=\fRnumber gives the number of sectors per head for +the partition table. 0 chooses a default value. Maximum is 63. +.br +The product partition_sec_hd * partition_hd_cyl * 512 is the cylinder size. +It should be divisible by 2048 in order to allow exact alignment. +If it is too small to describe the image size by at most 1024 cylinders, +then appropriate values of partition_hd_cyl are chosen with +partition_sec_hd 32 or 63. If the image is larger than 8,422,686,720 bytes, +then the cylinder size constraints cannot be fulfilled. +.br +\fBpartition_cyl_align=\fRmode controls image size alignment to an integer +number of cylinders. It is prescribed by isohybrid specs and it seems to +please program fdisk. Cylinder size must be divisible by 2048. +Images larger than 8,323,596,288 bytes cannot be aligned. +.br +Mode "auto" is default. Alignment by padding happens only with +"isolinux" "partition_table=on". +.br +Mode "on" causes alignment by padding with "partition_table=on" for any type. +Mode "off" disables alignment for any type. +.br +\fBmips_path=\fRiso_rr_path declares a data file in the image to be a +MIPS Big Endian boot file and causes production of a MIPS Big Endian Volume +Header. This is mutually exclusive with production of other boot blocks +like MBR. +It will overwrite the first 512 bytes of any data provided by system_area=. +Up to 15 boot files can be declared by mips_path=. +.br +\fBmipsel_path=\fRiso_rr_path declares a data file in the image to be the +MIPS Little Endian boot file. This is mutually exclusive with other boot +blocks. +It will overwrite the first 512 bytes of any data provided by system_area=. +Only a single boot file can be declared by mipsel_path=. +.br +\fBsparc_label=\fRtext causes the production of a SUN Disk Label with the +given text as ASCII label. This boot block format allows to append images +for partitions 2 to 8. Partition 1 will always be the ISO image. +See option \-append_partition. +The first 512 bytes of any data provided by system_area= will be overwritten. +.br +\fBmips_discard\fR and \fBsparc_discard\fR revoke any boot file +declarations made by mips_path= or mipsel_path=. They also disable production +of SUN Disk Label. +This removes the ban on production of other boot blocks. +.br +.br +.TP +\fB\-append_partition\fR partition_number type_code disk_path +Cause a prepared filesystem image to be appended to the ISO image and to be +described by a partition table entry in a boot block at the start of the +emerging ISO image. The partition entry will bear the size of the submitted +file rounded up to the next multiple of 2048 bytes. +.br +Beware of subsequent multi\-session runs. The appended partition will get +overwritten. +.br +Partitions may be appended with boot block type MBR and with SUN Disk Label. +.br +With MBR: +.br +partition_number may be 1 to 4. Number 1 will put the whole ISO image into +the unclaimed space before partition 1. So together with most \fBxorriso\fR +MBR features, number 2 would be the most natural choice. +.br +The type_code may be "FAT12", "FAT16", "Linux", +or a hexadecimal number between 0x00 and 0xff. Not all those numbers will +yield usable results. For a list of codes search the Internet for +"Partition Types" or run fdisk command "L". +.br +The disk_path must provide the necessary data bytes at commit time. +An empty disk_path disables this feature for the given partition number. +.br +With SUN Disk Label (selected by \-boot_image any sparc_label=): +.br +partition_number may be 2 to 8. Number 1 will always be the ISO image. +Partition start addresses are aligned to 320 KiB. The type_code does not +matter. Submit 0x0. +.br +Partition image name "." causes the partition to become a copy of the next +lower valid one. +.TP +.B Jigdo Template Extraction: +.PP +From man genisoimage: +"Jigdo is a tool to help in the distribution of large files like CD and +DVD images; see http://atterer.net/jigdo/ for more details. Debian CDs +and DVD ISO images are published on the web in jigdo format to allow +end users to download them more efficiently." +.br +\fBxorriso\fR can produce a .jigdo and a .template file together with a +single\-session ISO image. +The .jigdo file contains checksums and symbolic file addresses. +The .template file contains the compressed ISO image with reference tags +instead of the content bytes of the listed files. +.br +Input for this process are the normal arguments for a \fBxorriso\fR session +on a blank \-outdev, and a .md5 file which lists those data files which may be +listed in the .jigdo file and externally referenced in the .template file. +Each designated file is represented in the .md5 file by a single text line: +.br +MD5 as 32 hex digits, 2 blanks, size as 12 decimal digits or blanks, 2 blanks, +symbolic file address +.br +The file address in an .md5 line has to bear the same basename as the +disk_path of the file which it shall match. The directory path of +the file address is decisive for To=From mapping, not for file recognition. +After To=From mapping, the file address gets written into the .jigdo +file. Jigdo restore tools will convert these addresses into really +reachable data source addresses from which they can read. +.br +If the list of jigdo parameters is not empty, then \fBxorriso\fR will +refuse to +write to non\-blank targets, it will disable multi\-session emulation, and +padding will be counted as part of the ISO image. +.br +.TP +\fB\-jigdo\fR parameter_name value +Clear Jigdo Template Extraction parameter list or add a parameter to that list. +The alias names are the corresponding genisoimage options. They are accepted +as parameter names as well. Especially they are recognized by the \-as mkisofs +emulation command. +.br +Parameter \fBclear\fR with any value empties the whole list. +No .jigdo and .template file will be produced. +.br +\fBtemplate_path\fR sets the disk_path for the .template file with the +holed and compressed ISO image copy. +.br +Alias: \-jigdo\-template +.br +\fBjigdo_path\fR sets the disk_path for the .jigdo file with the checksums +and download addresses for filling the holes in .template. +.br +Alias: \-jigdo\-jigdo +.br +\fBmd5_path\fR sets the disk_path where to find the .md5 input file. +.br +Alias: \-md5\-list +.br +\fBmin_size\fR sets the minimum size for a data file to be listed +in the .jigdo file and being a hole in the .template file. +.br +Alias: \-jigdo\-min\-file\-size +.br +\fBexclude\fR adds a regular expression pattern which will get compared +with the absolute disk_path of any data file. A match causes the file to +stay in .template in any case. +.br +Alias: \-jigdo\-exclude +.br +\fBdemand_md5\fR adds a regular expression pattern which will get compared +with the absolute disk_path of any data file that was not found in the .md5 +list. A match causes a MISHAP event. +.br +Alias: \-jigdo\-force\-md5 +.br +\fBmapping\fR adds a string pair of the form To=From to the parameter list. +If a data file gets listed in the .jigdo file, then it is referred by the +file address from its line in the .md5 file. This file address gets checked +whether it begins with the From string. If so, then this string will be +replaced by the To string and a ':' character, before it goes into the .jigdo +file. The From string should end by a '/' character. +.br +Alias: \-jigdo\-map +.br +\fBcompression\fR chooses one of "bzip2" or "gzip" for the compression of +the template file. The jigdo file is put out uncompressed. +.br +Alias: \-jigdo\-template\-compress +.br +\fBchecksum_iso\fR chooses one or more of "md5", "sha1", "sha256", "sha512" +for the auxiliary "# Image Hex" checksums in the jigdo file. The value may e.g. +look like "md5,sha1,sha512". Value "all" chooses all available algorithms. +Note that MD5 stays always enabled. +.br +Alias: \-checksum_algorithm_iso +.br +\fBchecksum_template\fR is like checksum_iso but for "# Template Hex". +.br +Alias: \-checksum_algorithm_template +.TP +.B Character sets: +.PP +File names are strings of non\-zero bytes with 8 bit each. Unfortunately +the same byte string may appear as different peculiar national characters +on differently nationalized terminals. +The meanings of byte codes are defined in \fBcharacter sets\fR which have +names. Shell command iconv \-l lists them. +.br +Character sets should not matter as long as only english alphanumeric +characters are used for file names or as long as all writers and readers +of the media use the same character set. +Outside these constraints it may be necessary to let \fBxorriso\fR +convert byte codes. +.br +There is an input conversion from input character set to the local character +set which applies when an ISO image gets loaded. A conversion from local +character set to the output character set is performed when an +image tree gets written. The sets can be defined independently by options +\-in_charset and \-out_charset. Normally one will have both identical, if ever. +.br +If conversions are desired then \fBxorriso\fR needs to know the name of the +local character set. \fBxorriso\fR can inquire the same info as +shell command +"locale" with argument "charmap". This may be influenced by environment +variables LC_ALL, LC_CTYPE, or LANG and should match the expectations of +the terminal. +.br +The default output charset is the local character set of the terminal where +\fBxorriso\fR runs. So by default no conversion happens between local +filesystem +names and emerging names in the image. The situation stays ambigous and the +reader has to riddle what character set was used. +.br +By option \-auto_charset it is possible to attribute the output charset name +to the image. This makes the situation unambigous. But if your terminal +character set does not match the character set of the local file names, +then this attribute can become plainly wrong and cause problems at read time. +To prevent this it is necessary to check whether the terminal properly +displays all intended filenames. Check especially the exotic national +characters. +.br +To enforce recording of a particular character set name without any conversion +at image generation time, set \-charset and \-local_charset to the desired name, +and enable \-backslash_codes to avoid evil character display on your terminal. +.TP +\fB\-charset\fR character_set_name +Set the character set from which to convert file names when loading an +image and to which to convert when writing an image. +.TP +\fB\-local_charset\fR character_set_name +Override the system assumption of the local character set name. +If this appears necessary, one should consider to set \-backslash_codes to +"on" in order to avoid dangerous binary codes being sent to the terminal. +.TP +.B Exception processing: +.PP +Since the tasks of \fBxorriso\fR are manifold and prone to external +influence, there +may arise the need for \fBxorriso\fR to report and handle problem events. +.br +Those events get classified when they are detected by one of the software +modules and forwarded to reporting and evaluation modules which decide about +reactions. Event classes are sorted by severity: +.br +"NEVER" The upper end of the severity spectrum. +.br +"ABORT" The program is being aborted and on its way to end. +.br +"FATAL" The main purpose of the run failed +or an important resource failed unexpectedly. +.br +"FAILURE" An important part of the job could not be performed. +.br +"MISHAP" A FAILURE which can be tolerated during ISO image generation. +.br +"SORRY" A less important part of the job could not be performed. +.br +"WARNING" A situation is suspicious of being not intended by the user. +.br +"HINT" A proposal to the user how to achieve better results. +.br +"NOTE" A harmless information about noteworthy circumstances. +.br +"UPDATE" A pacifier message during long running operations. +.br +"DEBUG" A message which would only interest the program developers. +.br +"ALL" The lower end of the severity spectrum. +.TP +\fB\-abort_on\fR severity +Set the severity threshold for events to abort the program. +.br +Useful: "NEVER", "ABORT", "FATAL", "FAILURE" , "MISHAP", "SORRY" +.br +It may become necessary to abort the program anyway, despite +the setting by this option. Expect not many "ABORT" events to +be ignorable. +.br +A special property of this option is that it works preemptive if given as +program start argument. I.e. the first \-abort_on setting among the +start arguments is in effect already when the first operations of +\fBxorriso\fR begin. Only "\-abort_on" with dash "\-" is recognized that way. +.TP +\fB\-return_with\fR severity exit_value +Set the threshold and exit_value to be returned at program end if no abort +has happened. This is to allow \fBxorriso\fR to go on after problems +but to get a failure indicating exit value from the program, nevertheless. +Useful is a value lower than the \-abort_on threshold, down to "WARNING". +.br +exit_value may be either 0 (indicating success to the starter of the program) +or a number between 32 and 63. Some other exit_values are used by +\fBxorriso\fR if it decides to abort the program run: +.br +1=abort due to external signal +.br +2=no program arguments given +.br +3=creation of \fBxorriso\fR main object failed +.br +4=failure to start libburnia\-project.org libraries +.br +5=program abort during argument processing +.br +6=program abort during dialog processing +.TP +\fB\-report_about\fR severity +Set the threshold for events to be reported. +.br +Useful: "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL" +.br +Regardless what is set by \-report_about, messages get always reported if they +reach the severity threshold of \-abort_on . +.br +Event messages are sent to the info channel "I" which is usually stderr +but may be influenced by command \-pkt_output. +Info messages which belong to no event get attributed severity "NOTE". +.br +A special property of this option is that the first \-report_about setting +among the start arguments is in effect already when the first operations +of \fBxorriso\fR begin. Only "\-report_about" with dash "\-" is +recognized that way. +.TP +\fB\-signal_handling\fR mode +Control the installation of a signal handler which shall react on external +signals (e.g. from program "kill" or from keys Ctrl+C) or on signals +caused by severe program errors. +.br +Mode "on" is the default. It uses the signal handler of libburn which produces +ugly messages but puts much effort in releasing optical drives +before \fBxorriso\fR ends. +.br +Mode "off" as first \-signal_handling among the start arguments prevents all +own signal precautions of \fBxorriso\fR. Inherited signal +handler settings stay as they are. +.br +It works like "sig_dfl" if given after other signal handling was already +established at program start. +.br +Mode "sig_dfl" uses the system provided default handling of signals, which is +normally a sudden abort of the program. To prevent stuck drives, the +libburn handler is used during burning, blanking, and formatting on MMC drives. +.br +Mode "sig_ign" tries to ignore as many signal types as possible. This imposes +the risk that \fBxorriso\fR refuses to end until externally kill \-9 +if performed. +kill \-9 then imposes the risk that the drive is left in unusable state and +needs poweroff to be reset. So during burning, blanking, and formatting +wait for at least their normal run time before killing externally. +.br +A special property of this option is that the first \-signal_handling setting +among the start arguments is in effect already when the first operations +of \fBxorriso\fR begin. Only "\-signal_handling" with dash "\-" is +recognized that way. +.TP +\fB\-error_behavior\fR occasion behavior +Control the program behavior at problem event occasions. +For now this applies to occasions "image_loading" which is given while +an image tree is read from the input device, and to "file_extraction" which +is given with osirrox options like \-extract. +.br +With "image_loading" there are three behaviors available: +.br +"best_effort" goes on with reading after events with severity below FAILURE +if the threshold of option \-abort_on allows this. +.br +"failure" aborts image tree reading on first event of at least SORRY. +It issues an own FAILURE event. +This is the default. +.br +"fatal" acts like "failure" but issues the own event as FATAL. +.br +With occasion "file_extraction" there are three behaviors: +.br +"keep" maintains incompletely extracted files on disk. This is the default. +.br +"delete" removes files which encountered errors during content extraction. +.br +"best_effort" starts a revovery attempt by means of \-extract_cut if the +file content stems from the loaded ISO image and is not filtered. +.TP +.B Dialog mode control: +.TP +\fB\-dialog\fR "on"|"off"|"single_line" +Enable or disable to enter dialog mode after all arguments are processed. +In dialog mode input lines get prompted via readline or from stdin. +.br +If no \-abort_on severity was set when dialog starts, then "NEVER" is set +to avoid abort in most cases of wrong input or other problems. Before dialog +begins, the default is "FAILURE" which e.g. aborts on unknown commands. +.br +Mode "on" supports input of newline characters within quotation marks and +line continuation by trailing backslash outside quotation marks. +Mode "single_line" does not. +.TP +\fB\-page\fR length width +Describe terminal to the text pager. See also above, paragraph Result pager. +.br +If parameter length is nonzero then the user gets prompted after that +number of terminal lines. Zero length disables paging. +.br +Parameter width is the number of characters per terminal line. It is used +to compute the number of terminal lines which get occupied by an output line. +A usual terminal width is 80. +.TP +\fB\-use_readline\fR "on"|"off" +If "on" then use readline for dialog. Else use plain stdin. +.br +See also above, paragraph Dialog, Readline, Result pager. +.TP +\fB\-reassure\fR "on"|"tree"|"off" +If "on" then ask the user for "y" or "n": +.br +before deleting or overwriting any file in the ISO image, +.br +before overwriting any disk file during restore operations, +.br +before rolling back pending image changes, +.br +before committing image changes to media, +.br +before changing the input drive, +.br +before blanking or formatting media, +.br +before ending the program. +.br +With setting "tree" the reassuring prompt will appear for an eventual +directory only once and not for each file in its whole subtree. +.br +Setting "off" silently kills any kind of image file object resp. performs +above irrevocable actions. +.br +To really produce user prompts, option \-dialog needs to be set to "on". +Note that the prompt does not appear in situations where file removal +is forbidden by option \-overwrite. \-reassure only imposes an additional +curb for removing existing file objects. +.br +Be aware that file objects get deleted from the ISO image immediately +after confirmation. They are gone even if the running command gets aborted +and its desired effect gets revoked. In case of severe mess\-up, consider to +use \-rollback to revoke the whole session. +.TP +.B Drive and media related inquiry actions: +.TP +\fB\-devices\fR +Show list of available MMC drives with the addresses of +their libburn standard device files. +.br +This is only possible when no ISO image changes are pending. +After this option was executed, there is no drive current +and no image loaded. +.br +In order to be visible, a device has to offer rw\-permissions +with its libburn standard device file. Thus it might be only the +\fBsuperuser\fR +who is able to see all drives. +.br +Drives which are occupied by other processes get not shown. +.TP +\fB\-device_links\fR +Like \-devices, but presenting the drives with addresses of symbolic links +which point to the actual device files. +.br +Modern GNU/Linux systems may shuffle drive addresses from boot to boot. +The udev daemon is supposed to create links which always point to the +same drive, regardless of its system address. +The command \-device_links shows the addresses of such links if they begin +by "/dev/dvd" or "/dev/cd". +Precedence is: "dvdrw", "cdrw", "dvd", "cdrom", "cd". +.TP +\fB\-toc\fR +.br +Show media specific table of content. This is the session history +of the medium, not the ISO image directory tree. +.br +In case of overwriteable media holding a valid ISO image, it may happen that +only a single session gets shown. But if the first session on the +overwriteable media was written by \fBxorriso\fR then a complete +session history can be emulated. +.br +A drive which is incapable of writing may show any media as CD\-ROM or DVD\-ROM +with only one or two sessions on it. The last of these sessions is supposed +to be the most recent real session then. +.br +Some read\-only drives and media show no usable session history at all. +Option \-rom_toc_scan might help. +.TP +\fB\-mount_cmd\fR drive entity id path +Emit an appropriate command line for mounting the ISO session +indicated by drive, entity and id. +The result will be different on GNU/Linux and on FreeBSD. +.br +drive can be "indev" or "outdev" to indicate already acquired drives, +or it can be the path of a not yet acquired drive. +Prefix "stdio:" for non\-MMC drives is not mandatory. +.br +entity must be either "sbsector" with the superblock sector address as id, +or "track" with a track number as id, or "session" with a session number, +or "volid" with a search pattern for the volume id, or "auto" with any text +as id. +.br +path will be used as mount point and must already exist as a directory on disk. +.br +The command gets printed to the result channel. See option \-mount +for direct execution of this command. +.TP +\fB\-mount_opts\fR option[:option...] +Set options which influence \-mount and \-mount_cmd. Currently there is only +option "exclusive" which is default and its counterpart "shared". The latter +causes \fBxorriso\fR not to give up the affected drive with command \-mount. +On GNU/Linux it adds mount option "loop" which may allow to mount several +sessions of the same block device at the same time. One should not write +to a mounted optical medium, of course. Take care to umount all sessions +before ejecting. +.TP +\fB\-session_string\fR drive entity id format +Print to the result channel a text which gets composed according to +format and the parameters of the addressed session. +.br +Formats "linux:"path or "freebsd:"path produce the output of \-mount_cmd +for the given operating systems. +.br +In other texts \fBxorriso\fR will substitute the following parameter names. +An optional prefix "string:" will be removed. +.br +"%device%" will be substituted by the mountable device path of the drive +address. +.br +"%sbsector%" will be substituted by the session start sector. +.br +"%track%", "%session%", "%volid%" will be substituted by track number, +session number, resp. volume id of the depicted session. +.TP +\fB\-print_size\fR +Print the foreseeable consumption of 2048 byte blocks +by next \-commit. This can last a while as a \-commit gets +prepared and only in last moment is revoked by this option. +The result depends on several settings and also on the kind of output device. +If no \-jidgo options are given and not command \-as "mkisofs" was used, +then \-padding (300 kB by default) is not counted as part of the image size. +.TP +\fB\-tell_media_space\fR +Print available space on the output medium and the free space after +subtracting already foreseeable consumption by next \-commit. +.TP +\fB\-pvd_info\fR +Print various id strings which can be found in loaded ISO images. Some of +them may be changed by options like \-volid or \-publisher. For these +ids \-pvd_info reports what would be written with the next \-commit. +.TP +.B Navigation in ISO image and disk filesystem: +.TP +\fB\-cd\fR iso_rr_path +Change the current working directory in the ISO image. +This is prepended to iso_rr_paths which do not begin with '/'. +.br +It is possible to set the working directory to a path which does not exist +yet in the ISO image. The necessary parent directories will be created when +the first file object is inserted into that virtual directory. +Use \-mkdir if you want to enforce the existence of the directory already at +first insertion. +.TP +\fB\-cdx\fR disk_path +Change the current working directory in the local filesystem. +To be prepended to disk_paths which do not begin with '/'. +.TP +\fB\-pwd\fR +.br +Tell the current working directory in the ISO image. +.TP +\fB\-pwdx\fR +.br +Tell the current working directory in the local filesystem. +.TP +\fB\-ls\fR iso_rr_pattern [***] +List files in the ISO image which match shell patterns +(i.e. with wildcards '*' '?' '[a\-z]'). +If a pattern does not begin with '/' then it is compared with addresses +relative to \-cd. +.br +Directories are listed by their content rather than as single file item. +.br +Pattern expansion may be disabled by command \-iso_rr_pattern. +.TP +\fB\-lsd\fR iso_rr_pattern [***] +Like \-ls but listing directories as themselves and not by their content. +This resembles shell command ls \-d. +.TP +\fB\-lsl\fR iso_rr_pattern [***] +Like \-ls but also list some of the file attributes. +The output format resembles shell command ls \-ln. +.br +File type 'e' indicates the El Torito boot catalog. +.br +If the file has non\-trivial ACL, then a '+' is appended to the permission info. +If the file is hidden, then 'I' for "iso_rr", 'J' for "joliet", resp. 'H' for +"on" gets appended. Together with ACL it is 'i', 'j', resp. 'h'. +.TP +\fB\-lsdl\fR iso_rr_pattern [***] +Like \-lsd but also list some of the file attributes. +The output format resembles shell command ls \-dln. +.TP +\fB\-lsx\fR disk_pattern [***] +List files in the local filesystem which match shell patterns. Patterns which +do not begin with '/' are used relative to \-cdx. +.br +Directories are listed by their content rather than as single file item. +.br +Pattern expansion may be disabled by command \-disk_pattern. +.TP +\fB\-lsdx\fR disk_pattern [***] +Like \-lsx but listing directories as themselves and not by their content. +This resembles shell command ls \-d. +.TP +\fB\-lslx\fR disk_pattern [***] +Like \-lsx but also listing some of the file attributes. +Output format resembles shell command ls \-ln. +.TP +\fB\-lsdlx\fR disk_pattern [***] +Like \-lsdx but also listing some of the file attributes. +Output format resembles shell command ls \-dln. +.TP +\fB\-getfacl\fR iso_rr_pattern [***] +Print the access permissions of the given files in the ISO image using the +format of shell command getfacl. If a file has no ACL then it gets fabricated +from the \-chmod settings. A file may have a real ACL if it was introduced into +the ISO image while option \-acl was set to "on". +.TP +\fB\-getfacl_r\fR iso_rr_pattern [***] +Like \-gefacl but listing recursively the whole file trees underneath eventual +directories. +.TP +\fB\-getfattr\fR iso_rr_pattern [***] +Print the xattr of the given files in the ISO image. +If a file has no such xattr then noting is printed for it. +.TP +\fB\-getfattr_r\fR iso_rr_pattern [***] +Like \-gefattr but listing recursively the whole file trees underneath eventual +directories. +.TP +\fB\-du\fR iso_rr_pattern [***] +Recursively list size of directories and files in the ISO image +which match one of the patterns. +similar to shell command du \-k. +.TP +\fB\-dus\fR iso_rr_pattern [***] +List size of directories and files in the ISO image +which match one of the patterns. +Similar to shell command du \-sk. +.TP +\fB\-dux\fR disk_pattern [***] +Recursively list size of directories and files in the local filesystem +which match one of the patterns. Similar to shell command du \-k. +.TP +\fB\-dusx\fR disk_pattern [***] +List size of directories and files in the local filesystem +which match one of the patterns. +Similar to shell command du \-sk. +.TP +\fB\-findx\fR disk_path [-name pattern] [-type t] [-exec action [params]] -- +Like \-find but operating on local filesystem and not on the ISO image. +This is subject to the settings of \-follow. +.br +\-findx accepts the same \-type arguments as \-find. Additionally it recognizes +type "mountpoint" (or "m") which matches subdirectories which reside on a +different device than their parent. It never matches the disk_path +given as start address for \-findx. +.br +\-findx accepts the \-exec actions as does \-find. But except the following few +actions it will always perform action "echo". +.br +\fBin_iso\fR +reports the path if its counterpart exists in the ISO image. +For this the disk_path of the \-findx command gets replaced +by the iso_rr_path given as parameter. +.br +E.g.: \-findx /home/thomas \-exec in_iso /thomas_on_cd \-\- +.br +\fBnot_in_iso\fR +reports the path if its counterpart does +not exist in the ISO image. The report format is the same as with command +\-compare. +.br +\fBadd_missing\fR iso_rr_path_start +adds the counterpart if it does not yet +exist in the ISO image and marks it for "rm_merge" as non\-removable. +.br +E.g.: \-findx /home/thomas \-exec add_missing /thomas_on_cd \-\- +.br +\fBis_full_in_iso\fR +reports if the counterpart in the ISO image +contains files. To be used with \-type "m" to report mount points. +.br +\fBempty_iso_dir\fR +deletes all files from the counterpart +in the ISO image. To be used with \-type "m" to truncate mount points. +.br +\fBestimate_size\fR +prints a lower and an upper estimation of the number of blocks which the +found files together will occupy in the emerging ISO image. +This does not account for the superblock, +for the directories in the \-findx path, or for image padding. +.br +\fBlist_extattr\fR mode +prints a script to the result channel, which would use FreeBSD command +setextattr to set the file's xattr name\-value pairs of user namespace. +See \-find for a description of parameter mode. +.br +E.g. \-exec list_extattr e \-\- +.TP +\fB\-compare\fR disk_path iso_rr_path +Compare attributes and eventual data file content of a fileobject in the +local filesystem with a file object in the ISO image. The iso_rr_path may +well point to an image file object which is not yet committed, i.e. of which +the data content still resides in the local filesystem. Such data content is +prone to externally caused changes. +.br +If iso_rr_path is empty then disk_path is used as path in the ISO image too. +.br +Differing attributes are reported in detail, differing content is summarized. +Both to the result channel. In case of no differences no result lines are +emitted. +.TP +\fB\-compare_r\fR disk_path iso_rr_path +Like \-compare but working recursively. I.e. all file objects below both +addresses get compared whether they have counterparts below the other address +and whether both counterparts match. +.TP +\fB\-compare_l\fR disk_prefix iso_rr_prefix disk_path [***] +Perform \-compare_r with each of the disk_path arguments. iso_rr_path will be +composed from disk_path by replacing disk_prefix by iso_rr_prefix. +.TP +\fB\-show_stream\fR iso_rr_path [***] +Display the content stream chain of data files in the ISO image. The chain +consists of the iso_rr_name and one or more streams, separated by " < " marks. +A stream description consists of one or more texts, separated by ":" +characters. +The first text tells the stream type, the following ones, if ever, describe its +individual properties. +Frequently used types are: +.br + disk:'disk_path' for local filesystem objects. +.br + image:'iso_rr_path' for ISO image file objects. +.br + cout:'disk_path offset count' for \-cut_out files. +.br + extf:'filter_name' for external filters. +.br +Example: +.br + '/abc/xyz.gz' < extf:'gzip' < disk:'/home/me/x' +.TP +\fB\-show_stream_r\fR iso_rr_path [***] +Like \-show_stream but working recursively. +.TP +.B Evaluation of readability and recovery: +.PP +It is not uncommon that optical media produce read errors. The reasons may be +various and get obscured by error correction which is performed by the drives +and based on extra data on the media. If a drive returns data then one can +quite trust that they are valid. But at some degree of read problems the +correction will fail and the drive is supposed to indicate error. +.br +\fBxorriso\fR can scan a medium for readable data blocks, classify them +according +to their read speed, save them to a file, and keep track of successfuly saved +blocks for further tries on the same medium. +.br +By option \-md5 checksums may get recorded with data files and whole +sessions. These checksums are reachable only via indev and a loaded image. +They work independently of the media type and can detect transmission errors. +.TP +\fB\-check_media\fR [option [option ...]] -- +Try to read data blocks from the indev drive, optionally copy them to a +disk file, and finally report about the encountered quality. Several options +may be used to modify the default behavior. +.br +The options given with this command override the default settings which +may have been changed by option \-check_media_defaults. See there for a +description of options. +.br +The result list tells intervals of 2 KiB blocks with start address, number +of blocks and quality. Qualities which begin with "+" are +supposed to be valid readable data. Qualities with "\-" are unreadable or +corrupted data. +"0" indicates qualities which are not covered by the check run or are regularly +allowed to be unreadable (e.g. gaps between tracks). +.br +Alternatively it is possible to report damaged files rather than blocks. +.br +If \-md5 is "on" then the default mode what=tracks looks out for libisofs +checksum tags for the ISO session data and checks them +against the checksums computed from the data stream. +.TP +\fB\-check_media_defaults\fR [option [option ...]] -- +Preset options for runs of \-check_media, \-extract_cut and best_effort +file extraction. Options given with \-check_media will override the +preset options. \-extract_cut will override some options automatically. +.br +An option consists of a keyword, a "=" character, and a value. Options +may override each other. So their sequence matters. +.br +The default setting at program start is: +.br +use=indev what=tracks min_lba=\-1 max_lba=\-1 retry=default +.br +time_limit=28800 item_limit=100000 data_to='' event=ALL +.br +abort_file=/var/opt/xorriso/do_abort_check_media +.br +sector_map='' map_with_volid=off patch_lba0=off report=blocks +.br +bad_limit=valid slow_limit=1.0 chunk_size=0s +.br +Option "reset=now" restores these startup defaults. +.br +Non\-default options are: +.br +\fBreport="files"\fR +lists the files which use damaged blocks (not with use=outdev). +The format is like with find \-exec report_damage. +Note that a MD5 session mismatch marks all files of the session as damaged. +If finer distinction is desired, perform \-md5 off before \-check_media. +.br +\fBreport="blocks_files"\fR +first lists damaged blocks and then affected files. +.br +\fBuse="outdev"\fR +reads from the output drive instead of the input drive. This +avoids loading the ISO image tree from media. +.br +\fBuse="sector_map"\fR +does not read any media but loads the file given by option +sector_map= and processes this virtual outcome. +.br +\fBwhat="disc"\fR +scans the payload range of a medium without respecting track gaps. +.br +\fBwhat="image"\fR +similar to "disc", but restricts scanning to the range of the ISO 9660 image, +if present. +.br +\fBmin_lba=limit\fR +omits all blocks with addresses lower than limit. +.br +\fBmax_lba=limit\fR +switches to what=disc and omits all blocks above limit. +.br +\fBretry="on"\fR +forces read retries with single blocks when the normal read +chunk produces a read error. By default, retries are only enabled with CD +media. "retry=off" forbits retries for all media types. +.br +\fBabort_file=disk_path\fR +gives the path of the file which may abort a scan run. Abort +happens if the file exists and its mtime is not older than the start time +of the run. Use shell command "touch" to trigger this. +Other than an aborted program run, this will report the tested and untested +blocks and go on with running \fBxorriso\fR. +.br +\fBtime_limit=seconds\fR +gives the number of seconds after which the scan shall be +aborted. This is useful for unattended scanning of media which may else +overwork the drive in its effort to squeeze out some readable blocks. +Abort may be delayed by the drive gnawing on the last single read operation. +Value \-1 means unlimited time. +.br +\fBitem_limit=number\fR +gives the number of report list items after which to abort. +Value \-1 means unlimited item number. +.br +\fBdata_to=disk_path\fR +copies the valid blocks to the given file. +.br +\fBevent=severity\fR +sets the given severity for a problem event which shall be issued at +the end of a check run if data blocks were unreadable or failed to match +recorded MD5 checksums. Severity "ALL" disables this event. +.br +\fBsector_map=disk_path\fR +tries to read the file given by disk_path as +sector bitmap and to store such a map file after the scan run. +The bitmap tells which blocks have been read successfully in previous runs. +It allows to do several scans on the same medium, even with intermediate +eject, in order to collect readable blocks whenever the drive is lucky enough +to produce them. The stored file contains a human readable TOC of tracks +and their start block addresses, followed by binary bitmap data. +.br +\fBmap_with_volid="on"\fR +examines tracks whether they are ISO images and +prints their volume ids into the human readable TOC of sector_map=. +.br +\fBpatch_lba0="on"\fR +transfers within the data_to= file a copy of the currently +loaded session head to the start of that file and patches it to be valid +at that position. +This makes the loaded session the default session of the image file +when it gets mounted or loaded as stdio: drive. But it usually makes +the original session 1 inaccessible. +.br +\fBpatch_lba0="force"\fR +performs patch_lba0="on" even if \fBxorriso\fR believes +that the copied data are not valid. +.br +patch_lba0= may also bear a number. If it is 32 or higher it is taken as +start address of the session to be copied. In this case it is not necessary to +have an \-indev and a loaded image. ":force" may be appended after the number. +.br +\fBbad_limit=threshold\fR +sets the highest quality which shall be considered as damage. +Choose one of "good", "md5_match", "slow", "partial", "valid", "untested", +"invalid", "tao_end", "off_track", "md5_mismatch", "unreadable". +.br +\fBslow_limit=threshold\fR +sets the time threshold for a single read chunk to be considered +slow. This may be a fractional number like 0.1 or 1.5. +.br +\fBchunk_size=size\fR +sets the number of bytes to be read in one read operation. +This gets rounded down to full blocks of 2048 bytes. 0 means automatic size. +.TP +\fB\-check_md5\fR severity iso_rr_path [***] +Compare the data content of the given files in the loaded image with their +recorded MD5 checksums, if there are any. In case of any mismatch an event of +the given severity is issued. It may then be handled by appropriate settings of +options \-abort_on or \-return_with which both can cause non\-zero exit values +of the program run. Severity ALL suppresses that event. +.br +This option reports match and mismatch of data files to the result channel. +Non\-data files cause NOTE events. There will also be UPDATE events from +data reading. +.br +If no iso_rr_path is given then the whole loaded session is compared with its +MD5 sum. Be aware that this covers only one session and not the whole image +if there are older sessions. +.TP +\fB\-check_md5_r\fR severity iso_rr_path [***] +Like \-check_md5 but checking all data files underneath the given paths. +Only mismatching data files will be reported. +.TP +.B osirrox ISO-to-disk restore options: +.PP +Normally \fBxorriso\fR only writes to disk files which were given as stdio: +pseudo\-drives or as log files. +But its alter ego osirrox is able to extract file objects +from ISO images and to create, overwrite, or delete file objects on disk. +.br +Disk file exclusions by \-not_mgt, \-not_leaf, \-not_paths apply. +If disk file objects already exist then the settings of \-overwrite and +\-reassure apply. But \-overwrite "on" only triggers the behavior +of \-overwrite "nondir". I.e. directories cannot be deleted. +.br +Access permissions of files in the ISO image do not restrict restoring. +The directory permissions on disk have to allow rwx. +.TP +\fB\-osirrox\fR "on"|"device_files"|"off"|"banned"|[:option:...] +Setting "off" disables disk filesystem manipulations. This is the default +unless the program was started with leafname "osirrox". Elsewise +the capability to restore files can be enabled explicitly by \-osirrox "on". +It can be irrevocably disabled by \-osirrox "banned". +.br +To enable restoring of special files by "device_files" is potentially +dangerous. +The meaning of the number st_rdev (see man 2 stat) depends much on the +operating system. Best is to restore device files only to the same system +from where they were copied. If not enabled, device files in the ISO image +are ignored during restore operations. +.br +Due to a bug of previous versions, device files from previous sessions might +have been altered to major=0, minor=1. So this combination does not get +restored. +.br +Option "concat_split_on" is default. It enables restoring of split file +directories as data files if the directory contains a complete collection +of \-cut_out part files. With option "concat_split_off" such directories are +handled like any other ISO image directory. +.br +Option "auto_chmod_off" is default. If "auto_chmod_on" is set then access +restrictions for disk directories get circumvented if those directories +are owned by the effective user who runs \fBxorriso\fR. This happens +by temporarily granting rwx permission to the owner. +.br +Option "sort_lba_on" may improve read performance with optical drives. It +allows to restore large numbers of hard links without exhausting +\-temp_mem_limit. It does not preserve directory mtime and it needs +\-osirrox option auto_chmod_on in order to extract directories which offer no +write permission. Default is "sort_lba_off". +.br +Option "o_excl_on" is the default unless the program was started with leafname +"osirrox". On GNU/Linux it tries to avoid using drives which are mounted or in +use by other libburn programs. +Option "o_excl_off" allows on GNU/Linux to access such drives. Drives which +get acquired while "o_excl_off" will refuse to get blanked, formatted, +written, or ejected. But be aware that even harmless inquiries can spoil +ongoing burns of CD\-R[W] and DVD\-R[W]. +.br +Option "strict_acl_off" is default. It tolerates on FreeBSD the presence of +directory "default" ACLs in the ISO image. With "strict_acl_on" these +GNU/Linux ACLs cause on FreeBSD a FAILURE event during restore with \-acl "on". +.TP +\fB\-extract\fR iso_rr_path disk_path +Copy the file objects at and underneath iso_rr_path to their corresponding +addresses at and underneath disk_path. +This is the inverse of \-map or \-update_r. +.br +If iso_rr_path is a directory and disk_path is an existing directory then +both trees will be merged. Directory attributes get extracted only if the disk +directory is newly created by the copy operation. +Disk files get removed only if they are to be replaced +by file objects from the ISO image. +.br +As many attributes as possible are copied together with restored +file objects. +.TP +\fB\-extract_single\fR iso_rr_path disk_path +Like \-extract, but if iso_rr_path is a directory then its sub tree gets not +restored. +.TP +\fB\-extract_l\fR iso_rr_prefix disk_prefix iso_rr_path [***] +Perform \-extract with each of the iso_rr_path arguments. disk_path will be +composed from iso_rr_path by replacing iso_rr_prefix by disk_prefix. +.TP +\fB\-extract_cut\fR iso_rr_path byte_offset byte_count disk_path +Copy a byte interval from a data file out of an ISO image into a newly created +disk file. +The main purpose for this is to allow handling of large files if they +are not supported by mount \-t iso9660 and if the reading system is unable +to buffer them as a whole. +.br +If the data bytes of iso_rr_path are stored in the loaded ISO image, +and no filter is applied, +and byte_offset is a multiple of 2048, then a special run of \-check_media +is performed. It may be quicker and more rugged than the general reading +method. +.TP +\fB\-cpx\fR iso_rr_path [***] disk_path +Copy single leaf file objects from the ISO image to the address given by +disk_path. If more then one iso_rr_path is given then +disk_path must be a directory or non\-existent. In the latter case it gets +created and the extracted files get installed in it with the same leafnames. +.br +Missing directory components in disk_path will get created, if possible. +.br +Directories are allowed as iso_rr_path only with \-osirrox "concat_split_on" +and only if they actually represent a complete collection of \-cut_out split +file parts. +.TP +\fB\-cpax\fR iso_rr_path [***] disk_path +Like \-cpx but restoring mtime, atime as in ISO image and trying to set +ownership and group as in ISO image. +.TP +\fB\-cp_rx\fR iso_rr_path [***] disk_path +Like \-cpx but also extracting whole directory trees from the ISO image. +.br +The resulting disk paths are determined as with shell command cp \-r : +If disk_path is an existing directory then the trees will be inserted or merged +underneath this directory and will keep their leaf names. The ISO directory "/" +has no leaf name and thus gets mapped directly to disk_path. +.TP +\fB\-cp_rax\fR iso_rr_path [***] disk_path +Like \-cp_rx but restoring mtime, atime as in ISO image and trying to set +ownership and group as in ISO image. +.TP +\fB\-paste_in\fR iso_rr_path disk_path byte_offset byte_count +Read the content of a ISO data file and write it into a data file on disk +beginning at the byte_offset. Write at most byte_count bytes. +This is the inverse of option \-cut_out. +.TP +\fB\-mount\fR drive entity id path +Produce the same line as \-mount_cmd and then execute it as external program run +after giving up the depicted drive. See also \-mount_opts. +This demands \-osirrox to be enabled and normally will succeed only for the +superuser. For safety reasons the mount program is only executed if it is +reachable as /bin/mount or /sbin/mount. +.TP +.B Command compatibility emulations: +.PP +Writing of ISO 9660 on CD is traditionally done by program mkisofs +as ISO 9660 image producer and cdrecord as burn program. +\fBxorriso\fR does not strive for their comprehensive emulation. +Nevertheless it is ready to perform some of its core tasks under control +of commands which in said programs trigger comparable actions. +.TP +\fB\-as\fR personality option [options] -- +.br +Perform the variable length option list as sparse emulation of the program +depicted by the personality word. +.br + +Personality "\fBmkisofs\fR" accepts the options listed with: +.br + \-as mkisofs \-help \-\- +.br +Among them: \-R (always on), \-r, \-J, \-o, \-M, \-C, \-dir\-mode, \-file\-mode, +\-path\-list, \-m, \-exclude\-list, +\-f, \-print\-size, \-pad, \-no\-pad, \-V, \-v, \-version, \-graft\-points, \-z, +\-no\-emul\-boot, \-b, \-c, \-boot\-info\-table, \-boot\-load\-size, \-input\-charset, \-G, +\-output\-charset, \-U, \-hide, \-hide\-joliet, \-hide\-list, \-hide\-joliet\-list, +file paths and pathspecs. +A lot of options are not supported and lead to failure of the mkisofs +emulation. Some are ignored, but better do not rely on this tolerance. +.br +The supported options are documented in detail in xorrisofs.info +and in man xorrisofs. The description here is focused on the effect +of mkisofs emulation in the context of a \fBxorriso\fR run. +.br +Other than with the "cdrecord" personality there is no automatic \-commit at +the end of a "mkisofs" option list. Verbosity settings \-v (= "UPDATE") and +\-quiet (= "SORRY") persist. The output file +persists until things happen like \-commit, \-rollback, \-dev, or end of +\fBxorriso\fR. +\-pacifier gets set to "mkisofs" if files are added to the image. +.br +\-graft\-points is equivalent to \-pathspecs on. Note that pathspecs without "=" +are interpreted differently than with \fBxorriso\fR option \-add. +Directories get +merged with the root directory of the ISO image, other filetypes get mapped +into that root directory. +.br +If pathspecs are given and if no output file was chosen before or during the +"mkisofs" option list, then standard output (\-outdev "\-") will get into effect. +If \-o points to a regular file, then it will be truncated to 0 bytes +when finally writing begins. This truncation does not happen if the drive +is chosen by \fBxorriso\fR options before \-as mkisofs or after its +list delimiter. Directories and symbolic links are no valid \-o targets. +.br +Writing to stdout is possible only if \-as "mkisofs" was among the start +arguments or if other start arguments pointed the output drive to +standard output. +.br +\-print\-size inhibits automatic image production at program end. This ban is +lifted only if the pending image changes get discarded. +.br +Padding is counted as part of the ISO image if not option \-\-emul\-toc +is given. +.br +If no \-iso\-level is given, then level 1 is chosen when the first file or +directory is added to the image. At the same occasion directory names get +allowed to violate the standard by \-compliance option allow_dir_id_ext. +This may be avoided by option \-disallow_dir_id_ext. +.br +Option \-root is supported. Option \-old\-root is implemented by \fBxorriso\fR +commands \-mkdir, \-cp_clone, \-find update_merge, and \-find rm_merge. +\-root and \-old\-root set command \-disk_dev_ino to "ino_only" and \-md5 to "on", +by default. +\-disk_dev_ino can be set to "off" by \-\-old\-root\-no\-ino +resp. to "on" by \-\-old\-root\-devno . +\-md5 can be set to "off" by \-\-old\-root\-no\-md5 . +.br +Not original mkisofs options are \-\-quoted_path_list , +\-\-hardlinks , \-\-acl , +\-\-xattr , \-\-md5 , \-\-stdio_sync . +They work like the \fBxorriso\fR options with the +same name and hardcoded argument "on", e.g. \-acl "on". +Explicit arguments are expected by \-\-stdio_sync +and \-\-scdbackup_tag. +.br +The capability to preserve multi\-session history on overwriteable media +gets disabled by default. It can be enabled by using \-\-emul\-toc +with the first session. See \-compliance no_emul_toc. +.br +\-\-sort\-weight gets as arguments a number and an iso_rr_path. +The number becomes the LBA sorting weight of regular file iso_rr_path or +of all regular files underneath directory iso_rr_path. +(See \-find \-exec sort_weight). +.br +Adopted from grub\-mkisofs are \-\-protective\-msdos\-label +(see \-boot_image grub partition_table=on) and +\-\-modification\-date=YYYYMMDDhhmmsscc +(see \-volume_date uuid). For EFI bootable GRUB boot images use +\-\-efi\-boot. +It performs \-boot_image grub efi_path= surrounded by two +\-boot_image "any" "next". +Alternative option \-e from Fedora genisoimage sets bin_path and +platform_id for EFI, but performs no "next". +.br +For MBR bootable ISOLINUX images there is \-isohybrid\-mbr FILE, where +FILE is one of the Syslinux files mbr/isohdp[fp]x*.bin . Use this +instead of \-G to apply the effect of \-boot_image isolinux partition_table=on. +.br +\-\-boot\-catalog\-hide is \-boot_image any cat_hidden=on. +.br +\-mips\-boot is the same as \-boot_image any mips_path= . +.br +\-mipsel\-boot leads to mipsel_path= . +.br +\-partition_offset number is +\-boot_image any partition_offset=number. +.br +Option \-append_partition is supported. +.br +\-untranslated_name_len number is +\-compliance untranslated_name_len=number. +.br +\-\-old\-empty is \-compliance old_empty. +.br +The options of genisoimage Jigdo Template Extraction are recognized and +performed via \fBxorriso\fR option \-jigdo. See the "Alias:" names there +for the meaning of the genisoimage options. +.br + +Personalities "\fBxorrisofs\fR", "\fBgenisoimage\fR", +and "\fBgenisofs\fR" are aliases for "mkisofs". +.br +If \fBxorriso\fR is started with one of the leafnames "xorrisofs", +"genisofs", +"mkisofs", or "genisoimage", then it performs \-read_mkisofsrc and prepends +\-as "genisofs" to the command line arguments. +I.e. all arguments will be interpreted mkisofs style until "\-\-" +is encountered. +From then on, options are interpreted as \fBxorriso\fR options. +.br +\-\-no_rc as first argument of such a program start +prevents interpretation of startup files. See section FILES below. +.br + +Personality "\fBcdrecord\fR" accepts the options listed with: +.br + \-as cdrecord \-help \-\- +.br +Among them: \-v, dev=, speed=, blank=, fs=, \-eject, \-atip, padsize=, tsize=, +\-isosize, \-multi, \-msinfo, \-\-grow_overwriteable_iso, +write_start_address=, +track source file path or "\-" for standard input as track source. +.br +It ignores most other options of cdrecord and cdrskin but refuses on +\-audio, \-scanbus, and on blanking modes unknown to \fBxorriso\fR. +.br +The scope is only a single data track per session to be written +to blank, overwriteable, or appendable media. The medium gets closed if +closing is applicable and not option \-multi is present. +.br +If an input drive was aquired, then it is given up. +This is only allowed if no image changes are pending. +.br +dev= must be given as \fBxorriso\fR device address. Addresses like 0,0,0 +or ATA:1,1,0 are not supported. +.br +If a track source is given, then an automatic \-commit happens at the end of +the "cdrecord" option list. +.br +\-\-grow_overwriteable_iso +enables emulation of multi\-session on overwriteable +media. To enable emulation of a TOC, the first session needs \-C 0,32 with +\-as mkisofs (but no \-M) and \-\-grow_overwriteable_iso +write_start_address=32s with \-as cdrecord. +.br +A much more elaborate libburn based cdrecord emulator is the program cdrskin. +.br +Personalites "\fBxorrecord\fR", "\fBwodim\fR", and "\fBcdrskin\fR" +are aliases for "cdrecord". +.br +If \fBxorriso\fR is started with one of the leafnames "xorrecord", +"cdrskin", "cdrecord", or "wodim", then it automatically prepends \-as "cdrskin" +to the command line arguments. I.e. all arguments will be interpreted cdrecord +style until "\-\-" is encountered. +From then on, options are interpreted as \fBxorriso\fR options. +.br +\-\-no_rc as first argument of such a program start +prevents interpretation of \fBxorriso\fR startup files. +See section FILES below. +.TP +\fB\-read_mkisofsrc\fR +Try one by one to open for reading: + ./.mkisofsrc , $MKISOFSRC , $HOME/.mkisofsrc , $(dirname $0)/.mkisofsrc +.br +On success interpret the file content as of man mkisofs CONFIGURATION, +and end this command. Do not try further files. +The last address is used only if start argument 0 has a non\-trivial dirname. +.br +The reader currently interprets the following NAME=VALUE pairs: +APPI (\-application_id) , PUBL (\-publisher) , SYSI (\-system_id) , +VOLI (\-volid) , VOLS (\-volset_id) +.br +Any other lines will be silently ignored. +.TP +\fB\-pacifier\fR behavior_code +Control behavior of UPDATE pacifiers during write operations. +The following behavior codes are defined: +.br +"xorriso" is the default format: +.br +Writing: sector XXXXX of YYYYYY [fifo active, nn% fill] +.br +"cdrecord" looks like: +.br +X of Y MB written (fifo nn%) [buf mmm%] +.br +"mkisofs" +.br +nn% done, estimate finish Tue Jul 15 20:13:28 2008 +.TP +\fB\-scdbackup_tag\fR list_path record_name +Set the parameter "name" for a scdbackup checksum record. +It will be appended in an scdbackup checksum tag to the \-md5 session tag if +the image starts at LBA 0. This is the case if it gets written as first +session onto a sequential medium, or piped into a program, named pipe or +character device. +.br +If list_path is not empty then the record will also be appended to the +data file given by this path. +.br +Program scdbackup_verify will recognize and verify tag resp. record. +.TP +.B Scripting, dialog and program control features: +.TP +\fB\-no_rc\fR +.br +Only if used as first command line argument this option +prevents reading and interpretation of startup files. See section FILES below. +.TP +\fB\-options_from_file\fR fileaddress +Read quoted input from fileaddress and execute it like dialog lines. +Empty lines and lines which begin by # are ignored. Normally one line +should hold one \fBxorriso\fR command and all its arguments. +Nevertheless lines may be concatenated by a trailing backslash. +.br +See also section "Command processing", paragraph "Quoted input". +.TP +\fB\-help\fR +.br +Print helptext. +.TP +\fB\-version\fR +Print program name and version, component versions, license. +.TP +\fB\-list_extras\fR code +Tell whether certain extra features were enabled at compile time. +Code "all" lists all features and a headline. +Other codes pick a single feature. +Code "codes" lists them. They share names with related commands +(see also there): +.br +"acl" tells whether xorriso has an adapter for local filesystems ACLs. +.br +"xattr" tells whether xorriso has an adapter for local filesystems EA. +.br +"jigdo" tells whether production of Jigdo files is possible. +.br +"zisofs" tells whether zisofs and built\-in gzip filters are enabled. +.br +"external_filter" tells whether external filter processes are allowed +and whether they are allowed if real user id and effective user id differ. +.br +"dvd_obs" tells whether 64 kB output to DVD media is default. +.br +"use_readline" tells whether readline may be enabled in dialog mode. +.br +.TP +\fB\-history\fR textline +Copy textline into libreadline history. +.TP +\fB\-status\fR mode|filter +Print the current settings of \fBxorriso\fR. +Modes: +.br + short... print only important or altered settings +.br + long ... print all settings including defaults +.br + long_history like long plus history lines +.br +Filters begin with '\-' and are compared literally against the +output lines of \-status:long_history. A line is put out only +if its start matches the filter text. No wildcards. +.TP +\fB\-status_history_max\fR number +Set maximum number of history lines to be reported with \-status "long_history". +.TP +\fB\-list_delimiter\fR word +Set the list delimiter to be used instead of "\-\-". +It has to be a single word, +must not be empty, not longer than 80 characters, and must not contain +quotation marks. +.br +For brevity the list delimiter is referred as "\-\-" +throughout this text. +.TP +\fB\-backslash_codes\fR "on"|"off"|mode[:mode] +Enable or disable the interpretation of symbolic representations of special +characters with quoted input, or with program arguments, or with program +text output. If enabled the following translations apply: +.br + \\a=bell(007) \\b=backspace(010) \\e=Escape(033) \\f=formfeed(014) +.br + \\n=linefeed(012) \\r=carriage_return(015) \\t=tab(011) +.br + \\v=vtab(013) \\\\=backslash(134) \\[0\-7][0\-7][0\-7]=octal_code +.br + \\x[0\-9a\-f][0\-9a\-f]=hex_code \\cC=control\-C +.br +Translations can occur with quoted input in 3 modes: +.br + "in_double_quotes" translates only inside " quotation. +.br + "in_quotes" translates inside " and ' quotation. +.br + "with_quoted_input" translates inside and outside quotes. +.br +With the start program arguments there is mode: +.br + "with_program_arguments" translates all program arguments. +.br +.br +Mode "encode_output" encodes output characters. It combines "encode_results" +with "encode_infos". Inside single or double quotation marks encoding applies +to ASCII characters octal 001 to 037 , 177 to 377 and to backslash(134). +Outside quotation marks some harmless control characters stay unencoded: +bell(007), backspace(010), tab(011), linefeed(012), formfeed(014), +carriage_return(015). +.br +Mode "off" is default and disables any translation. +Mode "on" is +"with_quoted_input:with_program_arguments:encode_output". +.TP +\fB\-temp_mem_limit\fR number["k"|"m"] +Set the maximum size of temporary memory to be used for image dependent +buffering. Currently this applies to pattern expansion, LBA sorting, +restoring of hard links. +.br +Default is 16m = 16 MiB, minimum 64k = 64 kiB, maximum 1024m = 1 GiB. +.TP +\fB\-print\fR text +Print a text line to the result channel which is by default stdout. +.TP +\fB\-print_info\fR text +Print a text line to the info channel which is by default stderr. +.TP +\fB\-print_mark\fR text +Print a text line to the mark channel which is by default directed to both, +result and info channel. An empty text will cause no output at all. +.TP +\fB\-prompt\fR text +Show text at beginning of output line and +wait for the user to hit the Enter key +resp. to send a line via stdin. +.TP +\fB\-sleep\fR seconds +Wait for the given number of seconds before perfoming the next command. +Expect coarse granularity no better than 1/100 seconds. +.TP +\fB\-errfile_log\fR mode path|channel +.br +If problem events are related to input files from the filesystem, then their +disk_paths can be logged to a file or to output channels R or I. +.br +Mode can either be "plain" or "marked". The latter causes marker lines which +give the time of log start, burn session start, burn session end, log end +or program end. In mode "plain", only the file paths are logged. +.br +If path is "\-" or "\-R" then the log is directed to the result channel. +Path "\-I" directs it to the info message channel. Any text that does not +begin with "\-" is used as path for a file to append the log lines. +.br +Problematic files can be recorded multiple times during one program run. +If the program run aborts then the list might not be complete because +some input file arguments might not have been processed at all. +.br +The errfile paths are transported as messages of very low severity "ERRFILE". +This transport becomes visible with \-report_about "ALL". +.TP +\fB\-session_log\fR path +If path is not empty it gives the address of a plain text file where +a log record gets appended after each session. This log can be used to +determine the start_lba of a session for mount options \-o sbsector= +resp. \-s from date or volume id. +.br +Record format is: timestamp start_lba size volume\-id +.br +The first three items are single words, the rest of the line is the volume id. +.TP +\fB\-scsi_log\fR "on"|"off" +Mode "on" enables very verbous logging of SCSI commands and drive replies. +Logging messages get printed to stderr, not to any of the \fBxorriso\fR +output channels. +.br +A special property of this option is that the first \-scsi_log setting +among the start arguments is in effect already when the first operations +of \fBxorriso\fR begin. +Only "\-scsi_log" with dash "\-" is recognized that way. +.TP +\fB\-end\fR +.br +End program after writing pending changes. +.TP +\fB\-rollback_end\fR +Discard pending changes. End program immediately. +.TP +\fB#\fR any text +Only in dialog or file execution mode, and only as first +non\-whitespace in line: +Do not execute the line but store it in readline history. +.TP +.B Support for frontend programs via stdin and stdout: +.TP +\fB\-pkt_output\fR "on"|"off" +Consolidate text output on stdout and classify each +line by a channel indicator: +.br + 'R:' for result lines, +.br + 'I:' for notes and error messages, +.br + 'M:' for \-mark texts. +.br +Next is a decimal number of which only bit 0 has a meaning for now. +0 means no newline at end of payload, 1 means that the newline character at +the end of the output line belongs to the payload. After another colon and +a blank follows the payload text. +.br +Example: +.br + I:1: enter option and arguments : +.TP +\fB\-logfile\fR channel fileaddress +Copy output of a channel to the given file. Channel may be one of: "." for all +channels, "I" for info messages, "R" for result lines, "M" for \-mark texts. +.TP +\fB\-mark\fR text +If text is not empty it will get put out on "M" channel each time +\fBxorriso\fR is ready for the next dialog line or before +\fBxorriso\fR performs a command that was entered to the pager prompt. +.TP +\fB\-prog\fR text +Use text as name of this program in subsequent messages +.TP +\fB\-prog_help\fR text +Use text as name of this program and perform \-help. +.br +.SH EXAMPLES +.SS +.B Overview of examples: +As superuser learn about available drives +.br +Blank medium and compose a new ISO image as batch run +.br +A dialog session doing about the same +.br +Manipulate an existing ISO image on the same medium +.br +Copy modified ISO image from one medium to another +.br +Bring a prepared ISOLINUX tree onto medium and make it bootable +.br +Change existing file name tree from ISO-8859-1 to UTF-8 +.br +Operate on storage facilities other than optical drives +.br +Burn an existing ISO image file to medium +.br +Perform multi-session runs as of cdrtools traditions +.br +Let xorriso work underneath growisofs +.br +Adjust thresholds for verbosity, exit value and program abort +.br +Examples of input timestrings +.br +Incremental backup of a few directory trees +.br +Restore directory trees from a particular ISO session to disk +.br +Try to retrieve blocks from a damaged medium +.SS +.B As superuser learn about available drives +On Linux or FreeBSD consider to give rw\-permissions to those users or groups +which shall be able to use the drives with \fBxorriso\fR. +On Solaris use pfexec. Consider to restrict privileges of \fBxorriso\fR to +"base,sys_devices" and to give r\-permission to user or group. +.br +$ xorriso \-device_links +.br +1 \-dev '/dev/cdrom1' rwrw\-\- : 'TSSTcorp' 'DVD\-ROM SH\-D162C +.br +1 \-dev '/dev/cdrw' rwrw\-\- : 'TSSTcorp' 'CDDVDW SH\-S223B' +.br +2 \-dev '/dev/cdrw3' rwrw\-\- : 'HL\-DT\-ST' 'BDDVDRW_GGC\-H20L' +.SS +.B Blank medium and compose a new ISO image as batch run +Aquire drive /dev/sr2, make medium ready for writing a new image, +fill the image with the files from hard disk directories /home/me/sounds +and /home/me/pictures. +.br +Because no \-dialog "on" is given, the program will then end by writing the +session to the medium. +.br +$ xorriso \-outdev /dev/sr2 \\ +.br + \-blank as_needed \\ +.br + \-map /home/me/sounds /sounds \\ +.br + \-map /home/me/pictures /pictures +.br + +.br +The ISO image may be shaped in a more elaborate way like the following: +Omit some unwanted stuff by removing it from the image directory tree. +Reintroduce some wanted stuff. +.br +$ cd /home/me +.br +$ xorriso \-outdev /dev/sr2 \\ +.br + \-blank as_needed \\ +.br + \-map /home/me/sounds /sounds \\ +.br + \-map /home/me/pictures /pictures \\ +.br + \-rm_r \\ +.br + /sounds/indecent \\ +.br + '/pictures/*private*' \\ +.br + /pictures/confidential \\ +.br + \-\- \\ +.br + \-cd / \\ +.br + \-add pictures/confidential/work* \-\- +.br +Note that '/pictures/*private*' is a pattern for iso_rr_paths +while pictures/confidential/work* gets expanded by the shell +with addresses from the hard disk. Options \-add and \-map have different +argument rules but finally the same effect: they put files into the image. +.SS +.B A dialog session doing about the same +.br +Some settings are already given as start argument. The other activities +are done as dialog input. The pager gets set to 20 lines of 80 characters. +.br +The drive is acquired by option \-dev rather than \-outdev in order to see +the message about its current content. By option \-blank this content is +made ready for being overwritten and the loaded ISO image is made empty. +.br +In order to be able to eject the medium, the session needs to be committed +explicitly. +.br +.B $ xorriso -dialog on -page 20 80 -disk_pattern on +.br +enter option and arguments : +.br +.B \-dev /dev/sr2 +.br +enter option and arguments : +.br +.B \-blank as_needed +.br +enter option and arguments : +.br +.B \-map /home/me/sounds /sounds -map /home/me/pictures /pictures +.br +enter option and arguments : +.br +.B \-rm_r /sounds/indecent /pictures/*private* /pictures/confidential +.br +enter option and arguments : +.br +.B \-cdx /home/me/pictures -cd /pictures +.br +enter option and arguments : +.br +.B \-add confidential/office confidential/factory +.br +enter option and arguments : +.br +.B \-du / +.br +enter option and arguments : +.br +.B \-commit_eject all -end +.br +.br +.br +.br +.br +.br +.br +.br +.br +.SS +.B Manipulate an existing ISO image on the same medium +Load image from drive. +Remove (i.e. hide) directory /sounds and its subordinates. +Rename directory /pictures/confidential to /pictures/restricted. +Change access permissions of directory /pictures/restricted. +Add new directory trees /sounds and /movies. +Burn to the same medium, check whether the tree can be loaded, and eject. +.br +$ xorriso \-dev /dev/sr2 \\ +.br + \-rm_r /sounds \-\- \\ +.br + \-mv \\ +.br + /pictures/confidential \\ +.br + /pictures/restricted \\ +.br + \-\- \\ +.br + \-chmod go\-rwx /pictures/restricted \-\- \\ +.br + \-map /home/me/prepared_for_dvd/sounds_dummy /sounds \\ +.br + \-map /home/me/prepared_for_dvd/movies /movies \\ +.br + \-commit \-eject all +.SS +.B Copy modified ISO image from one medium to another +Load image from input drive. Do the same manipulations as in the previous +example. Aquire output drive and blank it. Burn the modified image as +first and only session to the output drive. +.br +$ xorriso \-indev /dev/sr2 \\ +.br + \-rm_r /sounds \-\- \\ +.br + ... +.br + \-outdev /dev/sr0 \-blank as_needed \\ +.br + \-commit \-eject all +.SS +.B Bring a prepared ISOLINUX tree onto medium and make it bootable +The user has already created a suitable file tree on disk and copied the +ISOLINUX files into subdirectory ./boot/isolinux of that tree. +Now \fBxorriso\fR can burn an El Torito bootable medium: +.br +$ xorriso \-outdev /dev/sr0 \-blank as_needed \\ +.br + \-map /home/me/ISOLINUX_prepared_tree / \\ +.br + \-boot_image isolinux dir=/boot/isolinux +.SS +.B Change existing file name tree from ISO-8859-1 to UTF-8 +This example assumes that the existing ISO image was written with character +set ISO\-8859\-1 but that the readers expected UTF\-8. Now a new session with +the same files gets added with converted file names. +In order to avoid any weaknesses of the local character set, this command +pretends that it uses already the final target set UTF\-8. +Therefore strange file names may appear in messages, which +will be made terminal\-safe by option \-backslash_codes. +.br +$ xorriso \-in_charset ISO\-8859\-1 \-local_charset UTF\-8 \\ +.br + \-out_charset UTF\-8 \-backslash_codes on \-dev /dev/sr0 \\ +.br + \-alter_date m +0 / \-\- \-commit \-eject all +.SS +.B Operate on storage facilities other than optical drives +Full read\-write operation is possible with regular files and block devices: +.br +$ xorriso \-dev /tmp/regular_file ... +.br +Paths underneath /dev normally need prefix "stdio:" +.br +$ xorriso \-dev stdio:/dev/sdb ... +.br +If /dev/sdb is to be used frequently and /dev/sda is the system disk, +then consider to place the following lines in a \fBxorriso\fR Startup File. +They allow to use /dev/sdb without prefix and protect disk /dev/sda +from \fBxorriso\fR: +.br + \-drive_class banned /dev/sda* +.br + \-drive_class harmless /dev/sdb +.br +Other writeable file types are supported write\-only: +.br +$ xorriso \-outdev /tmp/named_pipe ... +.br +Among the write\-only drives is standard output: +.br +$ xorriso \-outdev \- \\ +.br + ... +.br + | gzip >image.iso.gz +.SS +.B Burn an existing ISO image file to medium +Actually this works with any kind of data, not only ISO images: +.br +$ xorriso \-as cdrecord \-v dev=/dev/sr0 blank=as_needed image.iso +.SS +.B Perform multi-session runs as of cdrtools traditions +Between both processes there can be performed arbitrary transportation +or filtering. +.br +The first session is written like this: +.br +$ xorriso \-as mkisofs prepared_for_iso/tree1 | \\ +.br + xorriso \-as cdrecord \-v dev=/dev/sr0 blank=fast \-multi \-eject \- +.br +Follow\-up sessions are written like this: +.br +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +.br +$ m=$(xorriso \-as cdrecord dev=/dev/sr0 \-msinfo) +.br +$ xorriso \-as mkisofs \-M /dev/sr0 \-C $m prepared_for_iso/tree2 | \\ +.br + xorriso \-as cdrecord \-v dev=/dev/sr0 \-waiti \-multi \-eject \- +.br +Always eject the drive tray between sessions. The old sessions +get read via /dev/sr0. Its device driver might not be aware +of the changed content before it loads the medium again. +In this case the previous session would not be loaded and the +new session would contain only the newly added files. +.br +For the same reason do not let \fBxorriso\fR \-as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +.br +This example works for multi\-session media only. +Add cdrskin option \-\-grow_overwriteable_iso +to all \-as cdrecord runs +in order to enable multi\-session emulation on overwriteable media. +.SS +.B Let xorriso work underneath growisofs +growisofs expects an ISO formatter program which understands options \-C and +\-M. If \fBxorriso\fR gets started by name "xorrisofs" then it is suitable +for that. +.br +$ export MKISOFS="xorrisofs" +.br +$ growisofs \-Z /dev/dvd /some/files +.br +$ growisofs \-M /dev/dvd /more/files +.br +If no "xorrisofs" is available on your system, then you will have to create +a link pointing to the \fBxorriso\fR binary and tell growisofs to use it. +E.g. by: +.br +$ ln \-s $(which xorriso) "$HOME/xorrisofs" +.br +$ export MKISOFS="$HOME/xorrisofs" +.br +One may quit mkisofs emulation by argument "\-\-" and make +use of all \fBxorriso\fR commands. growisofs dislikes options which +start with "\-o" but \-outdev must be set to "\-". +So use "outdev" instead: +.br +$ growisofs \-Z /dev/dvd \-\- outdev \- \-update_r /my/files /files +.br +$ growisofs \-M /dev/dvd \-\- outdev \- \-update_r /my/files /files +.br +growisofs has excellent burn capabilities with DVD and BD. +It does not emulate session history on overwriteable media, though. +.SS +.B Adjust thresholds for verbosity, exit value and program abort +Be quite verbous, exit 32 if severity "FAILURE" was encountered, +do not abort prematurely but forcibly go on until the end of commands. +.br +$ xorriso ... \\ +.br + \-report_about UPDATE \\ +.br + \-return_with FAILURE 32 \\ +.br + \-abort_on NEVER \\ +.br + ... +.SS +.B Examples of input timestrings +.br +As printed by program date: +.B 'Thu Nov 8 14:51:13 CET 2007' +.br +The same without ignored parts: +.B 'Nov 8 14:51:13 2007' +.br +The same as expected by date: +.B 110814512007.13 +.br +Four weeks in the future: +.B +4w +.br +The current time: +.B +0 +.br +Three hours ago: +.B \-3h +.br +Seconds since Jan 1 1970: +.B =1194531416 +.br +.br +.br +.br +.br +.br +.br +.SS +.B Incremental backup of a few directory trees +This changes the directory trees /open_source_project and /personal_mail +in the ISO image so that they become exact copies of their disk counterparts. +ISO file objects get created, deleted or get their attributes adjusted +accordingly. +.br +ACL, xattr, hard links and MD5 checksums will be recorded. +Accelerated comparison is enabled at the expense of potentially larger backup +size. Only media with the expected volume id or blank media are accepted. +Files with names matching *.o or *.swp get excluded explicitly. +.br +When done with writing the new session gets checked by its recorded MD5. +.br +$ xorriso \\ +.br + \-abort_on FATAL \\ +.br + \-for_backup \-disk_dev_ino on \\ +.br + \-assert_volid 'PROJECTS_MAIL_*' FATAL \\ +.br + \-dev /dev/sr0 \\ +.br + \-volid PROJECTS_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \\ +.br + \-not_leaf '*.o' \-not_leaf '*.swp' \\ +.br + \-update_r /home/thomas/projects /projects \\ +.br + \-update_r /home/thomas/personal_mail /personal_mail \\ +.br + \-commit \-toc \-check_md5 FAILURE \-\- \-eject all +.br +To be used several times on the same medium, whenever an update of +the two disk trees to the medium is desired. Begin with a blank medium and +update it until he run fails gracefully due to lack of remaining space on +the old one. +.br +This makes sense if the full backup leaves substantial remaining capacity +on media and if the expected changes are much smaller than the full backup. +To apply zisofs compression to those data files which get newly copied from +the local filesystem, insert these options immediately before \-commit : +.br + \-hardlinks perform_update \\ +.br + \-find / \-type f \-pending_data \-exec set_filter \-\-zisofs \-\- \\ +.br +Options \-disk_dev_ino and \-for_backup depend on stable device and inode numbers +on disk. Without them, an update run may use \-md5 "on" to match recorded MD5 +sums against the current file content on hard disk. This is usually much faster +than the default which compares both contents directly. +.br +With \fBmount\fR option \fB\-o "sbsector="\fR on GNU/Linux +resp. \fB\-s\fR on FreeBSD +it is possible to access the session trees which represent the older backup +versions. With CD media, GNU/Linux mount accepts session numbers directly by +its option "session=". +.br +Multi\-session media and most overwriteable media written by \fBxorriso\fR +can tell the sbsectors of their sessions by \fBxorriso\fR option \-toc. +Used after \-commit the following option prints the matching mount command for +the newly written session (here for mount point /mnt): +.br + \-mount_cmd "indev" "auto" "auto" /mnt +.br +Options \-mount_cmd and \-mount are also able to produce the mount commands for +older sessions in the table\-of\-content. E.g. as superuser: +.br + # osirrox \-mount /dev/sr0 "volid" '*2008_12_05*' /mnt +.br +.sp 1 +Above example produces a result similar to \-root / \-old\-root / with mkisofs. +For getting the session trees accumulated in the new sessions, let all \-update +commands use a common parent directory and clone it after updating is done: +.br + \-update_r /home/thomas/projects /current/projects \\ +.br + \-update_r /home/thomas/personal_mail /current/personal_mail \\ +.br + \-clone /current /"$(date '+%Y_%m_%d_%H%M%S')" \\ +.br +The cloned tree will have a name like /2011_02_12_155700. +.br +.sp 1 +Sessions on multi\-session media are separated by several MB of unused blocks. +So with small sessions the payload capacity can become substantially lower +than the overall media capacity. If the remaining space on a medium does not +suffice for the next gap, the drive is supposed to close the medium +automatically. +.br +.sp 1 +\fBBetter do not use your youngest backup for \-update_r\fR. +Have at least two media which you use alternatingly. So only older backups +get endangered by the new write operation, while the newest backup is +stored safely on a different medium. +.br +Always have a blank medium ready to perform a full backup in case the update +attempt fails due to insufficient remaining capacity. This failure will +not spoil the old medium, of course. +.SS +.B Restore directory trees from a particular ISO session to disk +This is an alternative to mounting the medium and using normal file operations. +.br +First check which backup sessions are on the medium: +.br +$ xorriso \-outdev /dev/sr0 \-toc +.br +Then load the desired session and copy the file trees to disk. +Enable restoring of ACL, xattr and hard links. +Avoid to create /home/thomas/restored without rwx\-permission. +.br +$ xorriso \-for_backup \\ +.br + \-load volid 'PROJECTS_MAIL_2008_06_19*' \\ +.br + \-indev /dev/sr0 \\ +.br + \-osirrox on:auto_chmod_on \\ +.br + \-chmod u+rwx / \-\- \\ +.br + \-extract /open_source_projects \\ +.br + /home/thomas/restored/open_source_projects \\ +.br + \-extract /personal_mail /home/thomas/restored/personal_mail \\ +.br + \-rollback_end +.br +The final command \-rollback_end prevents an error message about the altered +image being discarded. +.SS +.B Try to retrieve blocks from a damaged medium +.br +$ xorriso \-abort_on NEVER \-indev /dev/sr0 \\ +.br + \-check_media time_limit=1800 report=blocks_files \\ +.br + data_to="$HOME"/dvd_copy sector_map="$HOME"/dvd_copy.map \-\- +.br +This can be repeated several times, if necessary with \-eject or with other +\-indev drives. See the human readable part of "$HOME"/dvd_copy.map for +addresses which can be used on "$HOME"/dvd_copy with mount option \-o sbsector= +resp. \-s. +.SH FILES +.SS +.B Program alias names: +.br +Normal installation of \fBxorriso\fR creates three links or copies which by their +program name pre\-select certain settings: +.br +\fBxorrisofs\fR starts \fBxorriso\fR with \-as mkisofs emulation. +.br +\fBxorrecord\fR starts \fBxorriso\fR with \-as cdrecord emulation. +.br +\fBosirrox\fR starts with \-osirrox "on:o_excl_off" which allows +to copy files from ISO image to disk and to apply option \-mount to +one or more of the existing ISO sessions. +.SS +.B Startup files: +.br +If not \-no_rc is given as the first argument then \fBxorriso\fR attempts on startup +to read and execute lines from the following files: +.br + /etc/default/xorriso +.br + /etc/opt/xorriso/rc +.br + /etc/xorriso/xorriso.conf +.br + $HOME/.xorrisorc +.br +The files are read in the sequence given above, but none of them is required +to exist. The line format is described with command \-options_from_file. +.br +If mkisofs emulation was enabled by program name "xorrisofs", "mkisofs", +"genisoimage", or "genisofs", then afterwards \-read_mkisofsrc is performed, +which reads .mkisofsrc files. See there. +.SS +.B Runtime control files: +.br +The default setting of \-check_media abort_file= is: +.br + /var/opt/xorriso/do_abort_check_media +.br +.SH SEE ALSO +.TP +For the mkisofs emulation of xorriso +.BR xorrisofs(1) +.TP +For the cdrecord emulation of xorriso +.BR xorrecord(1) +.TP +For mounting xorriso generated ISO 9660 images (-t iso9660) +.BR mount(8) +.TP +Libreadline, a comfortable input line facility +.BR readline(3) +.TP +Other programs which produce ISO 9660 images +.BR mkisofs(8), +.BR genisoimage(8) +.TP +Other programs which burn sessions to optical media +.BR growisofs(1), +.BR cdrecord(1), +.BR wodim(1), +.BR cdrskin(1) +.TP +ACL and xattr +.BR getfacl(1), +.BR setfacl(1), +.BR getfattr(1), +.BR setfattr(1) +.TP +MD5 checksums +.BR md5sum(1) +.TP +On FreeBSD the commands for xattr and MD5 differ +.BR getextattr(8), +.BR setextattr(8), +.BR md5(1) +.SH BUGS +To report bugs, request help, or suggest enhancements for \fBxorriso\fR, +please send electronic mail to the public list <bug\-xorriso@gnu.org>. +If more privacy is desired, mail to <scdbackup@gmx.net>. +.br +Please describe what you expect \fBxorriso\fR to do, +the program arguments resp. commands by which you tried to achieve it, +the messages of \fBxorriso\fR, and the undesirable outcome of your +program run. +.br +Expect to get asked more questions before solutions can be proposed. +.SH AUTHOR +Thomas Schmitt <scdbackup@gmx.net> +.br +for libburnia\-project.org +.SH COPYRIGHT +Copyright (c) 2007 \- 2011 Thomas Schmitt +.br +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of \fBxorriso\fR. +If you make use of the license to derive modified versions of +\fBxorriso\fR then you are entitled to modify this text under that +same license. +.SH CREDITS +\fBxorriso\fR is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Thanks to Andy Polyakov who invented emulated growing, +to Derek Foreman and Ben Jansens who once founded libburn. +.br +Compliments towards Joerg Schilling whose cdrtools served me for ten years. diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso.h b/libisoburn/branches/1.1.8/xorriso/xorriso.h new file mode 100644 index 00000000..2ede5165 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso.h @@ -0,0 +1,1258 @@ + +/* xorriso - libisoburn higher level API which creates, loads, manipulates + and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> + + Provided under GPL version 2 or later. + + This file contains the public API of xorriso which covers all of its + operations. + + An example of its usage is xorriso_main.c which checks version compatibility, + creates a xorriso object, initializes the libraries, and runs the command + interpreters of the API to constitute the command line oriented batch and + dialog tool xorriso. + + Alternatively to command interpreters it is possible to run all options of + xorriso directly via the calls of the "Options API". + The "Problem Status and Message API" shall then be used to obtain the + text output of the options. + + Mandatory calls are: + Xorriso_new(), Xorriso_startup_libraries(), Xorriso_destroy() + + This architecture is fully public since version 0.5.8. From then on, new + features get marked by + @since major.minor.micro + If this mark is missing, then the feature was present before release 0.5.8. + + + There is a lower level of API which consists of libisofs.h, libburn.h and + libisoburn.h. One should not mix those calls with the ones of xorriso.h . +*/ + +/* Important: If you add a public API function then add its name to file + libisoburn/libisoburn.ver +*/ + + +#ifndef Xorriso_includeD +#define Xorriso_includeD yes + +/** Opaque handle of the xorriso runtime context */ +struct XorrisO; + + + +/* This may be changed to Xorriso_GNU_xorrisO in order to create GNU xorriso + under GPLv3+ derived from above GPLv2+. +*/ +#define Xorriso_libburnia_xorrisO yes + + +/* --------------------- Fundamental Management ------------------- */ + + +/** These three release version numbers tell the revision of this header file + and of the API which it describes. They shall be memorized by applications + at build time. + @since 0.5.8 +*/ +#define Xorriso_header_version_majoR 1 +#define Xorriso_header_version_minoR 1 +#define Xorriso_header_version_micrO 7 + + +/** If needed: Something like ".pl01" to indicate a bug fix. Normally empty. + @since 0.5.8 +*/ +#define Xorriso_program_patch_leveL "" + + +/** Obtain the three release version numbers of the library. These are the + numbers encountered by the application when linking with libisoburn, + i.e. possibly not before run time. + Better do not base the fundamental compatibility decision of an application + on these numbers. For a reliable check use Xorriso__is_compatible(). + @since 0.5.8 + @param major The maturity version (0 for now, as we are still learning) + @param minor The development goal version. + @param micro The development step version. This has an additional meaning: + + Pare numbers indicate a version with frozen API. I.e. you can + rely on the same set of features to be present in all + published releases with that major.minor.micro combination. + Features of a pare release will stay available and ABI + compatible as long as the SONAME of libisoburn stays "1". + Currently there are no plans to ever change the SONAME. + + Odd numbers indicate that API upgrades are in progress. + I.e. new features might be already present or they might + be still missing. Newly introduced features may be changed + incompatibly or even be revoked before release of a pare + version. + So micro revisions {1,3,5,7,9} should never be used for + dynamic linking unless the proper library match can be + guaranteed by external circumstances. + + @return 1 success, <=0 might in future become an error indication +*/ +void Xorriso__version(int *major, int *minor, int *micro); + + +/** Check whether all features of header file xorriso.h from the given + major.minor.micro revision triple can be delivered by the library version + which is performing this call. + if (! Xorriso__is_compatible(Xorriso_header_version_majoR, + Xorriso_header_version_minoR, + Xorriso_header_version_micrO, 0)) + ...refuse to start the program with this dynamic library version... + @since 0.5.8 + @param major obtained at build time + @param minor obtained at build time + @param micro obtained at build time + @param flag Bitfield for control purposes. Unused yet. Submit 0. + @return 1= library can work for caller + 0= library is not usable in some aspects. Caller must restrict + itself to an earlier API version or must not use this library + at all. +*/ +int Xorriso__is_compatible(int major, int minor, int micro, int flag); + + +/* Get the patch level text (e.g. "" or ".pl01") of the program code. + @param flag unused yet, submit 0 + @return readonly character string +*/ +char *Xorriso__get_patch_level_text(int flag); + + +/* Choose how Xorriso_startup_libraries() and the XorrisO object shall + prepare for eventual signals. + @param behavior Default is behavior 1. + 0= no own signal handling. The main application has to do + that. Do not start burn runs without any handling ! + 1= use libburn signal handler. Most time with action + 0. During writing, formatting, blanking: 0x30. + Only usable with a single xorriso object. + 2= Enable system default reaction on all signals + @since 1.0.9 + 3= Try to ignore nearly all signals + @since 1.0.9 + @param flag unused yet, submit 0 + @return <= 0 is error, >0 is success +*/ +int Xorriso__preset_signal_behavior(int behavior, int flag); + + +/* Mandatory call: + Create a new xorriso object and tell it the program name to be used + with messages and for decision of special behavior. + @param xorriso returns the newly created XorrisO object + @param progname typically argv[0] of main(). Some leafnames of the progname + path have special meaning and trigger special behavior: + "osirrox" allows image-to-disk copying: -osirrox "on" + "xorrisofs" activates -as "mkisofs" emulation from start + "genisofs" alias of "xorrisofs" + "mkisofs" alias of "xorrisofs" + "genisoimage" alias of "xorrisofs" + "xorrecord" activates -as "cdrecord" emulation from start + "cdrecord" alias of "xorrecord" + "wodim" alias of "xorrecord" + "cdrskin" alias of "xorrecord" + @param flag unused yet, submit 0 + @return >0 success , <=0 failure, no object created +*/ +int Xorriso_new(struct XorrisO ** xorriso, char *progname, int flag); + + +/* Note: Between Xorriso_new() and the next call Xorriso_startup_libraries() + there may be called the special command interpreter + Xorriso_prescan_args(). + The other command interpreters may be used only after + Xorriso_startup_libraries(). The same restriction applies to the + calls of the Options API further below. +*/ + + +/* Mandatory call: + It has to be made before calling any function listed below this point. + Only exception is the special command interpreter Xorriso_prescan_args(). + + Make global library initializations. + This must be done with the first xorriso object that gets created and + with the first xorriso object that gets created after Xorriso_destroy(,1). + @param xorriso The context object. + @param flag unused yet, submit 0 + @return <=0 error , >0 success +*/ +int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag); + + +/* Note: After library startup, you may run Command Interpreters or call + functions from the Options API. + + Wenn all desired activities are done, you may check whether there are + uncommited changes pending, compute an exit value, destroy the XorrisO + object, and exit your program. +*/ + + +/* Inquire whether option -commit would make sense. + @param xorriso The context object to inquire. + @param flag @since 0.6.6 + bit0= do not return 1 if -as mkisofs -print-size was + performed on the current image. + @return 0= -commit would have nothing to do + 1= a new image session would emerge at -commit +*/ +int Xorriso_change_is_pending(struct XorrisO *xorriso, int flag); + + +/* Compute the exit value from the recorded maximum event severity. + @param xorriso The context object to inquire. + @param flag unused yet, submit 0 + @return The computed exit value +*/ +int Xorriso_make_return_value(struct XorrisO *xorriso, int flag); + + +/* Mandatory call: + Destroy xorriso object when it is no longer needed. + @param xorriso The context object to destroy. *xorriso will become NULL. + @param flag bit0= Perform global library shutdown. + Use only with last xorriso object to be destroyed. + @return <=0 error, >0 success +*/ +int Xorriso_destroy(struct XorrisO **xorriso, int flag); + + +/* --------------------- Command Interpreters ------------------- */ + + +/* This special interpreter may be called between Xorriso_new() and + Xorriso_startup_libraries(). It interprets certain commands which shall + get into effect before the libraries get initialized: + -abort_on , -report_about , -return_with , -list_delimiter , + -scsi_log , -signal_handling + Some commands get executed only if they are the only command in argv: + -prog_help , -help , -no_rc + Some get examined for the need to redirect stdout messages + -dev , -outdev , -indev , -as + Commands -list_delimiter and -add_plainly get into effect during this + call. But their setting at begin of the call gets restored before the + call returns. + @param xorriso The context object in which to perform the commands. + @param argc Number of arguments. + @param argv The arguments. argv[0] contains the program name. + argv[1] to argv[argc-1] contain commands and parameters. + @param idx Argument cursor. When this function is called, *idx must + be at least 1, argv[*idx] must be a command. + *idx will iterate over commands and parameters until this + function aborts or until argc is reached. + @param flag bit0= do not interpret argv[1] + bit1= produce FAILURE events on unknown commands + @since 1.1.0 + @return <0 error + 0 end program + 1 ok, go on +*/ +int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv, + int flag); + + +/* Read and interpret commands from eventual startup files as listed in + man xorriso. + @param xorriso The context object in which to perform the commands. + @param flag unused yet, submit 0 + @return <=0 = error + 1 = success + 3 = end program run (e.g. because command -end was encountered) +*/ +int Xorriso_read_rc(struct XorrisO *xorriso, int flag); + + +/* Check whether program arguments shall be backslash decoded. If so, then + replace *argv by a new argument vector. The old one will not be freed + by this call. If it is dynamic memory then you need to keep a copy of + the pointer and free it yourself after this call. + @param xorriso The context object + @param argc Number of arguments. + @param argv The arguments. (*argv)[0] contains the program name. + (*argv)[1] to (*argv)[argc-1] contain commands and parameters + If argv after the call differs from argv before the call, + then one should dispose it later by: + for(i= 0; i < argc; i++) + if(argv[i] != NULL) + free(argv[i]); + free(argv); + @param flag unused yet, submit 0 + @return <= 0 error , > 0 success +*/ +int Xorriso_program_arg_bsl(struct XorrisO *xorriso, int argc, char ***argv, + int flag); + + +/* Interpret argv as xorriso command options and their parameters. + (An alternative is to call functions of the options API directly and to + perform own error status evaluation. See below: Options API.) + After the first command and its parameters there may be more commands and + parameters. All parameters must be given in the same call as their command. + @param xorriso The context object in which to perform the commands. + @param argc Number of arguments. + @param argv The arguments. argv[0] contains the program name. + argv[1] to argv[argc-1] contain commands and parameters. + @param idx Argument cursor. When this function is called, *idx must + be at least 1, argv[*idx] must be a command. + *idx will iterate over commands and parameters until this + function aborts or until argc is reached. + @param flag bit0= reserved. Indicates recursion. Submit 0. + bit1= Indicates that these are the main() program start + arguments + @return <=0 = error + 1 = success + 2 = problem event ignored + 3 = end program run (e.g. because command -end was encountered) +*/ +int Xorriso_interpreter(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + + +/* Parse a command line into words and use them as argv for a call of + Xorriso_interpreter(). Put out some info lines about the outcome. + @param xorriso The context object in which to perform the commands. + @param line A text of one or more words according to man xorriso + paragraph "Command processing" up to and including + "Backslash Interpretation". + @param flag bit0 to bit15 are forwarded to Xorriso_interpreter() + bit16= no pageing of info lines + bit17= print === bar even if xorriso->found<0 + @return see return of Xorriso_interpreter() +*/ +int Xorriso_execute_option(struct XorrisO *xorriso, char *line, int flag); + + +/* Enter xorriso command line dialog mode, using libreadline if configured + at build time and not disabled at run time. + This call returns immediately if not option -dialog "on" was performed + before. + @param xorriso The context object in which to perform the commands. + @param flag unused yet, submit 0 + @return <=0 error, 1= dialog mode ended normally , + 3= dialog mode ended normally,interpreter asks to end program +*/ +int Xorriso_dialog(struct XorrisO *xorriso, int flag); + + +/* --------------------- Problem Status and Message API ------------------- */ + + +/** Submit a problem message to the xorriso problem reporting and handling + system. This will eventually increase problem status rank, which may + at certain stages in the program be pardoned and reset to 0. + The pardon is governed by Xorriso_option_abort_on() and by the anger + of the affected program part. If no pardon has been given, then the problem + status reaches the caller of option functions. + Problem status should be inquired by Xorriso_eval_problem_status() and be + reset before next option execution by Xorriso_set_problem_status(). + The problem status itself does not cause the failure of option functions. + But in case of failures for other reasons, a remnant overly severe problem + status can cause overly harsh program reactions. + @param xorriso The environment handle + @param error_code The unique error code of your message. + Submit 0 if you do not have reserved error codes within + the libburnia project. + @param msg_text Not more than 8196 characters of message text. + A final newline character gets appended automatically. + @param os_errno Eventual errno related to the message. Submit 0 if + the message is not related to a operating system error. + @param severity One of "ABORT", "FATAL", "FAILURE", "MISHAP", "SORRY", + "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG". + Defaults to "FATAL". + @param flag Bitfield for control purposes + bit0= use pager (as with result) + bit1= permission to suppress output + @return 1 if message was delivered, <=0 if failure +*/ +int Xorriso_msgs_submit(struct XorrisO *xorriso, + int error_code, char msg_text[], int os_errno, + char severity[], int flag); + +/** Alternative call interface of Xorriso_msgs_submit with void* instead + of struct XorrisO* +*/ +int Xorriso_msgs_submit_void(void *xorriso, + int error_code, char msg_text[], int os_errno, + char severity[], int flag); + + +/** Evaluate an advise whether to abort or whether to go on with option + processing. This should be called after any option function was processed. + It updates the problem status by processing the library message queues + and then it uses this status and the submitted return value of the + option function to evaluate the situation. + @param xorriso The environment handle + @param ret The return value of the previously called option function + @param flag bit0= do not issue own event messages + bit1= take xorriso->request_to_abort as reason for abort + @return Gives the advice: + 2= pardon was given, go on + 1= no problem, go on + 0= function failed but xorriso would not abort, go on + <0= do abort + -1 = due to xorriso->problem_status + or due to ret<0 + -2 = due to xorriso->request_to_abort +*/ +int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag); + + +/** Set the current problem status of the xorriso handle. + @param xorriso The environment handle + @param severity A severity text. Empty text resets to "No Problem". + @param flag Unused yet. Submit 0. + @return <=0 failure (e.g. wrong severity text), 1 success. +*/ +int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, + int flag); + + +/* The next two functions are part of Xorriso_eval_problem_status(). + You may use them to build an own advisor function. +*/ + +/** Obtain the current problem status of the xorriso handle. + @param xorriso The environment handle + @param severity The severity text matching the current problem status + @param flag Unused yet. Submit 0. + @return The severity rank number. 0= no problem occured. +*/ +int Xorriso_get_problem_status(struct XorrisO *xorriso, char severity[80], + int flag); + + +/** Forward any pending messages from the library message queues to the + xorriso message system which puts out on info channel. This registers + the severity of the library events like the severity of a message submitted + via Xorriso_msgs_submit(). + xorriso sets the message queues of the libraries to queuing "ALL". + Many inner functions of xorriso call Xorriso_process_msg_queues() on their + own because they expect library output pending. Nevertheless, a loop of + xorriso option calls should either call Xorriso_eval_problem_status() or + Xorriso_process_msg_queues() with each cycle. + @param xorriso The environment handle + @param flag Unused yet. Submit 0. + @return 1 on success, <=0 if failure +*/ +int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag); + + +/** Write a message for option -errfile_log. + @param xorriso The environment handle + @param error_code The unique error code of your message. + Submit 0 if you do not have reserved error codes within + the libburnia project. + @param msg_text Not more than 8196 characters of message text. + @param os_errno Eventual errno related to the message. Submit 0 if + the message is not related to a operating system error. + @param flag bit0-7= meaning of msg_text + ( 0= ERRFILE path , for internal use mainly ) + 1= mark line text (only to be put out if enabled) + @return <=0 error , >0 success +*/ +int Xorriso_process_errfile(struct XorrisO *xorriso, + int error_code, char msg_text[], int os_errno, + int flag); + + +/* The outlist stack allows to redirect the info and result messages from + their normal channels into a pair of string lists which can at some + later time be retrieved by the application. + These redirection caches can be stacked to allow stacked applications. + xorriso itself uses them for internal purposes. +*/ + +/* A list item able of forming double chained lists */ +struct Xorriso_lsT; + +/** Maximum number of stacked redirections */ +#define Xorriso_max_outlist_stacK 32 + +/** Enable a new redirection of info and/or result channel. The normal message + output and eventual older redirections will not see new messages until + the redirection is ended by a call to Xorriso_pull_outlists() with the + stack_handle value returned by this call. + Redirected output is not written to the files of Xorriso_option_logfile() + and the Xorriso_option_pkt_output() protocol will not be applied. + @param xorriso The environment handle + @param stack_handle returns an id number which is unique as long as + its redirection is stacked. It may be re-used after + its redirection was pulled from the stack. + @param flag Bitfield for control purposes + bit0= redirect result channel + bit1= redirect info channel + If bit0 and bit1 are 0, both channels get redirected. + @return 1 on success, <=0 if failure +*/ +int Xorriso_push_outlists(struct XorrisO *xorriso, int *stack_handle, + int flag); + + +/** Disable the redirection given by stack_handle. If it was the current + receiver of messages then switch output to the next older redirection + resp. to the normal channels if no redirections are stacked any more. + The messages collected by the disabled redirection are handed out as + two lists. Both lists have to be disposed via Xorriso_lst_destroy_all() + when they are no longer needed. + The message lists are either NULL or represented by their first + Xorriso_lsT item. + @param xorriso The environment handle + @param stack_handle The id number returned by Xorriso_push_outlists() + @param result_list Result and mark messages (usually directed to stdout) + @param info_list Info and mark messages (usually directed to stderr) + @param flag unused yet, submit 0 + @return 1 on success, <=0 if failure +*/ +int Xorriso_pull_outlists(struct XorrisO *xorriso, int stack_handle, + struct Xorriso_lsT **result_list, + struct Xorriso_lsT **info_list, int flag); + + +/** Obtain the text message from the current list item. + @param entry The current list item + @param flag unused yet, submit 0 + @return Pointer to the text content of the list item. + This pointer does not have to be freed. +*/ +char *Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag); + + +/** Obtain the address of the next item in the chain of messages. + An iteration over the output of Xorriso_pull_outlists() starts at the + returned result_list resp. info_list and ends when this function returns + NULL. + @param entry The current list item + @param flag unused yet, submit 0 + @return Pointer to the next list item or NULL if end of list. + This pointer does not have to be freed. +*/ +struct Xorriso_lsT *Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag); + + +/** Obtain the address of the previous item in the chain of messages. + @param entry The current list item + @param flag unused yet, submit 0 + @return Pointer to the previous list item or NULL if start of list. + This pointer does not have to be freed. +*/ +struct Xorriso_lsT *Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag); + + +/** Destroy all list items which are directly or indirectly connected to + the given link item. + All pointers obtained by Xorriso_lst_get_text() become invalid by this. + Apply this to each of the two list handles obtained by + Xorriso_pull_outlists() when the lists are no longer needed. + @param lstring *lstring will be freed and set to NULL. + It is not dangerous to submit a pointer to a NULL-pointer. + @param flag unused yet, submit 0 + @return -1= lstring was NULL (i.e. wrong use of this call), + 0= *lstring was already NULL, + 1= item actually disposed +*/ +int Xorriso_lst_destroy_all(struct Xorriso_lsT **lstring, int flag); + + + +/* ---------------------------- Options API ------------------------ */ +/* See man 1 xorriso for explanation of the particular options */ +/* + Before each call to an option function, there should happen: + Xorriso_set_problem_status() with empty severity text. + + After each call to an option function, there should happen: + Xorriso_eval_problem_status() + One should follow its eventual advice to abort. + + Options with a varying number of arguments get then passed like + Xorriso_interpreter(). E.g.: + int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + The option functions will begin to read the arguments at position *idx + and will see the list end either at the next argv which contains the + -list_delimiter text or at argv[argc-1]. + After the call, *idx will be the index of the first not yet interpreted + argv. + + Do not set any flag bits which are not described by "@param flag". + I.e. if flag is not mentioned, then submit 0. + Yet undefined flag bits might get a meaning in future. Unset bits will + then produce the traditional behavior, whereas set bits might bring + surprises to inadverted callers. +*/ + + +/* Option -abort_on */ +int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag); + +/* Option -abstract_file */ +/* @since 0.6.0 */ +int Xorriso_option_abstract_file(struct XorrisO *xorriso, char *name, + int flag); + +/* Option -acl "on"|"off" */ +int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -add */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message +*/ +int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -add_plainly "on"|"off" */ +int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode, + int flag); + + +/* Option -alter_date, alter_date_r */ +/* @param flag bit0=recursive (-alter_date_r) +*/ +int Xorriso_option_alter_date(struct XorrisO *xorriso, + char *time_type, char *timestring, + int argc, char **argv, int *idx, int flag); + +/* Option -append_partition */ +/* @since 0.6.4 */ +int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text, + char *type_text, char *image_path, int flag); + +/* Option -application_id */ +int Xorriso_option_application_id(struct XorrisO *xorriso, char *name, + int flag); + +/* Option -as */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message +*/ +int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -assert_volid */ +int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern, + char *severity, int flag); + +/* Option -auto_charset "on"|"off" */ +int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -backslash_codes */ +int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -ban_stdio_write */ +int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag); + +/* Option -biblio_file */ +/* @since 0.6.0 */ +int Xorriso_option_biblio_file(struct XorrisO *xorriso, char *name, int flag); + +/* Option -blank and -format */ +/* @param flag bit0= format rather than blank + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -boot_image */ +int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form, + char *treatment, int flag); + +/* Option -calm_drive */ +int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag); + +/* Option -cd alias -cdi */ +int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag); + +/* Option -cdx */ +int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag); + +/* Option -charset */ +/* @param flag bit0= set in_charset + bit1= set out_charset +*/ +int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag); + +/* Options -check_md5 and -check_md5_r + @param flag bit0= issue summary message + bit1= do not reset pacifier, no final pacifier message + bit2= do not issue pacifier messages at all + bit3= recursive: -check_md5_r +*/ +int Xorriso_option_check_md5(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + +/* Option -check_media */ +int Xorriso_option_check_media(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + +/* Option -check_media_defaults */ +int Xorriso_option_check_media_defaults(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + +/* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */ +/* @param flag bit0=recursive (-chgrp_r) +*/ +int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid, + int argc, char **argv, int *idx, int flag); + +/* Option -chmod alias -chmodi , -chmod_r alias chmod_ri */ +/* @param flag bit0=recursive (-chmod_r) +*/ +int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, + int argc, char **argv, int *idx, int flag); + +/* Option -chown alias -chowni , chown_r alias chown_ri */ +/* @param flag bit0=recursive (-chown_r) +*/ +int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid, + int argc, char **argv, int *idx, int flag); + +/* Option -clone */ +/* @since 1.0.2 */ +int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest, + int flag); + +/* Option -close "on"|"off" */ +int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -close_damaged */ +/* @since 1.1.0 */ +int Xorriso_option_close_damaged(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -close_filter_list */ +int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag); + +/* Option -commit */ +/* @param flag bit0= leave indrive and outdrive aquired as they were, + i.e. do not aquire outdrive as new in-out-drive + bit1= do not perform eventual -reassure + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_commit(struct XorrisO *xorriso, int flag); + +/* Option -commit_eject */ +/* @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag); + +/* Option -compare and -compare_r + @param flag bit0= issue summary message + bit1= do not reset pacifier, no final pacifier message + bit2= do not issue pacifier messages at all + bit3= recursive: -compare_r +*/ +int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag); + +/* Option -compliance */ +int Xorriso_option_compliance(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -copyright_file */ +/* @since 0.6.0 */ +int Xorriso_option_copyright_file(struct XorrisO *xorriso, char *name, + int flag); + +/* Option -cp_clone */ +/* @since 1.0.2 */ +int Xorriso_option_cp_clone(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -cpr alias -cpri */ +int Xorriso_option_cpri( struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Options -cpx , -cpax, -cp_rx , -cp_rax */ +/* @param flag bit0= recursive (-cp_rx, -cp_rax) + bit1= full property restore (-cpax, -cp_rax) +*/ +int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -cut_out */ +int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, + char *start, char *count, char *iso_rr_path, int flag); + +/* Options -dev , -indev, -outdev */ +/* @param flag bit0=use as indev , bit1= use as outdev + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag); + +/* Option -devices */ +/* @param flag bit0= perform -device_links rather than -devices + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_devices(struct XorrisO *xorriso, int flag); + +/* Option -dialog "on"|"off" */ +int Xorriso_option_dialog(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -disk_dev_ino "on"|"off" */ +int Xorriso_option_disk_dev_ino(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -disk_pattern "on"|"ls"|"off" */ +int Xorriso_option_disk_pattern(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -displacement [-]offset */ +/* @since 0.6.6 */ +int Xorriso_option_displacement(struct XorrisO *xorriso, char *value, + int flag); + +/* Option -drive_class */ +int Xorriso_option_drive_class(struct XorrisO *xorriso, + char *d_class, char *pattern, int flag); + +/* Option -dummy "on"|"off" */ +int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -dvd_obs "default"|"32k"|"64k" */ +int Xorriso_option_dvd_obs(struct XorrisO *xorriso, char *obs, int flag); + +/* Option -early_stdio_test */ +/* @since 1.0.6 */ +int Xorriso_option_early_stdio_test(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -eject */ +/* @param flag bit0=do not report toc of eventually remaining drives +*/ +int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag); + +/* Options -end , and -rollback_end */ +/* @param flag bit0= discard pending changes + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_end(struct XorrisO *xorriso, int flag); + +/* Option -errfile_log marked|plain path|-|"" */ +int Xorriso_option_errfile_log(struct XorrisO *xorriso, + char *mode, char *path, int flag); + +/* Option -error_behavior */ +int Xorriso_option_error_behavior(struct XorrisO *xorriso, + char *occasion, char *behavior, int flag); + +/* Option -external_filter */ +int Xorriso_option_external_filter(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + +/* Options -extract , -extract_single */ +/* @param flag bit0=do not report the restored item + bit1=do not reset pacifier, no final pacifier message + bit5= -extract_single: do not insert directory tree +*/ +int Xorriso_option_extract(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag); + +/* Option -extract_cut */ +int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path, + char *start, char *count, char *disk_path, int flag); + +/* Option -file_size_limit */ +int Xorriso_option_file_size_limit(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + + +/* Option -find alias -findi, and -findx */ +/* @param flag bit0= -findx rather than -findi + bit1= do not reset pacifier, no final pacifier message + do not reset find_compare_result +*/ +int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -follow */ +int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -fs */ +int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag); + +/* Option -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri */ +/* @param flag bit0=recursive -getfacl_r +*/ +int Xorriso_option_getfacli(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag); + +/* Option -gid */ +int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag); + +/* Option -grow_blindly */ +int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag); + +/* Option -hardlinks "on"|"off" */ +int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -help and part of -prog_help */ +int Xorriso_option_help(struct XorrisO *xorriso, int flag); + +/* Option -hide */ +/* @since 0.6.0 */ +int Xorriso_option_hide(struct XorrisO *xorriso, char *hide_state, + int argc, char **argv, int *idx, int flag); + +/* Option -history */ +int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag); + +/* Option -iso_rr_pattern "on"|"ls"|"off" */ +int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -jigdo aspect argument */ +/* @since 0.6.4 */ +int Xorriso_option_jigdo(struct XorrisO *xorriso, char *aspect, char *arg, + int flag); + +/* Option -joliet "on"|"off" */ +int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -list_delimiter */ +int Xorriso_option_list_delimiter(struct XorrisO *xorriso, char *text, + int flag); + +/* Option -list_extras */ +int Xorriso_option_list_extras(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -list_formats */ +int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag); + +/* Option -list_profiles */ +int Xorriso_option_list_profiles(struct XorrisO *xorriso, char *which, + int flag); + +/* Option -list_speeds */ +int Xorriso_option_list_speeds(struct XorrisO *xorriso, int flag); + +/* Option -load session|track|sbsector value */ +/* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_load(struct XorrisO *xorriso, char *adr_mode, + char *adr_value, int flag); + +/* Option -logfile */ +int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel, + char *fileadr, int flag); + +/* Options -ls alias -lsi and -lsl alias -lsli + and -lsd alias -lsdi and -lsdl alias -lsdli + and -du alias -dui and -dus alias -dusi + @param flag bit0= long format (-lsl , -du) + bit1= do not expand patterns but use literally + bit2= du rather than ls + bit3= list directories as themselves (ls -d) +*/ +int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Options -lsx, -lslx, -lsdx , -lsdlx , -dux , -dusx + @param flag bit0= long format (-lslx , -dux) + bit1= do not expand patterns but use literally + bit2= du rather than ls + bit3= list directories as themselves (ls -d) +*/ +int Xorriso_option_lsx(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -map */ +/* @param flag bit0=do not report the added item + bit1=do not reset pacifier, no final pacifier message +*/ +int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag); + +/* Options -map_l , -compare_l , -update_l , -extract_l */ +/* @param flag bit8-11= mode 0= -map_l + 1= -compare_l + 2= -update_l + 3= -extract_l +*/ +int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -mark */ +int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag); + +/* Option -md5 */ +int Xorriso_option_md5(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -mkdir alias -mkdiri */ +int Xorriso_option_mkdiri(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Options -mount , -mount_cmd , -session_string */ +/* @param bit0= -mount_cmd: print mount command to result channel rather + than performing it + bit1= perform -session_string rather than -mount_cmd +*/ +int Xorriso_option_mount(struct XorrisO *xorriso, char *dev, char *adr_mode, + char *adr, char *cmd, int flag); + +/* Option -mount_opts option[:...] */ +int Xorriso_option_mount_opts(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -mv alias -mvi */ +int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -no_rc */ +int Xorriso_option_no_rc(struct XorrisO *xorriso, int flag); + +/* Option -not_leaf , -as mkisofs -hide without '/' */ +/* @param flag bit0= add to iso_rr hide list rather than to disk exclusions + @since 0.6.0 + bit1= add to joliet hide list rather than disk exclusions + @since 0.6.0 +*/ +int Xorriso_option_not_leaf(struct XorrisO *xorriso, char *pattern, int flag); + +/* Option -not_list , -quoted_not_list */ +/* @param flag bit0= -quoted_not_list */ +int Xorriso_option_not_list(struct XorrisO *xorriso, char *adr, int flag); + +/* Option -not_mgt */ +int Xorriso_option_not_mgt(struct XorrisO *xorriso, char *setting, int flag); + +/* Option -not_paths , -as mkisofs -hide with '/' */ +/* @param flag bit0= add to iso_rr hide list rather than to disk exclusions + @since 0.6.0 + bit1= add to joliet hide list rather than disk exclusions + @since 0.6.0 + bit2= enable disk pattern expansion regardless of -disk_pattern +*/ +int Xorriso_option_not_paths(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -options_from_file */ +/* @return <=0 error , 1 = success , 3 = request to end program run */ +int Xorriso_option_options_from_file(struct XorrisO *xorriso, char *adr, + int flag); + +/* Option -osirrox "on"|"off" */ +int Xorriso_option_osirrox(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -overwrite "on"|"nondir"|"off" */ +int Xorriso_option_overwrite(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -pacifier */ +int Xorriso_option_pacifier(struct XorrisO *xorriso, char *style, int flag); + +/* Option -padding */ +int Xorriso_option_padding(struct XorrisO *xorriso, char *size, int flag); + +/* Option -page */ +int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag); + +/* Option -paste_in */ +int Xorriso_option_paste_in(struct XorrisO *xorriso, char *iso_rr_path, + char *disk_path, char *start, char *count, int flag); + +/* Option -path_list , -quoted_path_list */ +/* @param flag bit0= -quoted_path_list */ +int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag); + +/* Option -pathspecs */ +int Xorriso_option_pathspecs(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -pkt_output */ +int Xorriso_option_pkt_output(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -preparer_id */ +/* @since 0.6.2 */ +int Xorriso_option_preparer_id(struct XorrisO *xorriso, char *name, int flag); + +/* Options -print, -print_info , -print_mark */ +/* @param flag bit0-1= output channel: + 0= result channel + 1= info channel @since 1.0.6 + 2= mark channel @since 1.0.6 +*/ +int Xorriso_option_print(struct XorrisO *xorriso, char *text, int flag); + +/* Option -print_size + @param flag bit0= report in mkisofs compatible form on real stdout +*/ +int Xorriso_option_print_size(struct XorrisO *xorriso, int flag); + +/* Option -prog */ +int Xorriso_option_prog(struct XorrisO *xorriso, char *name, int flag); + +/* Option -prompt */ +int Xorriso_option_prompt(struct XorrisO *xorriso, char *text, int flag); + +/* Option -prog_help */ +int Xorriso_option_prog_help(struct XorrisO *xorriso, char *name, int flag); + +/* Option -publisher */ +int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag); + +/* Option -pvd_info */ +int Xorriso_option_pvd_info(struct XorrisO *xorriso, int flag); + +/* Option -pwd alias -pwdi */ +int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag); + +/* Option -pwdx */ +int Xorriso_option_pwdx(struct XorrisO *xorriso, int flag); + +/* Option -read_mkisofsrc */ +/* @since 0.6.0 */ +int Xorriso_option_read_mkisofsrc(struct XorrisO *xorriso, int flag); + +/* Option -reassure "on"|"tree"|"off" */ +int Xorriso_option_reassure(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -report_about */ +int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity, + int flag); + +/* Option -return_with */ +int Xorriso_option_return_with(struct XorrisO *xorriso, char *severity, + int exit_value, int flag); + +/* Options -rm alias -rmi , -rm_r alias -rm_ri , -rmdir alias -rmdiri */ +/* @param flag bit0=recursive , bit2= remove empty directory: rmdir */ +int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); + +/* Option -rollback */ +/* @param flag bit0= do not -reassure + @return <=0 error , 1 success, 2 revoked by -reassure +*/ +int Xorriso_option_rollback(struct XorrisO *xorriso, int flag); + +/* Option -rom_toc_scan */ +int Xorriso_option_rom_toc_scan(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -scdbackup_tag */ +int Xorriso_option_scdbackup_tag(struct XorrisO *xorriso, char *list_path, + char *record_name, int flag); +/* Option -scsi_log */ +int Xorriso_option_scsi_log(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -session_log */ +int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag); + +/* Option -setfacl_list alias -setfacl_listi */ +int Xorriso_option_setfacl_listi(struct XorrisO *xorriso, char *disk_path, + int flag); + +/* Option -setfacl alias -setfacli , -setfacl_r alias -setfacl_ri */ +/* @param flag bit0=recursive -setfacl_r +*/ +int Xorriso_option_setfacli(struct XorrisO *xorriso, char *acl_text, + int argc, char **argv, int *idx, int flag); + +/* Options -setfattr alias -setfattri, -setfattr_r alias -setfattr_ri */ +/* @param flag bit0=recursive -setfattr_r +*/ +int Xorriso_option_setfattri(struct XorrisO *xorriso, char *name, char *value, + int argc, char **argv, int *idx, int flag); + +/* Option -setfattr_list alias -setfattr_listi */ +int Xorriso_option_setfattr_listi(struct XorrisO *xorriso, char *path, + int flag); + +/* Options -set_filter , -set_filter_r */ +/* @param flag bit0=recursive -set_filter_r +*/ +int Xorriso_option_set_filter(struct XorrisO *xorriso, char *name, + int argc, char **argv, int *idx, int flag); + +/* Option -signal_handling */ +/* @param flag bit0= do not yet install the eventual handler +*/ +int Xorriso_option_signal_handling(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -sleep */ +int Xorriso_option_sleep(struct XorrisO *xorriso, char *duration, int flag); + +/* Option -speed */ +int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag); + +/* Option -split_size */ +int Xorriso_option_split_size(struct XorrisO *xorriso, char *s, int flag); + +/* Option -status */ +int Xorriso_option_status(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -status_history_max */ +int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num1, + int flag); + +/* Option -stdio_sync "on"|"off"|size */ +int Xorriso_option_stdio_sync(struct XorrisO *xorriso, char *rythm, int flag); + +/* Option -stream_recording */ +int Xorriso_option_stream_recording(struct XorrisO *xorriso, char *mode, + int flag); + +/* Option -system_id */ +int Xorriso_option_system_id(struct XorrisO *xorriso, char *name, int flag); + +/* Option -tell_media_space */ +int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag); + +/* Option -temp_mem_limit */ +int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size, + int flag); + +/* Option -toc */ +int Xorriso_option_toc(struct XorrisO *xorriso, int flag); + +/* Option -uid */ +int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag); + +/* Option -unregister_filter */ +int Xorriso_option_unregister_filter(struct XorrisO *xorriso, char *name, + int flag); + +/* Options -update and -update_r + @param flag bit0= issue summary message + bit1= do not reset pacifier, no final pacifier message + bit2= do not issue pacifier messages at all + bit3= recursive: -update_r +*/ +int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, + char *iso_path, int flag); + +/* Option -use_readline */ +int Xorriso_option_use_readline(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -version */ +int Xorriso_option_version(struct XorrisO *xorriso, int flag); + +/* Option -volid */ +/* @param flag bit0= do not warn of problematic volid +*/ +int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag); + +/* Option -volset_id */ +int Xorriso_option_volset_id(struct XorrisO *xorriso, char *name, int flag); + +/* Option -volume_date */ +int Xorriso_option_volume_date(struct XorrisO *xorriso, + char *time_type, char *timestring, int flag); + +/* Option -xattr "on"|"off" */ +int Xorriso_option_xattr(struct XorrisO *xorriso, char *mode, int flag); + +/* Option -zisofs */ +int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag); + + +#endif /* Xorriso_includeD */ + + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso.info b/libisoburn/branches/1.1.8/xorriso/xorriso.info new file mode 100644 index 00000000..4f2853f7 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso.info @@ -0,0 +1,4783 @@ +This is xorriso.info, produced by makeinfo version 4.8 from +./xorriso.texi. + +INFO-DIR-SECTION Archiving +START-INFO-DIR-ENTRY +* Xorriso: (xorriso). Burns ISO 9660 on CD, DVD, BD. +END-INFO-DIR-ENTRY + xorriso - creates, loads, manipulates and writes ISO 9660 filesystem +images with Rock Ridge extensions. + + Copyright (C) 2007 - 2011 Thomas Schmitt + + Permission is granted to distrubute this text freely. + + +File: xorriso.info, Node: Top, Next: Overview, Up: (dir) + +GNU xorriso 1.1.7 +***************** + +xorriso - creates, loads, manipulates and writes ISO 9660 filesystem +images with Rock Ridge extensions. + +* Menu: + +* Overview:: Overview +* Model:: Session model +* Media:: Media types and states +* Methods:: Creating, Growing, Modifying, Blind Growing +* Drives:: Libburn drives +* Extras:: Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr +* Processing:: Command processing +* Dialog:: Dialog, Readline, Result pager +* Options:: Reference of commands +* Examples:: Examples +* Files:: Files +* Seealso:: See also +* Bugreport:: Reporting bugs +* Legal:: Author, Copyright, Credits +* CommandIdx:: Alphabetic Command List +* ConceptIdx:: Alphabetic List of Concepts and Objects + + +File: xorriso.info, Node: Overview, Next: Model, Prev: Top, Up: Top + +1 Overview +********** + +`xorriso' is a program which copies file objects from POSIX compliant +filesystems into Rock Ridge enhanced ISO 9660 filesystems and allows +session-wise manipulation of such filesystems. It can load the +management information of existing ISO images and it writes the session +results to optical media or to filesystem objects. +Vice versa `xorriso' is able to copy file objects out of ISO 9660 +filesystems. + + A special property of `xorriso' is that it needs neither an external +ISO 9660 formatter program nor an external burn program for CD, DVD or +BD but rather incorporates the libraries of libburnia-project.org . + +1.1 Features +============ + +Operates on an existing ISO image or creates a new one. +Copies files from disk filesystem into the ISO image. +Copies files from ISO image to disk filesystem (see osirrox). +Renames or deletes file objects in the ISO image. +Changes file properties in the ISO image. +Updates ISO subtrees incrementally to match given disk subtrees. +Writes result either as completely new image or as add-on session to +optical media or filesystem objects. +Can activate ISOLINUX and GRUB boot images via El Torito and MBR. +Can perform multi-session tasks as emulation of mkisofs and cdrecord. +Can record and restore hard links and ACL. +Content may get zisofs compressed or filtered by external processes. +Can issue commands to mount older sessions on GNU/Linux or FreeBSD. +Can check media for damages and copy readable blocks to disk. +Can attach MD5 checksums to each data file and the whole session. +Scans for optical drives, blanks re-useable optical media. +Reads its instructions from command line arguments, dialog, and files. +Provides navigation commands for interactive ISO image manipulation. +Adjustable thresholds for abort, exit value, and problem reporting. + + +File: xorriso.info, Node: Model, Next: Media, Prev: Overview, Up: Top + +2 Session model +*************** + +Unlike other filesystems, ISO 9660 is not intended for read-write +operation but rather for being generated in a single sweep and being +written to media as a *session*. +The data content of the session is called filesystem *image*. + + The written image in its session can then be mounted by the +operating system for being used read-only. GNU/Linux is able to mount +ISO images from block devices, which may represent optical media, other +media or via a loop device even from regular disk files. FreeBSD mounts +ISO images from devices that represent arbitrary media or from regular +disk files. + + This session usage model has been extended on CD media by the +concept of *multi-session* , which allows to add information to the CD +and gives the mount programs of the operating systems the addresses of +the entry points of each session. The mount programs recognize block +devices which represent CD media and will by default mount the image in +the last session. +This session usually contains an updated directory tree for the whole +medium which governs the data contents in all recorded sessions. So in +the view of the mount program all sessions of a particular medium +together form a single filesystem image. +Adding a session to an existing ISO image is in this text referred as +*growing*. +The multi-session model of the MMC standard does not apply to all media +types. But program growisofs by Andy Polyakov showed how to extend this +functionality to overwriteable media or disk files which carry valid +ISO 9660 filesystems. + + `xorriso' provides growing as well as an own method named +*modifying* which produces a completely new ISO image from the old one +and the modifications. See paragraph Creating, Growing, Modifying, +Blind Growing below. + + `xorriso' adopts the concept of multi-session by loading an image +directory tree if present, by allowing to manipulate it by several +actions, and by writing the new image to the target medium. The first +session of a `xorriso' run begins by the definition of the input drive +with the ISO image or by the definition of an output drive. The +session ends by command -commit which triggers writing. A -commit is +done automatically when the program ends regularly. + + After -commit a new session begins with the freshly written one as +input. A new input drive can only be chosen as long as the loaded ISO +image was not altered. Pending alteration can be revoked by command +-rollback. + + Writing a session to the target is supposed to be very expensive in +terms of time and of consumed space on appendable or write-once media. +Therefore all intended manipulations of a particular ISO image should +be done in a single session. But in principle it is possible to store +intermediate states and to continue with image manipulations. + + +File: xorriso.info, Node: Media, Next: Methods, Prev: Model, Up: Top + +3 Media types and states +************************ + +There are two families of media in the MMC standard: +*Multi-session media* are CD-R, CD-RW, DVD-R, DVD+R, DVD+R/DL, BD-R, and +unformatted DVD-RW. These media provide a table of content which +describes their existing sessions. See option *-toc*. +Similar to multi-session media are DVD-R DL and minimally blanked +DVD-RW. They allow only a single session of which the size must be +known in advance. `xorriso' will write onto them only if option -close +is set to "on". +*Overwriteable media* are DVD-RAM, DVD+RW, BD-RE, and formatted DVD-RW. +They allow random write access but do not provide information about +their session history. If they contain one or more ISO 9660 sessions +and if the first session was written by `xorriso', then a table of +content can be emulated. Else only a single overall session will be +visible. +DVD-RW media can be formatted by -format "full". They can be made +unformatted by -blank "deformat". +Regular files and block devices are handled as overwriteable media. +Pipes and other writeable file types are handled as blank multi-session +media. + + These media can assume several states in which they offer different +capabilities. + +*Blank* media can be written from scratch. They contain no ISO image +suitable for `xorriso'. +Blank is the state of newly purchased optical media. With used CD-RW +and DVD-RW it can be achieved by action -blank "as_needed". +Overwriteable media are considered blank if they are new or if they have +been marked as blank by `xorriso'. Action -blank "as_needed" can be +used to do this marking on overwriteable media, or to apply mandatory +formatting to new media if necessary. + +*Appendable* media accept further sessions. Either they are MMC +multi-session media in appendable state, or they are overwriteable media +which contain an ISO image suitable for `xorriso'. +Appendable is the state after writing a session with option -close off. + +*Closed* media cannot be written. They may contain an ISO image suitable +for `xorriso'. +Closed is the state of DVD-ROM media and of multi-session media which +were written with option -close on. If the drive is read-only hardware +then it will probably show any media as closed CD-ROM resp. DVD-ROM. +Overwriteable media assume this state in such read-only drives or if +they contain unrecognizable data in the first 32 data blocks. +Read-only drives may or may not show session histories of multi-session +media. Often only the first and the last session are visible. Sometimes +not even that. Option -rom_toc_scan might or might not help in such +cases. + + +File: xorriso.info, Node: Methods, Next: Drives, Prev: Media, Up: Top + +4 Creating, Growing, Modifying, Blind Growing: +********************************************** + +A new empty ISO image gets *created* if there is no input drive with a +valid ISO 9660 image when the first time an output drive is defined. +This is achieved by option -dev on blank media or by option -outdev on +media in any state. +The new empty image can be populated with directories and files. +Before it can be written, the medium in the output drive must get into +blank state if it was not blank already. + + If there is a input drive with a valid ISO image, then this image +gets loaded as foundation for manipulations and extension. The +constellation of input and output drive determines which write method +will be used. They have quite different capabilities and constraints. + + The method of *growing* adds new data to the existing data on the +medium. These data comprise of new file content and they override the +existing ISO 9660 + Rock Ridge directory tree. It is possible to hide +files from previous sessions but they still exist on the medium and +with many types of optical media it is quite easy to recover them by +mounting older sessions. +Growing is achieved by option -dev. + + The write method of *modifying* produces compact filesystem images +with no outdated files or directory trees. Modifying can write its +images to target media which are completely unsuitable for multi-session +operations. E.g. DVD-RW which were treated with -blank +deformat_quickest, DVD-R DL, named pipes, character devices, sockets. +On the other hand modified sessions cannot be written to appendable +media but to blank media only. +So for this method one needs either two optical drives or has to work +with filesystem objects as source and/or target medium. +Modifying takes place if input drive and output drive are not the same +and if option -grow_blindly is set to its default "off". This is +achieved by options -indev and -outdev. + + If option -grow_blindly is set to a non-negative number and if +-indev and -outdev are both set to different drives, then *blind +growing* is performed. It produces an add-on session which is ready for +being written to the given block address. This is the usage model of +mkisofs -M $indev -C $msc1,$msc2 -o $outdev +which gives much room for wrong parameter combinations and should thus +only be employed if a strict distinction between ISO formatter `xorriso' +and the burn program is desired. -C $msc1,$msc2 is equivalent to: +-load sbsector $msc1 -grow_blindly $msc2 + + +File: xorriso.info, Node: Drives, Next: Extras, Prev: Methods, Up: Top + +5 Libburn drives +**************** + +Input drive, i.e. source of an existing or empty ISO image, can be any +random access readable libburn drive: optical media with readable data, +blank optical media, regular files, block devices. + + Output drive, i.e. target for writing, can be any libburn drive. +Some drive types do not support the method of growing but only the +methods of modifying and blind growing. They all are suitable for newly +created images. +All drive file objects have to offer rw-permission to the user of +`xorriso'. Even those which will not be useable for reading an ISO +image. + + MMC compliant (i.e. optical) drives on GNU/Linux usually get +addressed by the path of their block device or of their generic +character device. E.g. +-dev /dev/sr0 +-dev /dev/hdc +-dev /dev/sg2 +On FreeBSD the device files have names like +-dev /dev/cd0 +On OpenSolaris: +-dev /dev/rdsk/c4t0d0s2 +Get a list of accessible drives by command +-device_links +It might be necessary to do this as *superuser* in order to see all +drives and to then allow rw-access for the intended users. Consider to +bundle the authorized users in a group like old "floppy". + + Filesystem objects of nearly any type can be addressed by prefix +"stdio:" and their path in the filesystem. E.g.: +-dev stdio:/dev/sdc +The default setting of -drive_class allows to address files outside the +/dev tree without that prefix. E.g.: +-dev /tmp/pseudo_drive +If path leads to a regular file or to a block device then the emulated +drive is random access readable and can be used for the method of +growing if it already contains a valid ISO 9660 image. Any other file +type is not readable via "stdio:" and can only be used as target for +the method of modifying or blind growing. Non-existing paths in +existing directories are handled as empty regular files. + + A very special kind of pseudo drive are open file descriptors. They +are depicted by "stdio:/dev/fd/" and descriptor number (see man 2 open). +Addresses "-" or "stdio:/dev/fd/1" depict standard output, which +normally is the output channel for result texts. To prevent a fatal +intermingling of ISO image and text messages, all result texts get +redirected to stderr if -*dev "-" or "stdio:/dev/fd/1" is among the +start arguments of the program. +Standard output is currently suitable for creating one session per +program run without dialog. Use in other situations is discouraged and +several restrictions apply: +It is not allowed to use standard output as pseudo drive if it was not +among the start arguments. Do not try to fool this ban via backdoor +addresses to stdout. +If stdout is used as drive, then -use_readline is permanently disabled. +Use of backdoors can cause severe memory and/or tty corruption. + + Be aware that especially the superuser can write into any accessible +file or device by using its path with the "stdio:" prefix. By default +any address in the /dev tree without prefix "stdio:" will work only if +it leads to a MMC drive. +One may use option *-ban_stdio_write* to surely prevent this risk and +to allow only MMC drives. +One may prepend "mmc:" to a path to surely disallow any automatic +"stdio:". By option -drive_class one may ban certain paths or allow +access without prefix "stdio:" to other paths. + + +File: xorriso.info, Node: Extras, Next: Processing, Prev: Drives, Up: Top + +6 Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr +************************************************** + +*Rock Ridge* is the name of a set of additional information which +enhance an ISO 9660 filesystem so that it can represent a POSIX +compliant filesystem with ownership, access permissions, symbolic +links, and other attributes. +This is what `xorriso' uses for a decent representation of the disk +files within the ISO image. Rock Ridge information is produced with any +`xorriso' image. + + `xorriso' is not named "porriso" because POSIX only guarantees 14 +characters of filename length. It is the X/Open System Interface +standard XSI which demands a file name length of up to 255 characters +and paths of up to 1024 characters. Rock Ridge fulfills this demand. + + An *El Torito* boot record points the BIOS bootstrapping facility to +one or more boot images, which are binary program files stored in the +ISO image. The content of the boot image files is not in the scope of +El Torito. +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot +images. `xorriso' is able to create or maintain an El Torito object +which makes such an image bootable. For details see option -boot_image. +It is possible to make ISO images bootable from USB stick or other +hard-disk-like media by -boot_image argument system_area= . This +installs a Master Boot Record which may get adjusted according to the +needs of GRUB resp. ISOLINUX. An *MBR* contains boot code and a +partition table. It does not hamper CDROM booting. The new MBR of a +follow-up session can get in effect only on overwriteable media. +Emulation -as mkisofs supports the example options out of the ISOLINUX +wiki, the options used in GRUB script grub-mkrescue, and the example in +the FreeBSD AvgLiveCD wiki. +There is support for boot facilities other than PC BIOS: EFI, MIPS Big +Endian (SGI), MIPS Little Endian (DEC), SUN SPARC. + +*ACL* are an advanced way of controlling access permissions to file +objects. Neither ISO 9660 nor Rock Ridge specify a way to record ACLs. +So libisofs has introduced a standard conformant extension named AAIP +for that purpose. It uses this extension if enabled by option *-acl*. +AAIP enhanced images are supposed to be mountable normally, but one +cannot expect that the mounted filesystem will show and respect the +ACLs. For now, only `xorriso' is able to retrieve those ACLs. It can +bring them into effect when files get restored to an ACL enabled file +system or it can print them in a format suitable for tool setfacl. +Files with ACL show as group permissions the setting of entry "mask::" +if that entry exists. Nevertheless the non-listed group members get +handled according to entry "group::". When removing ACL from a file, +`xorriso' brings "group::" into effect. +Recording and restoring of ACLs from and to local files works currently +only on GNU/Linux and FreeBSD. + + *xattr* (aka EA, or extattr) are pairs of name and value which can +be attached to file objects. AAIP is able to represent them and +`xorriso' allows to record and restore pairs which have names out of +the user namespace. I.e. those which begin with "user.", like "user.x" +or "user.whatever". Name has to be a 0 terminated string. Value may be +any array of bytes which does not exceed the size of 4095 bytes. xattr +processing happens only if it is enabled by option *-xattr*. +As with ACL, currently only `xorriso' is able to retrieve xattr from +AAIP enhanced images, to restore them to xattr capable file systems, or +to print them. +Recording and restoring of xattr from and to local files works currently +only on GNU/Linux and FreeBSD, where they are known as extattr. + + +File: xorriso.info, Node: Processing, Next: Dialog, Prev: Extras, Up: Top + +7 Command processing +******************** + +Commands are either actions which happen immediately or settings which +influence following actions. So their sequence does matter. +Commands consist of a command word, followed by zero or more parameter +words. If the list of parameter words is of variable length (indicated +by "[...]" or "[***]") then it has to be terminated by either the *list +delimiter*, or the end of argument list, or an end of an input line. + + At program start the list delimiter is the word "--". This may be +changed by option -list_delimiter in order to allow "--" as argument in +a list of variable length. It is advised to reset the delimiter to +"--" immediately afterwards. +For brevity the list delimiter is referred as "--" throughout this text. +The list delimiter is silently tolerated if it appears after the +parameters of a command with a fixed list length. It is handled as +normal text if it appears among the arguments of such a command. + + *Pattern expansion* converts a list of pattern words into a list of +existing file addresses. Unmatched pattern words appear themselves in +that result list, though. +Pattern matching supports the usual shell parser wildcards '*' '?' +'[xyz]' and respects '/' as separator which may only be matched +literally. +It is a property of some particular commands and not a general feature. +It gets controlled by commands -iso_rr_pattern and -disk_pattern. +Commands which may use pattern expansion all have variable argument +lists which are marked in this man page by "[***]" rather than "[...]". +Some other commands perform pattern matching unconditionally. + + Command and parameter words are either read from program arguments, +where one argument is one word, or from quoted input lines where words +are recognized similar to the quotation rules of a shell parser. +`xorriso' is not a shell, although it might appear so on first glimpse. +Be aware that the interaction of quotation marks and pattern symbols +like "*" differs from the usual shell parsers. In `xorriso', a +quotation mark does not make a pattern symbol literal. + + *Quoted input* converts whitespace separated text pieces into words. +The double quotation mark " and the single quotation mark ' can be used +to enclose whitespace and make it part of words (e.g. of file names). +Each mark type can enclose the marks of the other type. A trailing +backslash \ outside quotations or an open quotation cause the next +input line to be appended. +Quoted input accepts any ASCII character except NUL (0) as content of +quotes. Nevertheless it can be cumbersome for the user to produce +those characters at all. Therefore quoted input and program arguments +allow optional *Backslash Interpretation* which can represent all ASCII +characters except NUL (0) by backslash codes as in $'...' of bash. +It is not enabled by default. See option -backslash_codes. + + When the program starts then it first looks for argument -no_rc. If +this is not present then it looks for its startup files and reads their +content as command input lines. Then it interprets the program +arguments as commands and parameters. Finally it enters dialog mode if +command -dialog "on" was executed up to then. + + The program ends either by command -end, or by the end of program +arguments if not dialog was enabled up to that moment, or by a problem +event which triggers the threshold of command -abort_on. + + +File: xorriso.info, Node: Dialog, Next: Options, Prev: Processing, Up: Top + +8 Dialog, Readline, Result pager +******************************** + +Dialog mode prompts for a quoted input line, parses it into words, and +performs them as commands with their parameters. It provides assisting +services to make dialog more comfortable. + + Readline is an enhancement for the input line. You may know it +already from the bash shell. Whether it is available in `xorriso' +depends on the availability of package readline-dev at the time when +`xorriso' was built from its sourcecode. +It allows to move the cursor over the text in the line by help of the +Leftward and the Rightward arrow key. Text may be inserted at the +cursor position. The Delete key removes the character under the cursor. +Upward and Downward arrow keys navigate through the history of previous +input lines. +See info readline for more info about libreadline. + + Option -page activates a built-in result text pager which may be +convenient in dialog. After an action has put out the given number of +terminal lines, the pager prompts the user for a line of input. +An empty line lets `xorriso' resume work until the next page is put out. +The single character "@" disables paging for the current action. +"@@@", "x", "q", "X", or "Q" urge the current action to abort and +suppress further result output. +Any other line will be interpreted as new dialog line. The current +action is urged to abort. Afterwards, the input line is executed. + + Some actions apply paging to their info output, too. +The urge to abort may or may not be obeyed by the current action. All +actions try to abort as soon as possible. + + +File: xorriso.info, Node: Options, Next: Examples, Prev: Dialog, Up: Top + +9 Options +********* + +All command words are shown with a leading dash although this dash is +not mandatory for the option to be recognized. Nevertheless within +option -as the dashes of the emulated options are mandatory. +Normally any number of leading dashes is ignored with command words and +inner dashes are interpreted as underscores. + +* Menu: + +* AqDrive:: Aquiring source and target drive +* Loading:: Influencing the behavior of image loading +* Insert:: Inserting files into ISO image +* SetInsert:: Settings for file insertion +* Manip:: File manipulations +* CmdFind:: Tree traversal command -find +* Filter:: Filters for data file content +* Writing:: Writing the result, drive control +* SetWrite:: Settings for result writing +* Bootable:: Bootable ISO images +* Jigdo:: Jigdo Template Extraction +* Charset:: Character sets +* Exception:: Exception processing +* DialogCtl:: Dialog mode control +* Inquiry:: Drive and media related inquiry actions +* Navigate:: Navigation in ISO image and disk filesystem +* Verify:: Evaluation of readability and recovery +* Restore:: osirrox ISO-to-disk restore options +* Emulation:: Command compatibility emulations (cdrtools) +* Scripting:: Scripting, dialog and program control features +* Frontend:: Support for frontend programs via stdin and stdout + + +File: xorriso.info, Node: AqDrive, Next: Loading, Prev: Options, Up: Options + +9.1 Aquiring source and target drive +==================================== + +The effect of aquiring a drive may depend on several options in the +next paragraph "Influencing the behavior of image loading". If +desired, their enabling commands have to be performed before the +commands which aquire the drive. + +-dev address + Set input and output drive to the same address and load an ISO + image if it is present. If there is no ISO image then create a + blank one. Set the image expansion method to growing. + This is only allowed as long as no changes are pending in the + currently loaded ISO image. If changes are pending, then one has + to perform -commit or -rollback first. + Special address string "-" means standard output, to which several + restrictions apply. See above paragraph "Libburn drives". + An empty address string "" gives up the current device without + aquiring a new one. + +-indev address + Set input drive and load an ISO image if present. If the new + input drive differs from -outdev then switch from growing to + modifying or to blind growing. It depends on the setting of + -grow_blindly which of both gets activated. The same rules and + restrictions apply as with -dev. + +-outdev address + Set output drive and if it differs from the input drive then + switch from growing to modifying or to blind growing. Unlike -dev + and -indev this action does not load a new ISO image. So it can be + performed even if there are pending changes. + -outdev can be performed without previous -dev or -indev. In that + case an empty ISO image with no changes pending is created. It can + either be populated by help of -map, -add et.al. or it can be + discarded silently if -dev or -indev are performed afterwards. + Special address string "-" means standard output, to which several + restrictions apply. See above paragraph "Libburn drives". + An empty address string "" gives up the current output drive + without aquiring a new one. No writing is possible without an + output drive. + +-grow_blindly "off"|predicted_nwa + If predicted_nwa is a non-negative number then perform blind + growing rather than modifying if -indev and -outdev are set to + different drives. "off" or "-1" switch to modifying, which is the + default. + predicted_nwa is the block address where the add-on session of + blind growing will finally end up. It is the responsibility of the + user to ensure this final position and the presence of the older + sessions. Else the overall ISO image will not be mountable or will + produce read errors when accessing file content. `xorriso' will + write the session to the address as obtained from examining + -outdev and not necessarily to predicted_nwa. + During a run of blind growing, the input drive is given up before + output begins. The output drive is given up when writing is done. + + +File: xorriso.info, Node: Loading, Next: Insert, Prev: AqDrive, Up: Options + +9.2 Influencing the behavior of image loading +============================================= + +The following options should normally be performed before loading an +image by aquiring an input drive. In rare cases it is desirable to +activate them only after image loading. + +-load entity id + Load a particular (possibly outdated) ISO session from -dev or + -indev. Usually all available sessions are shown with option -toc. + entity depicts the kind of addressing. id depicts the particular + address. The following entities are defined: + "auto" with any id addresses the last session in -toc. This is the + default. + "session" with id being a number as of a line "ISO session", + column "Idx". + "track" with id being a number as of a line "ISO track", column + "Idx". + "lba" or "sbsector" with a number as of a line "ISO ...", column + "sbsector". + "volid" with a search pattern for a text as of a line "ISO ...", + column "Volume Id". + Adressing a non-existing entity or one which does not represent an + ISO image will either abandon -indev or at least lead to a blank + image. + If an input drive is set at the moment when -load is executed, + then the addressed ISO image is loaded immediately. Else, the + setting will be pending until the next -dev or -indev. After the + image has been loaded once, the setting is valid for -rollback + until next -dev or -indev, where it will be reset to "auto". + +-displacement [-]lba + Compensate a displacement of the image versus the start address + for which the image was prepared. This affects only loading of ISO + images and reading of their files. The multi-session method of + growing is not allowed as long as -displacement is non-zero. I.e. + -indev and -outdev must be different. The displacement gets reset + to 0 before the drive gets re-aquired after writing. + Examples: + If a track of a CD starts at block 123456 and gets copied to a + disk file where it begins at block 0, then this copy can be loaded + with -displacement -123456. + If an ISO image was written onto a partition with offset of 640000 + blocks of 512 bytes, then it can be loaded from the base device by + -displacement 160000. + In both cases, the ISO sessions should be self contained, i.e. not + add-on sessions to an ISO image outside their track resp. + partition. + +-drive_class "harmless"|"banned"|"caution"|"clear_list" disk_pattern + Add a drive path pattern to one of the safety lists or make those + lists empty. There are three lists defined which get tested in + the following sequence: + If a drive address path matches the "harmless" list then the drive + will be accepted. If it is not a MMC device then the prefix + "stdio:" will be prepended automatically. This list is empty by + default. + Else if the path matches the "banned" list then the drive will not + be accepted by `xorriso' but rather lead to a FAILURE event. This + list is empty by default. + Else if the path matches the "caution" list and if it is not a MMC + device, then its address must have the prefix "stdio:" or it will + be rejected. This list has by default one entry: "/dev". + If a drive path matches no list then it is considered "harmless". + By default these are all paths which do not begin with directory + "/dev". + A path matches a list if one of its parent paths or itself matches + a list entry. Address prefix "stdio:" or "mmc:" will be ignored + when testing for matches. + By pseudo-class "clear_list" and pseudo-patterns "banned", + "caution", "harmless", or "all", the lists may be made empty. + E.g.: -drive_class clear_list banned + One will normally define the -drive_class lists in one of the + `xorriso' Startup Files. + Note: This is not a security feature but rather a bumper for the + superuser to prevent inadverted mishaps. For reliably blocking + access to a device file you have to deny its rw-permissions in the + filesystem. + +-assert_volid pattern severity + Refuse to load ISO images with volume ids which do not match the + given search pattern. When refusing an image, give up the input + drive and issue an event of the given severity (like FAILURE, see + -abort_on). An empty search pattern accepts any image. + This option does not hamper the creation of an empty image from + blank input media and does not discard an already loaded image. + +-in_charset character_set_name + Set the character set from which to convert file names when + loading an image. See paragraph "Character sets" for more + explanations. When loading the written image after -commit the + setting of -out_charset will be copied to -in_charset. + +-auto_charset "on"|"off" + Enable or disable recording and interpretation of the output + character set name in an xattr attribute of the image root + directory. If enabled and if a recorded character set name is + found, then this name will be used as namoe of the input character + set when reading an image. + Note that the default output charset is the local character set of + the terminal where `xorriso' runs. Before attributing this local + character set to the produced ISO image, check whether the + terminal properly displays all intended filenames, especially + exotic national characters. + +-hardlinks mode[:mode...] + Enable or disable loading and recording of hardlink relations. + In default mode "off", iso_rr files lose their inode numbers at + image load time. Each iso_rr file object which has no inode number + at image generation time will get a new unique inode number if + -compliance is set to new_rr. + Mode "on" preserves inode numbers from the loaded image if such + numbers were recorded. When committing a session it searches for + families of iso_rr files which stem from the same disk file, have + identical content filtering and have identical properties. The + family members all get the same inode number. Whether these + numbers are respected at mount time depends on the operating + system. + Commands -update and -update_r track splits and fusions of hard + links in filesystems which have stable device and inode numbers. + This can cause automatic last minute changes before the session + gets written. Command -hardlinks "perform_update" may be used to + do these changes earlier, e.g. if you need to apply filters to all + updated files. + Mode "without_update" avoids hardlink processing during update + commands. Use this if your filesystem situation does not allow + -disk_dev_ino "on". + `xorriso' commands which extract files from an ISO image try to + hardlink files with identical inode number. The normal scope of + this operation is from image load to image load. One may give up + the accumulated hard link addresses by -hardlinks + "discard_extract". + A large number of hardlink families may exhaust -temp_mem_limit if + not -osirrox "sort_lba_on" and -hardlinks "cheap_sorted_extract" + are both in effect. This restricts hard linking to other files + restored by the same single extract command. -hardlinks + "normal_extract" re-enables wide and expensive hardlink + accumulation. +-acl "on"|"off" + Enable or disable processing of ACLs. If enabled, then `xorriso' + will obtain ACLs from disk file objects, store ACLs in the ISO + image using the libisofs specific AAIP format, load AAIP data from + ISO images, test ACL during file comparison, and restore ACLs to + disk files when extracting them from ISO images. See also options + -getfacl, -setfacl. + +-xattr "on"|"off" + Enable or disable processing of xattr attributes in user namespace. + If enabled, then `xorriso' will handle xattr similar to ACL. See + also options -getfattr, -setfattr and above paragraph about xattr. + +-md5 "on"|"all"|"off"|"load_check_off" + Enable or disable processing of MD5 checksums for the overall + session and for each single data file. If enabled then images with + checksum tags get loaded only if the tags of superblock and + directory tree match properly. The MD5 checksums of data files and + whole session get loaded from the image if there are any. + With options -compare and -update the recorded MD5 of a file will + be used to avoid content reading from the image. Only the disk file + content will be read and compared with that MD5. This can save + much time if -disk_dev_ino "on" is not suitable. + At image generation time they are computed for each file which + gets its data written into the new session. The checksums of files + which have their data in older sessions get copied into the new + session. Superblock, tree and whole session get a checksum tag + each. + Mode "all" will additionally check during image generation whether + the checksum of a data file changed between the time when its + reading began and the time when it ended. This implies reading + every file twice. + Mode "load_check_off" together with "on" or "all" will load + recorded MD5 sums but not test the recorded checksum tags of + superblock and directory tree. This is necessary if growisofs was + used as burn program, because it does not overwrite the superblock + checksum tag of the first session. Therefore load_check_off is in + effect when `xorriso' -as mkisofs option -M is performed. + The test can be re-enabled by mode "load_check_on". + Checksums can be exploited via options -check_md5, -check_md5_r, + via find actions get_md5, check_md5, and via -check_media. + +-for_backup + Enable all extra features which help to produce or to restore + backups with highest fidelity of file properties. Currently this + is a shortcut for: -hardlinks on -acl on -xattr on -md5 on. + +-disk_dev_ino "on"|"ino_only"|"off" + Enable or disable processing of recorded file identification + numbers (dev_t and ino_t). If enabled they are stored as xattr and + allow to substantially accelerate file comparison. The root node + gets a global start timestamp. If during comparison a file with + younger timestamps is found in the ISO image, then it is suspected + to have inconsistent content. + If device numbers and inode numbers of the disk filesystems are + persistent and if no irregular alterations of timestamps or system + clock happen, then potential content changes can be detected + without reading that content. File content change is assumed if + any of mtime, ctime, device number or inode number have changed. + Mode "ino_only" replaces the precondition that device numbers are + stable by the precondition that mount points in the compared tree + always lead to the same filesystems. Use this if mode "on" always + sees all files changed. + The speed advantage appears only if the loaded session was + produced with -disk_dev_ino "on" too. + Note that -disk_dev_ino "off" is totally in effect only if + -hardlinks is "off", too. + +-rom_toc_scan "on"|"force"|"off"[:"emul_on"|"emul_off"] + Read-only drives do not tell the actual media type but show any + media as ROM (e.g. as DVD-ROM). The session history of MMC + multi-session media might be truncated to first and last session + or even be completely false. (The emulated history of + overwriteable media is not affected by this.) + To have in case of failure a chance of getting the session history + and especially the address of the last session, there is a scan + for ISO 9660 filesystem headers which might help but also might + yield worse results than the drive's table of content. At its end + it can cause read attempts to invalid addresses and thus ugly + drive behavior. Setting "on" enables that scan for alleged + read-only media. + Some operating systems are not able to mount the most recent + session of multi-session DVD or BD. If on such a system `xorriso' + has no own MMC capabilities then it may still find that session + from a scanned table of content. Setting "force" handles any media + like a ROM medium with setting "on". + On the other hand the emulation of session history on + overwriteable media can hamper reading of partly damaged media. + Setting "off:emul_off" disables the elsewise trustworthy + table-of-content scan for those media. + To be in effect, the -rom_toc_scan setting has to be made before + the -*dev command which aquires drive and medium. + +-calm_drive "in"|"out"|"all"|"revoke"|"on"|"off" + Reduce drive noise until it is actually used again. Some drives + stay alert for substantial time after they have been used for + reading. This reduces the startup time for the next drive + operation but can be loud and waste energy if no i/o with the + drive is expected to happen soon. + Modes "in", "out", "all" immediately calm down -indev, -outdev, + resp. both. Mode "revoke" immediately alerts both. Mode "on" + causes -calm_drive to be performed automatically after each -dev, + -indev, and -outdev. Mode "off" disables this. + +-ban_stdio_write + Allow for writing only the usage of MMC optical drives. Disallow + to write the result into files of nearly arbitrary type. Once + set, this command cannot be revoked. + +-early_stdio_test "on"|"appendable_wo"|"off" + If enabled by "on" then regular files and block devices get tested + for effective access permissions. This implies to try opening + those files for writing, which otherwise will happen only later + and only if actual writing is desired. + The test result is used for classifying the pseudo drives as + overwriteable, read-only, write-only, or uselessly empty. This may + lead to earlier detection of severe problems, and may avoid some + less severe error events. + Mode "appendable_wo" is like "on" with the additional property that + non-empty write-only files are regarded as appendable rather than + blank. + + +File: xorriso.info, Node: Insert, Next: SetInsert, Prev: Loading, Up: Options + +9.3 Inserting files into ISO image +================================== + +The following commands expect file addresses of two kinds: *disk_path* +is a path to an object in the local filesystem tree. *iso_rr_path* is +the Rock Ridge name of a file object in the ISO image. (Do not confuse +with the lowlevel ISO 9660 names visible if Rock Ridge gets ignored.) + + Note that in the ISO image you are as powerful as the superuser. +Access permissions of the existing files in the image do not apply to +your write operations. They are intended to be in effect with the +read-only mounted image. + + If the iso_rr_path of a newly inserted file leads to an existing +file object in the ISO image, then the following collision handling +happens: +If both objects are directories then they get merged by recursively +inserting the subobjects from filesystem into ISO image. If other file +types collide then the setting of command *-overwrite* decides. +Renaming of files has similar collision handling, but directories can +only be replaced, not merged. Note that if the target directory exists, +then -mv inserts the source objects into this directory rather than +attempting to replace it. + + The commands in this section alter the ISO image and not the local +filesystem. + +-disk_pattern "on"|"ls"|"off" + Set the pattern expansion mode for the disk_path arguments of + several commands which support this feature. + Setting "off" disables this feature for all commands which are + marked in this man page by "disk_path [***]" or "disk_pattern + [***]". + Setting "on" enables it for all those commands. + Setting "ls" enables it only for those which are marked by + "disk_pattern [***]". + Default is "ls". + +-add pathspec [...] | disk_path [***] + Insert the given files or directory trees from filesystem into the + ISO image. + If -pathspecs is set to "on" then pattern expansion is always + disabled and character '=' has a special meaning. It separates the + ISO image path from the disk path: + iso_rr_path=disk_path + The separator '=' can be escaped by '\'. If iso_rr_path does not + begin with '/' then -cd is prepended. If disk_path does not begin + with '/' then -cdx is prepended. + If no '=' is given then the word is used as both, iso_rr_path and + disk path. If in this case the word does not begin with '/' then + -cdx is prepended to the disk_path and -cd is prepended to the + iso_rr_path. + If -pathspecs is set to "off" then -disk_pattern expansion + applies, if enabled. The resulting words are used as both, + iso_rr_path and disk path. Relative path words get prepended the + setting of -cdx to disk_path and the setting of -cd to iso_rr_path. + +-add_plainly mode + If set to mode "unknown" then any command word that does not begin + with "-" and is not recognized as known command will be subject to + a virtual -add command. I.e. it will be used as pathspec or as + disk_path and added to the image. If enabled, -disk_pattern + expansion applies to disk_paths. + Mode "dashed" is similar to "unknown" but also adds unrecognized + command words even if they begin with "-". + Mode "any" announces that all further words are to be added as + pathspecs or disk_paths. This does not work in dialog mode. + Mode "none" is the default. It prevents any words from being + understood as files to add, if they are not parameters to + appropriate commands. + +-path_list disk_path + Like -add but read the parameter words from file disk_path or + standard input if disk_path is "-". The list must contain exactly + one pathspec resp. disk_path pattern per line. + +-quoted_path_list disk_path + Like -path_list but with quoted input reading rules. Lines get + split into parameter words for -add. Whitespace outside quotes is + discarded. + +-map disk_path iso_rr_path + Insert file object disk_path into the ISO image as iso_rr_path. If + disk_path is a directory then its whole sub tree is inserted into + the ISO image. + +-map_single disk_path iso_rr_path + Like -map, but if disk_path is a directory then its sub tree is + not inserted. + +-map_l disk_prefix iso_rr_prefix disk_path [***] + Perform -map with each of the disk_path arguments. iso_rr_path + will be composed from disk_path by replacing disk_prefix by + iso_rr_prefix. + +-update disk_path iso_rr_path + Compare file object disk_path with file object iso_rr_path. If + they do not match, then perform the necessary image manipulations + to make iso_rr_path a matching copy of disk_path. By default this + comparison will imply lengthy content reading before a decision is + made. Options -disk_dev_ino or -md5 may accelerate comparison if + they were already in effect when the loaded session was recorded. + If disk_path is a directory and iso_rr_path does not exist yet, + then the whole subtree will be inserted. Else only directory + attributes will be updated. + +-update_r disk_path iso_rr_path + Like -update but working recursively. I.e. all file objects below + both addresses get compared whether they have counterparts below + the other address and whether both counterparts match. If there is + a mismatch then the necessary update manipulation is done. + Note that the comparison result may depend on option -follow. Its + setting should always be the same as with the first adding of + disk_path as iso_rr_path. + If iso_rr_path does not exist yet, then it gets added. If + disk_path does not exist, then iso_rr_path gets deleted. + +-update_l disk_prefix iso_rr_prefix disk_path [***] + Perform -update_r with each of the disk_path arguments. + iso_rr_path will be composed from disk_path by replacing + disk_prefix by iso_rr_prefix. + +-cut_out disk_path byte_offset byte_count iso_rr_path + Map a byte interval of a regular disk file into a regular file in + the ISO image. This may be necessary if the disk file is larger + than a single medium, or if it exceeds the traditional limit of 2 + GiB - 1 for old operating systems, or the limit of 4 GiB - 1 for + newer ones. Only the newest Linux kernels seem to read properly + files >= 4 GiB - 1. + A clumsy remedy for this limit is to backup file pieces and to + concatenate them at restore time. A well tested chopping size is + 2047m. It is permissible to request a higher byte_count than + available. The resulting file will be truncated to the correct + size of a final piece. To request a byte_offset higher than + available yields no file in the ISO image but a SORRY event. E.g: + -cut_out /my/disk/file 0 2047m \ + /file/part_1_of_3_at_0_with_2047m_of_5753194821 \ + -cut_out /my/disk/file 2047m 2047m \ + /file/part_2_of_3_at_2047m_with_2047m_of_5753194821 \ + -cut_out /my/disk/file 4094m 2047m \ + /file/part_3_of_3_at_4094m_with_2047m_of_5753194821 + While option -split_size is set larger than 0, and if all pieces + of a file reside in the same ISO directory with no other files, + and if the names look like above, then their ISO directory will be + recognized and handled like a regular file. This affects options + -compare*, -update*, and overwrite situations. See option + -split_size for details. + +-cpr disk_path [***] iso_rr_path + Insert the given files or directory trees from filesystem into the + ISO image. + The rules for generating the ISO addresses are similar as with + shell command cp -r. Nevertheless, directories of the iso_rr_path + are created if necessary. Especially a not yet existing iso_rr_path + will be handled as directory if multiple disk_paths are present. + The leafnames of the multiple disk_paths will be grafted under that + directory as would be done with an existing directory. + If a single disk_path is present then a non-existing iso_rr_path + will get the same type as the disk_path. + If a disk_path does not begin with '/' then -cdx is prepended. If + the iso_rr_path does not begin with '/' then -cd is prepended. + +-mkdir iso_rr_path [...] + Create empty directories if they do not exist yet. Existence as + directory generates a WARNING event, existence as other file + causes a FAILURE event. + +-clone iso_rr_path_original iso_rr_path_copy + Create a copy of the ISO file object iso_rr_path_original with the + new address iso_rr_path_copy. If the original is a directory then + copy all files and directories underneath. If iso_rr_path_original + is a boot catalog file, then it gets not copied but is silently + ignored. + The copied ISO file objects have the same attributes. Copied data + files refer to the same content source as their originals. The + copies may then be manipulated independendly of their originals. + This command will refuse execution if the address iso_rr_path_copy + already exists in the ISO tree. + +-cp_clone iso_rr_path_original [***] iso_rr_path_dest + Create copies of one or more ISO file objects as with command + -clone. In case of collision merge directories with existing + ones, but do not overwrite existing ISO file objects. + The rules for generating the copy addresses are the same as with + command -cpr (see above) resp. shell command cp -r. Other than + with -cpr, relative iso_rr_path_original will get prepended the + -cd path and not the -cdx path. Consider to -mkdir + iso_rr_path_dest before -cp_clone so the copy address does not + depend on the number of iso_rr_path_original arguments. + + +File: xorriso.info, Node: SetInsert, Next: Manip, Prev: Insert, Up: Options + +9.4 Settings for file insertion +=============================== + +-file_size_limit value [value [...]] -- + Set the maximum permissible size for a single data file. The + values get summed up for the actual limit. If the only value is + "off" then the file size is not limited by `xorriso'. Default is + a limit of 100 extents, 4g -2k each: + -file_size_limit 400g -200k -- + When mounting ISO 9660 filesystems, old operating systems can + handle only files up to 2g -1 --. Newer ones are good up to 4g -1 + --. You need quite a new Linux kernel to read correctly the final + bytes of a file >= 4g if its size is not aligned to 2048 byte + blocks. + `xorriso''s own data read capabilities are not affected by + operating system size limits. Such limits apply to mounting only. + Nevertheless, the target filesystem of an -extract must be able to + take the file size. + +-not_mgt code[:code[...]] + Control the behavior of the exclusion lists. + Exclusion processing happens before disk_paths get mapped to the + ISO image and before disk files get compared with image files. + The absolute disk path of the source is matched against the + -not_paths list. The leafname of the disk path is matched against + the patterns in the -not_leaf list. If a match is detected then + the disk path will not be regarded as an existing file and not be + added to the ISO image. + Several codes are defined. The _on/_off settings persist until + they are revoked by their_off/_on counterparts. + "erase" empties the lists which were accumulated by -not_paths and + -not_leaf. + "reset" is like "erase" but also re-installs default behavior. + "off" disables exclusion processing temporarily without + invalidating the lists and settings. + "on" re-enables exclusion processing. + "param_off" applies exclusion processing only to paths below + disk_path parameter of commands. I.e. explicitly given disk_paths + are exempted from exclusion processing. + "param_on" applies exclusion processing to command parameters as + well as to files below such parameters. + "subtree_off" with "param_on" excludes parameter paths only if they + match a -not_paths item exactly. + "subtree_on" additionally excludes parameter paths which lead to a + file address below any -not_paths item. + "ignore_off" treats excluded disk files as if they were missing. + I.e. they get reported with -compare and deleted from the image + with -update. + "ignore_on" keeps excluded files out of -compare or -update + activities. + +-not_paths disk_path [***] + Add the given paths to the list of excluded absolute disk paths. + If a given path is relative, then the current -cdx is prepended to + form an absolute path. Pattern matching, if enabled, happens at + definition time and not when exclusion checks are made. + (Do not forget to end the list of disk_paths by "--") + +-not_leaf pattern + Add a single shell parser style pattern to the list of exclusions + for disk leafnames. These patterns are evaluated when the + exclusion checks are made. + +-not_list disk_path + Read lines from disk_path and use each of them either as + -not_paths argument, if they contain a / character, or as + -not_leaf pattern. + +-quoted_not_list disk_path + Like -not_list but with quoted input reading rules. Each word is + handled as one argument for -not_paths resp. -not_leaf. + +-follow occasion[:occasion[...]] + Enable or disable resolution of symbolic links and mountpoints + under disk_paths. This applies to actions -add, -du*x, -ls*x, + -findx, and to -disk_pattern expansion. + There are two kinds of follow decisison to be made: + "link" is the hop from a symbolic link to its target file object. + If enabled then symbolic links are handled as their target file + objects, else symbolic links are handled as themselves. + "mount" is the hop from one filesystem to another subordinate + filesystem. If enabled then mountpoint directories are handled as + any other directory, else mountpoints are handled as empty + directories if they are encountered in directory tree traversals. + Less general than above occasions: + "pattern" is mount and link hopping, but only during -disk_pattern + expansion. + "param" is link hopping for parameter words (after eventual + pattern expansion). If enabled then -ls*x will show the link + targets rather than the links themselves. -du*x, -findx, and -add + will process the link targets but not follow links in an eventual + directory tree below the targets (unless "link" is enabled). + Occasions can be combined in a colon separated list. All occasions + mentioned in the list will then lead to a positive follow decision. + "off" prevents any positive follow decision. Use it if no other + occasion applies. + Shortcuts: + "default" is equivalent to "pattern:mount:limit=100". + "on" always decides positive. Equivalent to "link:mount". + + Not an occasion but an optional setting is: + "limit="<number> which sets the maximum number of link hops. A + link hop consists of a sequence of symbolic links and a final + target of different type. Nevertheless those hops can loop. + Example: + $ ln -s .. uploop + Link hopping has a built-in loop detection which stops hopping at + the first repetition of a link target. Then the repeated link is + handled as itself and not as its target. Regrettably one can + construct link networks which cause exponential workload before + their loops get detected. The number given with "limit=" can curb + this workload at the risk of truncating an intentional sequence of + link hops. + +-pathspecs "on"|"off" + Control parameter interpretation with `xorriso' actions -add and + -path_list. + "on" enables pathspecs of the form *target=source* like with + program mkisofs -graft-points. It also disables -disk_pattern + expansion for command -add. + "off" disables pathspecs of the form target=source and re-enables + -disk_pattern expansion. + +-overwrite "on"|"nondir"|"off" + Allow or disallow to overwrite existing files in the ISO image by + files with the same name. + With setting "off", name collisions cause FAILURE events. With + setting "nondir", only directories are protected by such events, + other existing file types get treated with -rm before the new file + gets added. Setting "on" allows automatic -rm_r. I.e. a + non-directory can replace an existing directory and all its + subordinates. + If restoring of files is enabled, then the overwrite rule applies + to the target file objects on disk as well, but "on" is downgraded + to "nondir". + +-split_size number["k"|"m"] + Set the threshold for automatic splitting of regular files. Such + splitting maps a large disk file onto a ISO directory with several + part files in it. This is necessary if the size of the disk file + exceeds -file_size_limit. Older operating systems can handle + files in mounted ISO 9660 filesystems only if they are smaller + than 2 GiB resp. 4 GiB. + Default is 0 which will exclude files larger than -file_size_limit + by a FAILURE event. A well tested -split_size is 2047m. Sizes + above -file_size_limit are not permissible. + While option -split_size is set larger than 0 such a directory + with split file pieces will be recognized and handled like a + regular file by options -compare* , -update*, and in overwrite + situations. There are -ossirox options "concat_split_on" and + "concat_split_off" which control the handling when files get + restored to disk. + In order to be recognizable, the names of the part files have to + describe the splitting by 5 numbers: + part_number,total_parts,byte_offset,byte_count,disk_file_size + which are embedded in the following text form: + part_#_of_#_at_#_with_#_of_# + Scaling characters like "m" or "k" are taken into respect. All + digits are interpreted as decimal, even if leading zeros are + present. + E.g: /file/part_1_of_3_at_0_with_2047m_of_5753194821 + No other files are allowed in the directory. All parts have to be + present and their numbers have to be plausible. E.g. byte_count + must be valid as -cut_out argument and their contents may not + overlap. + + +File: xorriso.info, Node: Manip, Next: CmdFind, Prev: SetInsert, Up: Options + +9.5 File manipulations +====================== + +The following commands manipulate files in the ISO image, regardless +whether they stem from the loaded image or were newly inserted. + +-iso_rr_pattern "on"|"ls"|"off" + Set the pattern expansion mode for the iso_rr_path arguments of + several commands which support this feature. + Setting "off" disables pattern expansion for all commands which + are marked in this man page by "iso_rr_path [***]" or + "iso_rr_pattern [***]". + Setting "on" enables it for all those commands. + Setting "ls" enables it only for those which are marked by + "iso_rr_pattern [***]". + Default is "on". + +-rm iso_rr_path [***] + Delete the given files from the ISO image. + Note: This does not free any space on the -indev medium, even if + the deletion is committed to that same medium. + The image size will shrink if the image is written to a different + medium in modification mode. + +-rm_r iso_rr_path [***] + Delete the given files or directory trees from the ISO image. See + also the note with option -rm. + +-rmdir iso_rr_path [***] + Delete empty directories. + +-mv iso_rr_path [***] iso_rr_path + Rename the given file objects in the ISO tree to the last argument + in the list. Use the same rules as with shell command mv. + If pattern expansion is enabled and if the last argument contains + wildcard characters then it must match exactly one existing file + address, or else the command fails with a FAILURE event. + +-chown uid iso_rr_path [***] + Set ownership of file objects in the ISO image. uid may either be + a decimal number or the name of a user known to the operating + system. + +-chown_r uid iso_rr_path [***] + Like -chown but affecting all files below eventual directories. + +-chgrp gid iso_rr_path [***] + Set group attribute of file objects in the ISO image. gid may + either be a decimal number or the name of a group known to the + operating system. + +-chgrp_r gid iso_rr_path [***] + Like -chgrp but affecting all files below eventual directories. + +-chmod mode iso_rr_path [***] + Equivalent to shell command chmod in the ISO image. mode is + either an octal number beginning with "0" or a comma separated + list of statements of the form [ugoa]*[+-=][rwxst]* . + Like: go-rwx,u+rwx . + *Personalities*: u=user, g=group, o=others, a=all + *Operators*: + adds given permissions, - revokes given permissions, + = revokes all old permissions and then adds the given ones. + *Permissions*: r=read, w=write, x=execute|inspect, + s=setuid|setgid, t=sticky bit + For octal numbers see man 2 stat. + +-chmod_r mode iso_rr_path [***] + Like -chmod but affecting all files below eventual directories. + +-setfacl acl_text iso_rr_path [***] + Attach the given ACL to the given iso_rr_paths. If the files + already have ACLs, then those get deleted before the new ones get + into effect. If acl_text is empty, or contains the text "clear" + or the text "--remove-all", then the existing ACLs will be removed + and no new ones will be attached. Any other content of acl_text + will be interpreted as a list of ACL entries. It may be in the + long multi-line format as put out by -getfacl but may also be + abbreviated as follows: + ACL entries are separated by comma or newline. If an entry is + empty text or begins with "#" then it will be ignored. A valid + entry has to begin by a letter out of {ugom} for "user", "group", + "other", "mask". It has to contain two colons ":". A non-empty + text between those ":" gives a user id resp. group id. After the + second ":" there may be letters out of {rwx- #}. The first three + give read, write resp. execute permission. Letters "-", " " and + TAB are ignored. "#" causes the rest of the entry to be ignored. + Letter "X" or any other letters are not supported. Examples: + g:toolies:rw,u:lisa:rw,u:1001:rw,u::wr,g::r,o::r,m::rw + group:toolies:rw-,user::rw-,group::r--,other::r--,mask::rw- + A valid entry may be prefixed by "d", some following characters + and ":". This indicates that the entry goes to the "default" ACL + rather than to the "access" ACL. Example: + u::rwx,g::rx,o::,d:u::rwx,d:g::rx,d:o::,d:u:lisa:rwx,d:m::rwx + +-setfacl_r acl_text iso_rr_path [***] + Like -setfacl but affecting all files below eventual directories. + +-setfacl_list disk_path + Read the output of -getfacl_r or shell command getfacl -R and + apply it to the iso_rr_paths as given in lines beginning with "# + file:". This will change ownership, group and ACL of the given + files. If disk_path is "-" then lines are read from standard + input. Line "@" ends the list, "@@@" aborts without changing the + pending iso_rr_path. + Since -getfacl and getfacl -R strip leading "/" from file paths, + the setting of -cd does always matter. + +-setfattr [-]name value iso_rr_path [***] + Attach the given xattr pair of name and value to the given + iso_rr_paths. If the given name is prefixed by "-", then the pair + with that name gets removed from the xattr list. If name is + "--remove-all" then all user namespace xattr of the given + iso_rr_paths get deleted. In case of deletion, value must be an + empty text. + Only names from the user namespace are allowed. I.e. a name has to + begin with "user.", like "user.x" or "user.whatever". + Values and names undergo the normal input processing of `xorriso'. + See also option -backslash_codes. Other than with option + -setfattr_list, the byte value 0 cannot be expressed via -setfattr. + +-setfattr_r [-]name value iso_rr_path [***] + Like -setfattr but affecting all files below eventual directories. + +-setfattr_list disk_path + Read the output of -getfattr_r or shell command getfattr -Rd and + apply it to the iso_rr_paths as given in lines beginning with "# + file:". All previously existing user space xattr of the given + iso_rr_paths will be deleted. If disk_path is "-" then lines are + read from standard input. + Since -getfattr and getfattr -Rd strip leading "/" from file + paths, the setting of -cd does always matter. + Empty input lines and lines which begin by "#" will be ignored + (except "# file:"). Line "@" ends the list, "@@@" aborts without + changing the pending iso_rr_path. Other input lines must have the + form + name="value" + Name must be from user namespace. I.e. user.xyz where xyz should + consist of printable characters only. The separator "=" is not + allowed in names. Value may contain any kind of bytes. It must be + in quotes. Trailing whitespace after the end quote will be + ignored. Non-printables bytes and quotes must be represented as + \XYZ by their octal ASCII code XYZ. Use code \000 for 0-bytes. + +-alter_date type timestring iso_rr_path [***] + Alter the date entries of a file in the ISO image. type is one of + "a", "m", "b" for access time, modification time, both times. + timestring may be in the following formats (see also section + EXAMPLES): + As expected by program date: MMDDhhmm[[CC]YY][.ss]] + As produced by program date: + [Day] MMM DD hh:mm:ss [TZON] YYYY + Relative times counted from current clock time: + +|-Number["s"|"h"|"d"|"w"|"m"|"y"] + where "s" means seconds, "h" hours, "d" days, "w" weeks, "m"=30d, + "y"=365.25d plus 1d added to multiplication result. + Absolute seconds counted from Jan 1 1970: + =Number + `xorriso''s own timestamps: + YYYY.MM.DD[.hh[mm[ss]]] + scdbackup timestamps: + YYMMDD[.hhmm[ss]] + where "A0" is year 2000, "B0" is 2010, etc. + +-alter_date_r type timestring iso_rr_path [***] + Like -alter_date but affecting all files below eventual + directories. + +-hide hide_state iso_rr_path [***] + Prevent the names of the given files from showing up in the + directory trees of ISO 9660 and/or Joliet when the image gets + written. The data content of such hidden files will be included + in the resulting image, even if they do not show up in any + directory. But you will need own means to find nameless data in + the image. + Warning: Data which are hidden from the ISO 9660 tree will not be + copied by the write method of modifying. + Possible values of hide_state are: "iso_rr" for hiding from ISO + 9660 tree, "joliet" for Joliet tree, "on" for both trees. "off" + means visibility in both directory trees. + This command does not apply to the boot catalog. Rather use: + -boot_image "any" "cat_hidden=on" + + +File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options + +9.6 Tree traversal command -find +================================ + +-find iso_rr_path [test [op] [test ...]] [-exec action [params]] -- + A restricted substitute for shell command find in the ISO image. + It performs an action on matching file objects at or below + iso_rr_path. + If not used as last command in the line then the argument list + needs to get terminated by "--". + Tests are optional. If they are omitted then action is applied to + all file objects. If tests are given then they form together an + expression. The action is applied only if the expression matches + the file object. Default expression operator between tests is + -and, i.e. the expression matches only if all its tests match. + Available tests are: + + -name pattern : + Matches if pattern matches the file leaf name. + -wholename pattern : + Matches if pattern matches the file path as it would be + printed by action "echo". Character '/' is not special but + can be matched by wildcards. + -disk_name pattern : + Like -name but testing the leaf name of the file source on + disk. Can be true only for data files which stem not from + the loaded image. + -type type_letter : + Matches files of the given type: "block", "char", "dir", + "pipe", "file", "link", "socket", "eltorito", and "Xotic" + which matches what is not matched by the other types. + Only the first letter is interpreted. E.g.: -find / -type d + -damaged : + Matches files which use data blocks marked as damaged by a + previous run of -check_media. The damage info vanishes when a + new ISO image gets loaded. + Note that a MD5 session mismatch marks all files of the + session as damaged. If finer distinction is desired, perform + -md5 off before -check_media. + -pending_data : + Matches files which get their content from outside the loaded + ISO image. + -lba_range start_lba block_count : + Matches files which use data blocks within the range of + start_lba and start_lba+block_count-1. + -has_acl : + Matches files which have a non-trivial ACL. + -has_xattr : + Matches files which have xattr name-value pairs from user + namespace. + -has_aaip : + Matches files which have ACL or any xattr. + -has_any_xattr : + Matches files which have any xattr other than ACL. + -has_md5 : + Matches data files which have MD5 checksums. + -has_filter : + Matches files which are filtered by -set_filter. + -hidden hide_state : + Matches files which are hidden in "iso_rr" tree, in "joliet" + tree, in both trees ("on"), or not hidden in any tree ("off"). + Those which are hidden in some tree match -not -hidden "off". + -prune : + If this test is reached and the tested file is a directory + then -find will not dive into that directory. This test + itself does always match. + -decision "yes"|"no" : + If this test is reached then the evaluation ends immediately + and action is performed if the decision is "yes" or "true". + See operator -if. + -true and -false : + Always match resp. match not. Evaluation goes on. + -sort_lba : + Always match. This causes -find to perform its action in a + sequence sorted by the ISO image block addresses of the + files. It may improve throughput with actions which read data + from optical drives. Action will always get the absolute path + as parameter. + Available operators are: + -not : + Matches if the next test or sub expression does not match. + Several tests do this specifically: + -undamaged, -lba_range with negative start_lba, -has_no_acl, + -has_no_xattr, -has_no_aaip, -has_no_filter . + -and : + Matches if both neighboring tests or expressions match. + -or : + Matches if at least one of both neighboring tests or + expressions matches. + -sub ... -subend or ( ... ) : + Enclose a sub expression which gets evaluated first before it + is processed by neighboring operators. Normal precedence is: + -not, -or , -and. + -if ... -then ... -elseif ... -then ... -else ... -endif : + Enclose one or more sub expressions. If the -if expression + matches, then the -then expression is evaluated as the result + of the whole expression up to -endif. Else the next -elseif + expression is evaluated and if it matches, its -then + expression. Finally in case of no match, the -else expression + is evaluated. There may be more than one -elseif. Neither + -else nor -elseif are mandatory. If -else is missing and + would be hit, then the result is a non-match. + -if-expressions are the main use case for above test + -decision. + + + Default action is *echo*, i.e. to print the address of the found + file. Other actions are certain `xorriso' commands which get + performed on the found files. These commands may have specific + parameters. See also their particular descriptions. + + chown and chown_r + change the ownership and get the user id as parameter. E.g.: + -exec chown thomas -- + chgrp and Bchgrp_r + change the group attribute and get the group id as parameter. + E.g.: -exec chgrp_r staff -- + chmod and chmod_r + change access permissions and get a mode string as parameter. + E.g.: -exec chmod a-w,a+r -- + Balter_date and Balter_date_r + change the timestamps. They get a type character and a + timestring as parameters. + E.g.: -exec alter_date "m" "Dec 30 19:34:12 2007" -- + lsdl + prints file information like shell command ls -dl. + compare + performs command -compare with the found file address as + iso_rr_path and the corresponding file address below its + argument disk_path_start. For this the iso_rr_path of the + -find command gets replaced by the disk_path_start. + E.g.: -find /thomas -exec compare /home/thomas -- + update + performs command -update with the found file address as + iso_rr_path. The corresponding file address is determined + like with above action "compare". + update_merge + is like update but does not delete the found file if it is + missing on disk. It may be run several times and records + with all visited files whether their counterpart on disk has + already been seen by one of the update_merge runs. Finally, + a -find run with action "rm_merge" may remove all files that + saw no counterpart on disk. + Up to the next "rm_merge" or "clear_merge" all newly inserted + files will get marked as having a disk counterpart. + rm + removes the found iso_rr_path from the image if it is not a + directory with files in it. I.e. this "rm" includes "rmdir". + rm_r + removes the found iso_rr_path from the image, including whole + directory trees. + rm_merge + removes the found iso_rr_path if it was visited by one or + more previous actions "update_merge" and saw no counterpart + on disk in any of them. The marking from the update actions + is removed in any case. + clear_merge + removes an eventual marking from action "update_merge". + report_damage + classifies files whether they hit a data block that is marked + as damaged. The result is printed together with the address + of the first damaged byte, the maximum span of damages, file + size, and the path of the file. + report_lba + prints files which are associated to image data blocks. It + tells the logical block address, the block number, the byte + size, and the path of each file. There may be reported more + than one line per file if the file is very large. In this + case each line has a different extent number in column "xt". + getfacl + prints access permissions in ACL text form to the result + channel. + setfacl + attaches ACLs after removing existing ones. The new ACL is + given in text form as defined with option -setfacl. + E.g.: -exec setfacl u:lisa:rw,u::rw,g::r,o::-,m::rw -- + getfattr + prints xattr name-value pairs from user namespace to the + result channel. + get_any_xattr + prints xattr name-value pairs from any namespace except ACL + to the result channel. This is mostly for debugging of + namespace "isofs". + list_extattr mode + prints a script to the result channel, which would use + FreeBSD command setextattr to set the file's xattr name-value + pairs of user namespace. Parameter mode controls the form of + the output of names and values. Default mode "e" prints + harmless characters in shell quotation marks, but represents + texts with octal 001 to 037 and 0177 to 0377 by an embedded + echo -e command. Mode "q" prints any characters in shell + quotation marks. This might not be terminal-safe but should + work in script files. Mode "r" uses no quotation marks. Not + safe. Mode "b" prints backslash encoding. Not suitable for + shell parsing. + E.g. -exec list_extattr e - + Option -backslash_codes does not affect the output. + get_md5 + prints the MD5 sum, if recorded, together with file path. + check_md5 + compares the MD5 sum, if recorded, with the file content and + reports if mismatch. + E.g.: -find / -not -pending_data -exec check_md5 FAILURE -- + make_md5 + equips a data file with an MD5 sum of its content. Useful to + upgrade the files in the loaded image to full MD5 coverage by + the next commit with -md5 "on". + E.g.: -find / -type f -not -has_md5 -exec make_md5 -- + setfattr + sets or deletes xattr name value pairs. + E.g.: -find / -has_xattr -exec setfattr --remove-all " -- + set_filter + applies or removes filters. + E.g.: -exec set_filter --zisofs -- + mkisofs_r + applies the rules of mkisofs -r to the file object: + user id and group id become 0, all r-permissions get granted, + all w denied. If there is any x-permission, then all three x + get granted. s- and t-bits get removed. + sort_weight + attributes a LBA weight number to regular files. + The number may range from -2147483648 to 2147483647. The + higher it is, the lower will be the block address of the file + data in the emerging ISO image. Currently the boot catalog + has a hardcoded weight of 1 billion. Normally it should + occupy the block with the lowest possible address. Data + files get added or loaded with initial weight 0. + E.g.: -exec sort_weight 3 -- + show_stream + shows the content stream chain of a data file. + hide + brings the file into one of the hide states "on", "iso_rr", + "joliet", "off". + E.g.: + -find / -disk_name *_secret -exec hide on + estimate_size + prints a lower and an upper estimation of the number of + blocks which the found files together will occupy in the + emerging ISO image. This does not account for the superblock, + for the directories in the -find path, or for image padding. + find + performs another run of -find on the matching file address. + It accepts the same params as -find, except iso_rr_path. + E.g.: + -find / -name '???' -type d -exec find -name '[abc]*' -exec + chmod a-w,a+r -- + + +File: xorriso.info, Node: Filter, Next: Writing, Prev: CmdFind, Up: Options + +9.7 Filters for data file content +================================= + +*Filters* may be installed between data files in the ISO image and their +content source outside the image. They may also be used vice versa +between data content in the image and target files on disk. + +Built-in filters are "--zisofs" and "--zisofs-decode". The former is to +be applied via -set_filter, the latter is automatically applied if +zisofs compressed content is detected with a file when loading the ISO +image. +Another built-in filter pair is "--gzip" and "--gunzip" with suffix +".gz". They behave about like external gzip and gunzip but avoid +forking a process for each single file. So they are much faster if +there are many small files. + +-external_filter name option[:option] program_path [arguments] -- + Register a content filter by associating a name with a program + path, program arguments, and some behavioral options. Once + registered it can be applied to multiple data files in the ISO + image, regardless whether their content resides in the loaded ISO + image or in the local filesystem. External filter processes may + produce synthetic file content by reading the original content + from stdin and writing to stdout whatever they want. They must + deliver the same output on the same input in repeated runs. + Options are: + "default" means that no other option is intended. + "suffix=..." sets a file name suffix. If it is not empty then it + will be appended to the file name or removed from it. + "remove_suffix" will remove a file name suffix rather than + appending it. + "if_nonempty" will leave 0-sized files unfiltered. + "if_reduction" will try filtering and revoke it if the content + size does not shrink. + "if_block_reduction" will revoke if the number of 2 kB blocks does + not shrink. + "used=..." is ignored. Command -status shows it with the number of + files which currently have the filter applied. + Examples: + -external_filter bzip2 suffix=.bz2:if_block_reduction \ + /usr/bin/bzip2 -- + -external_filter bunzip2 suffix=.bz2:remove_suffix \ + /usr/bin/bunzip2 -- + +-unregister_filter name + Remove an -external_filter registration. This is only possible if + the filter is not applied to any file in the ISO image. + +-close_filter_list + Irrevocably ban commands -external_filter and -unregister_filter, + but not -set_filter. Use this to prevent external filtering in + general or when all intended filters are registered. External + filters may also be banned totally at compile time of `xorriso'. + By default they are banned if `xorriso' runs under setuid + permission. + +-set_filter name iso_rr_path [***] + Apply an -external_filter or a built-in filter to the given data + files in the ISO image. If the filter suffix is not empty , then + it will be applied to the file name. Renaming only happens if the + filter really gets attached and is not revoked by its options. By + default files which already bear the suffix will not get filtered. + The others will get the suffix appended to their names. If the + filter has option "remove_suffix", then the filter will only be + applied if the suffix is present and can be removed. Name + oversize or collision caused by suffix change will prevent + filtering. + With most filter types this command will immediately run the + filter once for each file in order to determine the output size. + Content reading operations like -extract , -compare and image + generation will perform further filter runs and deliver filtered + content. + At image generation time the filter output must still be the same + as the output from the first run. Filtering for image generation + does not happen with files from the loaded ISO image if the write + method of growing is in effect (i.e -indev and -outdev are + identical). + The reserved filter name "--remove-all-filters" revokes filtering. + This will revoke suffix renamings as well. Use + "--remove-all-filters+" to prevent any suffix renaming. + +-set_filter_r name iso_rr_path [***] + Like -set_filter but affecting all data files below eventual + directories. + + +File: xorriso.info, Node: Writing, Next: SetWrite, Prev: Filter, Up: Options + +9.8 Writing the result, drive control +===================================== + +(see also paragraph about settings below) + +-rollback + Discard the manipulated ISO image and reload it from -indev. (Use + -rollback_end if immediate program end is desired.) + +-commit + Perform the write operation. Afterwards, if -outdev is readable, + make it the new -dev and load the image from there. Switch to + growing mode. (A subsequent -outdev will activate modification + mode or blind growing.) -commit is performed automatically at end + of program if there are uncommitted manipulations pending. + So, to perform a final write operation with no new -dev and no new + loading of image, rather execute option -end. If you want to go + on without image loading, execute -commit_eject "none". To eject + after write without image loading, use -commit_eject "all". + To suppress a final write, execute -rollback_end. + Writing can last quite a while. It is not unnormal with several + types of media that there is no progress visible for the first few + minutes or that the drive gnaws on the medium for a few minutes + after all data have been transmitted. `xorriso' and the drives + are in a client-server relationship. The drives have much freedom + about what to do with the media. Some combinations of drives and + media simply do not work, despite the promises by their vendors. + If writing fails then try other media or another drive. The reason + for such failure is hardly ever in the code of the various burn + programs but you may well try some of those listed below under SEE + ALSO. + +-eject "in"|"out"|"all" + Eject the medium in -indev, resp. -outdev, resp. both drives. + Note: It is not possible yet to effectively eject disk files. + +-commit_eject "in"|"out"|"all"|"none" + Combined -commit and -eject. When writing has finished do not make + -outdev the new -dev, and load no ISO image. Rather eject -indev + and/or -outdev. Give up any non-ejected drive. + +-blank mode + Make media ready for writing from scratch (if not -dummy is + activated). + This affects only the -outdev not the -indev. If both drives are + the same and if the ISO image was altered then this command leads + to a FAILURE event. Defined modes are: as_needed, fast, all, + deformat, deformat_quickest + "as_needed" cares for used CD-RW, DVD-RW and for used + overwriteable media by applying -blank "fast". It applies -format + "full" to yet unformatted DVD-RAM and BD-RE. Other media in blank + state are gracefully ignored. Media which cannot be made ready + for writing from scratch cause a FAILURE event. + "fast" makes CD-RW and unformatted DVD-RW re-usable, or invalidates + overwriteable ISO images. "all" might work more thoroughly and + need more time. + "deformat" converts overwriteable DVD-RW into unformatted ones. + "deformat_quickest" is a faster way to deformat or blank DVD-RW + but produces media which are only suitable for a single session. + Some drives announce this state by not offering feature 21h, but + some drives offer it anyway. If feature 21h is missing, then + `xorriso' will refuse to write on DVD-RW if not option -close is + set to "on". + The progress reports issued by some drives while blanking are + quite unrealistic. Do not conclude success or failure from the + reported percentages. Blanking was successful if no SORRY event or + worse occured. + +-format mode + Convert unformatted DVD-RW into overwriteable ones, "de-ice" + DVD+RW, format newly purchased BD-RE or BD-R, re-format DVD-RAM or + BD-RE. + Defined modes are: + as_needed, full, fast, by_index_<num>, fast_by_index_<num> + "as_needed" formats yet unformatted DVD-RW, DVD-RAM, BD-RE, or + blank unformatted BD-R. Other media are left untouched. + "full" (re-)formats DVD-RW, DVD+RW, DVD-RAM, BD-RE, or blank + unformatted BD-R. + "fast" does the same as "full" but tries to be quicker. + "by_index_" selects a format out of the descriptor list issued by + option -list_formats. The index number from that list is to be + appended to the mode word. E.g: "by_index_3". + "fast_by_index_" does the same as "by_index_" but tries to be + quicker. + "by_size_" selects a format out of the descriptor list which + provides at least the given size. That size is to be appended to + the mode word. E.g: "by_size_4100m". This applies to media with + Defect Management. + "fast_by_size_" does the same as "by_size_" but tries to be + quicker. + The formatting action has no effect on media if -dummy is + activated. + Formatting is normally needed only once during the lifetime of a + medium, if ever. But it is a reason for re-formatting if: + DVD-RW was deformatted by -blank, + DVD+RW has read failures (re-format before next write), + DVD-RAM or BD-RE shall change their amount of defect reserve. + BD-R may be written unformatted or may be formatted before first + use. Formatting activates Defect Management which tries to catch + and repair bad spots on media during the write process at the + expense of half speed even with flawless media. + The progress reports issued by some drives while formatting are + quite unrealistic. Do not conclude success or failure from the + reported percentages. Formatting was successful if no SORRY event + or worse occured. Be patient with apparently frozen progress. + +-list_formats + Put out a list of format descriptors as reported by the output + drive for the current medium. The list gives the index number + after "Format idx", a MMC format code, the announced size in + blocks (like "2236704s") and the same size in MiB. + MMC format codes are manifold. Most important are: "00h" general + formatting, "01h" increases reserve space for DVD-RAM, "26h" for + DVD+RW, "30h" for BD-RE with reserve space, "31h" for BD-RE + without reserve space, "32h" for BD-R. + Smaller format size with DVD-RAM, BD-RE, or BD-R means more + reserve space. + +-list_speeds + Put out a list of speed values as reported by the output drive with + the loaded medium. This does not necessarily mean that the medium + is writable or that these speeds are actually achievable. + Especially the lists reported with empty drive or with ROM media + obviously advertise speeds for other media. + It is not mandatory to use speed values out of the listed range. + The drive is supposed to choose a safe speed that is as near to + the desired speed as possible. + At the end of the list, "Write speed L" and "Write speed H" are + the best guesses for lower and upper speed limit. "Write speed l" + and "Write speed h" may appear only with CD and eventually + override the list of other speed offers. + +-close_damaged "as_needed"|"force" + Try to close the upcomming track and session if the drive reported + the medium as damaged. This may apply to CD-R, CD-RW, DVD-R, + DVD-RW, DVD+R, DVD+R DL, or BD-R media. It is indicated by warning + messages when the drive gets aquired, and by a remark "but next + track is damaged" with the line "Media status :" of command -toc. + The setting of option -close determines whether the medium stays + appendable. + Mode "as_needed" gracefully refuses on media which are not + reported as damaged. Mode "force" attempts the close operation + even with media which appear undamaged. + No image changes are allowed to be pending before this command is + performed. After closing was attempted, both drives are given up. + +-list_profiles "in"|"out"|"all" + Put out a list of media types supported by -indev, resp. -outdev, + resp. both. The currently recognized type is marked by text + "(current)". + + +File: xorriso.info, Node: SetWrite, Next: Bootable, Prev: Writing, Up: Options + +9.9 Settings for result writing +=============================== + +Rock Ridge info will be generated by the program unconditionally. ACLs +will be written according to the setting of option -acl. + +-joliet "on"|"off" + If enabled by "on", generate Joliet tree additional to ISO 9660 + + Rock Ridge tree. + +-compliance rule[:rule...] + Adjust the compliance to specifications of ISO 9660 and its + contemporary extensions. In some cases it is worth to deviate a + bit in order to circumvent bugs of the intended reader system or + to get unofficial extra features. + There are several adjustable rules which have a keyword each. If + they are mentioned with this option then their rule gets added to + the relaxation list. This list can be erased by rules "strict" or + "clear". It can be reset to its start setting by "default". All of + the following relaxation rules can be revoked individually by + appending "_off". Like "deep_paths_off". + Rule keywords are: + "iso_9660_level="number chooses level 1 with ISO names of the form + 8.3 and -file_size_limit <= 4g - 1, or level 2 with ISO names up to + length 32 and the same -file_size_limit, or level 3 with ISO names + up to length 32 and -file_size_limit >= 400g -200k. If necessary + -file_size_limit gets adjusted. + "allow_dir_id_ext" allows ISO names of directories to have a name + extension as with other file types. It does not force dots and it + omits the version number, though. This is a bad tradition of + mkisofs which violates ECMA-119. Especially ISO level 1 only + allows 8 characters in a directory name and not 8.3. + "omit_version" does not add versions (";1") to ISO and Joliet file + names. + "only_iso_version" does not add versions (";1") to Joliet file + names. + "deep_paths" allows ISO file paths deeper than 8 levels. + "long_paths" allows ISO file paths longer than 255 characters. + "long_names" allows up to 37 characters with ISO file names. + "no_force_dots" does not add a dot to ISO file names which have + none. + "no_j_force_dots" does not add a dot to Joliet file names which + have none. + "lowercase" allows lowercase characters in ISO file names. + "full_ascii" allows all ASCII characters in ISO file names. + "untranslated_names" might be dangerous for inadverted reader + programs which rely on the restriction to at most 37 characters in + ISO file names. This option allows ISO file names up to 96 + characters with no character conversion. If a file name has more + characters, then image production will fail deliberately. + "untranslated_name_len="number enables untranslated_names with a + smaller limit for the length of file names. 0 disables this + feature, -1 chooses maximum length limit, numbers larger than 0 + give the desired length limit. + "joliet_long_names" allows Joliet leaf names up to 103 characters + rather than 64. + "joliet_long_paths" allows Joliet paths longer than 240 characters. + "always_gmt" stores timestamps in GMT representation with timezone + 0. + "rec_mtime" records with ISO files the disk file's mtime and not + the creation time of the image. + "new_rr" uses Rock Ridge version 1.12 (suitable for GNU/Linux but + not for older FreeBSD or for Solaris). This implies + "aaip_susp_1_10_off" which may be changed by subsequent + "aaip_susp_1_10". + Default is "old_rr" which uses Rock Ridge version 1.10. This + implies also "aaip_susp_1_10" which may be changed by subsequent + "aaip_susp_1_10_off". + "aaip_susp_1_10" allows AAIP to be written as unofficial extension + of RRIP rather than as official extension under SUSP-1.12. + "no_emul_toc" saves 64 kB with the first session on overwriteable + media but makes the image incapable of displaying its session + history. + "iso_9660_1999" causes the production of an additional directory + tree compliant to ISO 9660:1999. It can record long filenames for + readers which do not understand Rock Ridge. + "old_empty" uses the old way of of giving block addresses in the + range of [0,31] to files with no own data content. The new way is + to have a dedicated block to which all such files will point. + Default setting is + "clear:only_iso_version:deep_paths:long_paths:no_j_force_dots: + always_gmt:old_rr". + Note: The term "ISO file" means the plain ISO 9660 names and + attributes which get visible if the reader ignores Rock Ridge. + +-volid text + Specify the volume ID. `xorriso' accepts any text up to 32 + characters, but according to rarely obeyed specs stricter rules + apply: + ECMA 119 demands ASCII characters out of [A-Z0-9_]. Like: + "IMAGE_23" + Joliet allows 16 UCS-2 characters. Like: "Windows name" + Be aware that the volume id might get used automatically as name + of the mount point when the medium is inserted into a playful + computer system. + If an ISO image gets loaded while the volume ID is set to default + "ISOIMAGE" or to "", then the volume ID of the loaded image will + become the effective volume id for the next write run. But as soon + as command -volid is performed afterwards, this pending id is + overridden by the new setting. + Consider this when setting -volid "ISOIMAGE" before executing + -dev, -indev, or -rollback. If you insist in -volid "ISOIMAGE", + set it again after those commands. + +-volset_id text + Set the volume set id string to be written with the next -commit. + Permissible are up to 128 characters. This setting gets overridden + by image loading. + +-publisher text + Set the publisher id string to be written with the next -commit. + This may identify the person or organisation who specified what + shall be recorded. Permissible are up to 128 characters. This + setting gets overridden by image loading. + +-application_id text + Set the application id string to be written with the next -commit. + This may identify the specification of how the data are recorded. + Permissible are up to 128 characters. This setting gets overridden + by image loading. + The special text "@xorriso@" gets converted to the id string of + `xorriso' which is normally written as -preparer_id. It is a wrong + tradition to write the program id as -application_id. + +-system_id text + Set the system id string to be written with the next -commit. This + may identify the system which can recognize and act upon the + content of the System Area in image blocks 0 to 15. Permissible + are up to 32 characters. This setting gets overridden by image + loading. + +-volume_date type timestring + Set one of the four overall timestamps for subsequent image + writing. Available types are: + "c" time when the volume was created. + "m" time when volume was last modified. + "x" time when the information in the volume expires. + "f" time since when the volume is effectively valid. + "uuid" sets a timestring that overrides "c" and "m" times + literally. It must consist of 16 decimal digits which form + YYYYMMDDhhmmsscc, with YYYY between 1970 and 2999. Time zone is + GMT. It is supposed to match this GRUB line: + search --fs-uuid --set YYYY-MM-DD-hh-mm-ss-cc + E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). + Timestrings for the other types may be given as with option + -alter_date. They are prone to timezone computations. The + timestrings "default" or "overridden" cause default settings: "c" + and "m" will show the current time of image creation. "x" and "f" + will be marked as insignificant. "uuid" will be deactivated. + +-copyright_file text + Set the copyright file name to be written with the next -commit. + This should be the ISO 9660 path of a file in the image which + contains a copyright statement. Permissible are up to 37 + characters. This setting gets overridden by image loading. + +-abstract_file text + Set the abstract file name to be written with the next -commit. + This should be the ISO 9660 path of a file in the image which + contains an abstract statement about the image content. + Permissible are up to 37 characters. This setting gets overridden + by image loading. + +-biblio_file text + Set the biblio file name to be written with the next -commit. This + should be the ISO 9660 path of a file in the image which contains + bibliographic records. Permissible are up to 37 characters. This + setting gets overridden by image loading. + +-preparer_id + Set the preparer id string to be written with the next -commit. + This may identify the person or other entity which controls the + preparation of the data which shall be recorded. Normally this + should be the id of `xorriso' and not of the person or program + which operates `xorriso'. Please avoid to change it. Permissible + are up to 128 characters. + The special text "@xorriso@" gets converted to the id string of + `xorriso' which is default at program startup. + Unlike other id strings, this setting is not influenced by image + loading. + +-out_charset character_set_name + Set the character set to which file names get converted when + writing an image. See paragraph "Character sets" for more + explanations. When loading the written image after -commit the + setting of -out_charset will be copied to -in_charset. + +-uid uid + User id to be used for all files when the new ISO tree gets + written to media. + +-gid gid + Group id to be used for all files when the new ISO tree gets + written to media. + +-zisofs option[:options] + Set global parameters for zisofs compression. This data format is + recognized and transparently uncompressed by some Linux kernels. + It is to be applied via option -set_filter with built-in filter + "--zisofs". Parameters are: + "level="[0-9] zlib compression: 0=none, 1=fast,..., 9=slow + "block_size="32k|64k|128k size of compression blocks + "by_magic=on" enables an expensive test at image generation time + which checks files from disk whether they already are zisofs + compressed, e.g. by program mkzftree. + "default" same as "level=6:block_size=32k:by_magic=off" + +-speed number[k|m|c|d|b] + Set the burn speed. Default is 0 = maximum speed. Speed can be + given in media dependent numbers or as a desired throughput per + second in MMC compliant kB (= 1000) or MB (= 1000 kB). Media + x-speed factor can be set explicity by "c" for CD, "d" for DVD, + "b" for BD, "x" is optional. + Example speeds: + 706k = 706kB/s = 4c = 4xCD + 5540k = 5540kB/s = 4d = 4xDVD + If there is no hint about the speed unit attached, then the medium + in the -outdev will decide. Default unit is CD = 176.4k. + MMC drives usually activate their own idea of speed and take the + speed value given by the burn program only as upper limit for + their own decision. + +-stream_recording "on"|"off"|"full"|"data"|number + Setting "on" tries to circumvent the management of defects on + DVD-RAM, BD-RE, or BD-R. Defect management keeps partly damaged + media usable. But it reduces write speed to half nominal speed + even if the medium is in perfect shape. For the case of flawless + media, one may use -stream_recording "on" to get full speed. + "full" tries full speed with all write operations, whereas "on" + does this only above byte address 32s. One may give a number of at + least 16s in order to set an own address limit. + "data" causes full speed to start when superblock and directory + entries are written and writing of file content blocks begins. + +-dvd_obs "default"|"32k"|"64k" + GNU/Linux specific: Set the number of bytes to be transmitted with + each write operation to DVD or BD media. A number of 64 KB may + improve throughput with bus systems which show latency problems. + The default depends on media type, on option -stream_recording , + and on compile time options. + +-stdio_sync "on"|"off"|number + Set the number of bytes after which to force output to stdio: + pseudo drives. This forcing keeps the memory from being clogged + with lots of pending data for slow devices. Default "on" is the + same as "16m". Forced output can be disabled by "off". + +-dummy "on"|"off" + If "on" then simulate burning or refuse with FAILURE event if no + simulation is possible, do neither blank nor format. + +-fs number["k"|"m"] + Set the size of the fifo buffer which smoothens the data stream + from ISO image generation to media burning. Default is 4 MiB, + minimum 64 kiB, maximum 1 GiB. The number may be followed by + letter "k" or "m" which means unit is kiB (= 1024) or MiB (= 1024 + kiB). + +-close "on"|"off" + If "on" then mark the written medium as not appendable any more + (if possible at all with the given type of target media). + This is the contrary of cdrecord, wodim, cdrskin option -multi, + and is one aspect of growisofs option -dvd-compat. + +-padding number["k"|"m"]|"included"|"appended" + Append the given number of extra bytes to the image stream. This + is a traditional remedy for a traditional bug in block device read + drivers. Needed only for CD recordings in TAO mode. Since one can + hardly predict on what media an image might end up, `xorriso' adds + the traditional 300k of padding by default to all images. + For images which will never get to a CD it is safe to use -padding + 0 . + Normally padding is not written as part of the ISO image but + appended after the image end. This is -padding mode "appended". + Emulation command -as "mkisofs" and command -jigdo cause padding + to be written as part of the image. The same effect is achieved + by -padding mode "included". + + +File: xorriso.info, Node: Bootable, Next: Jigdo, Prev: SetWrite, Up: Options + +9.10 Bootable ISO images +======================== + +Contrary to published specifications many BIOSes will load an El Torito +record from the first session on media and not from the last one, which +gets mounted by default. This makes no problems with overwriteable +media, because they appear to inadverted readers as one single session. +But with multi-session media CD-R[W], DVD-R[W], DVD+R, it implies that +the whole bootable system has to reside already in the first session +and that the last session still has to bear all files which the booted +system expects after mounting the ISO image. +If a boot image from ISOLINUX or GRUB is known to be present on media +then it is advised to patch it when a follow-up session gets written. +But one should not rely on the capability to influence the bootability +of the existing sessions, unless one can assume overwriteable media. +There are booting mechanisms which do not use an El Torito record but +rather start at the first bytes of the image: PC-BIOS MBR for +hard-disk-like devices, MIPS Volume Header for old SGI computers, DEC +Boot Block for old DECstation, SUN Disk Label for SPARC machines. +The boot firmware EFI may use programs which are located in a FAT +filesystem and announced by an MBR partition table entry. + +-boot_image "any"|"isolinux"|"grub" + "discard"|"keep"|"patch"|"show_status"|bootspec|"next" + + Define the handling of a set of El Torito boot images which has + been read from an existing ISO image or define how to make a + prepared boot image file set bootable. Such file sets get produced + by ISOLINUX or GRUB. + Each -boot_image command has two arguments: type and setting. More + than one -boot_image command may be used to define the handling of + one or more boot images. Sequence matters. + Types *isolinux* and *grub* care for known peculiarities. Type + *any* makes no assumptions about the origin of the boot images. + + El Torito boot images of any type can be newly inserted, or + discarded, or patched, or kept unaltered. Whether to patch or to + keep depends on whether the boot images contain boot info tables. + A boot info table needs to be patched when the boot image gets + newly introduced into the ISO image or if an existing image gets + relocated. This is automatically done if type "isolinux" or "grub" + is given, but not with "any". + If patching is enabled, then boot images from previous sessions + will be checked whether they seem to bear a boot info table. If + not, then they stay unpatched. This check is not infallible. So if + you do know that the images need no patching, use "any" "keep". + "grub" "patch" will not patch EFI images (platform_id=0xef). + Most safe is the default: -boot_image "any" "discard". + Advised for GRUB : -boot_image "grub" "patch" + For ISOLINUX : -boot_image "isolinux" "patch" + *show_status* will print what is known about the loaded boot images + and their designated fate. + + A *bootspec* is a word of the form name=valuei. It is used to + describe the parameters of a boot image by an El Torito record or + a MBR. The names "dir", "bin_path", "efi_path" lead to El Torito + bootable images. Name "system_area" activates a given file as MBR. + On all media types this is possible within the first session. In + further sessions an existing boot image can get replaced by a new + one, but depending on the media type this may have few effect at + boot time. See above. + The boot image and its supporting files have to be added to the + ISO image by normal means (image loading, -map, -add, ...). In + case of ISOLINUX the files should reside either in ISO image + directory /isolinux or in /boot/isolinux . In that case it + suffices to use as bootspec the text "dir=/isolinux" or + "dir=/boot/isolinux". E.g.: + -boot_image isolinux dir=/boot/isolinux + which bundles these individual settings: + -boot_image isolinux bin_path=/boot/isolinux/isolinux.bin + -boot_image isolinux cat_path=/boot/isolinux/boot.cat + -boot_image isolinux load_size=2048 + -boot_image any boot_info_table=on + An El Torito boot catalog file gets inserted into the ISO image + with address *cat_path=* at -commit time. It is subject to normal + -overwrite and -reassure processing if there is already a file + with the same name. The catalog lists the boot images and is read + by the boot facility to choose one of the boot images. But it is + not necessary that it appears in the directory tree at all. One + may hide it in all trees by *cat_hidden=on*. Other possible + values are "iso_rr", "joliet", and the default "off". + *bin_path=* depicts a boot image file, a binary program which is + to be started by the hardware boot facility (e.g. the BIOS) at + boot time. + *efi_path=* depicts a boot image file that is ready for EFI + booting. Its load_size is determined automatically, no boot info + table gets written, no boot medium gets emulated, platform_id is + 0xef. + *emul_type=* can be one of "no_emulation", "hard_disk", "diskette". + It controls the boot medium emulation code of a boot image. The + default "no_emulation" is suitable for ISOLINUX, GRUB, FreeBSD + cdboot. + *load_size=* is a value which depends on the boot image. Default + 2048 should be overridden only if a better value is known. + *boot_info_table=on* may be used to apply patching to a boot image + which is given by "any" "bin_path=". "boot_info_table=off" + disables patching. + *platform_id=* defines by two hex digits the Platform ID of the + boot image. "00" is 80x86 PC-BIOS, "01" is PowerPC, "02" is Mac, + "ef" is EFI. + *id_string=*text|56_hexdigits defines the ID string of the boot + catalog section where the boot image will be listed. If the value + consists of 56 characters [0-9A-Fa-f] then it is converted into 28 + bytes, else the first 28 characters become the ID string. The ID + string of the first boot image becomes the overall catalog ID. It + is limited to 24 characters. Other id_strings become section IDs. + *sel_crit=*hexdigits defines the Selection Criteria of the boot + image. Up to 20 bytes get read from the given characters + [0-9A-Fa-f]. They get attributed to the boot image entry in the + catalog. + *next* ends the definition of a boot image and starts a new one. + Any following -bootimage bootspecs will affect the new image. The + first "next" discards loaded boot images and their catalog. + *discard* gives up an existing boot catalog and its boot images. + *keep* keeps or copies boot images unaltered and writes a new + catalog. + *patch* applies patching to existing boot images if they seem to + bear a boot info table. + *system_area=*disk_path copies at most 32768 bytes from the given + disk file to the very start of the ISO image. This System Area is + reserved for system dependent boot software, e.g. an MBR which can + be used to boot from USB stick or hard disk. + Other than a El Torito boot image, the file disk_path needs not to + be added to the ISO image. + -boot_image isolinux system_area= implies "partition_table=on". + *partition_table=on* causes a simple partition table to be written + into bytes 446 to 511 of the System Area. + With type "isolinux" it shows a partition that begins at byte 0 + and it causes the LBA of the first boot image to be written into + the MBR. For the first session this works only if also + "system_area=" and "bin_path=" or "dir=" is given. + With types "any" and "grub" it shows a single partiton which + starts at byte 512 and ends where the ISO image ends. This works + with or without system_area= or boot image. + In follow-up sessions the existing System Area is preserved by + default. If types "isolinux" or "grub" are set to "patch", then + "partition_table=on" is activated without new boot image. In this + case the existing System Area gets checked whether it bears + addresses and sizes as if it had been processed by + "partition_table=on". If so, then those parameters get updated + when the new System Area is written. + Special "system_area=/dev/zero" causes 32k of NUL-bytes. Use this + to discard an MBR which was loaded with the ISO image. + *partition_offset=*2kb_block_adr causes a partition table with a + single partition that begins at the given block address. This is + counted in 2048 byte blocks, not in 512 byte blocks. If the block + address is non-zero then it must be at least 16. A non-zero + partition offset causes two superblocks to be generated and two + sets of directory trees. The image is then mountable from its + absolute start as well as from the partition start. + The offset value of an ISO image gets preserved when a new session + is added. So the value defined here is only in effect if a new + ISO image gets written. + *partition_hd_cyl=*number gives the number of heads per cylinder + for the partition table. 0 chooses a default value. Maximum is 255. + *partition_sec_hd=*number gives the number of sectors per head for + the partition table. 0 chooses a default value. Maximum is 63. + The product partition_sec_hd * partition_hd_cyl * 512 is the + cylinder size. It should be divisible by 2048 in order to allow + exact alignment. If it is too small to describe the image size by + at most 1024 cylinders, then appropriate values of + partition_hd_cyl are chosen with partition_sec_hd 32 or 63. If the + image is larger than 8,422,686,720 bytes, then the cylinder size + constraints cannot be fulfilled. + *partition_cyl_align=*mode controls image size alignment to an + integer number of cylinders. It is prescribed by isohybrid specs + and it seems to please program fdisk. Cylinder size must be + divisible by 2048. Images larger than 8,323,596,288 bytes cannot + be aligned. + Mode "auto" is default. Alignment by padding happens only with + "isolinux" "partition_table=on". + Mode "on" causes alignment by padding with "partition_table=on" + for any type. Mode "off" disables alignment for any type. + *mips_path=*iso_rr_path declares a data file in the image to be a + MIPS Big Endian boot file and causes production of a MIPS Big + Endian Volume Header. This is mutually exclusive with production + of other boot blocks like MBR. It will overwrite the first 512 + bytes of any data provided by system_area=. Up to 15 boot files + can be declared by mips_path=. + *mipsel_path=*iso_rr_path declares a data file in the image to be + the MIPS Little Endian boot file. This is mutually exclusive with + other boot blocks. It will overwrite the first 512 bytes of any + data provided by system_area=. Only a single boot file can be + declared by mipsel_path=. + *sparc_label=*text causes the production of a SUN Disk Label with + the given text as ASCII label. This boot block format allows to + append images for partitions 2 to 8. Partition 1 will always be + the ISO image. See option -append_partition. The first 512 bytes + of any data provided by system_area= will be overwritten. + *mips_discard* and *sparc_discard* revoke any boot file + declarations made by mips_path= or mipsel_path=. They also disable + production of SUN Disk Label. This removes the ban on production + of other boot blocks. + + +-append_partition partition_number type_code disk_path + Cause a prepared filesystem image to be appended to the ISO image + and to be described by a partition table entry in a boot block at + the start of the emerging ISO image. The partition entry will bear + the size of the submitted file rounded up to the next multiple of + 2048 bytes. + Beware of subsequent multi-session runs. The appended partition + will get overwritten. + Partitions may be appended with boot block type MBR and with SUN + Disk Label. + With MBR: + partition_number may be 1 to 4. Number 1 will put the whole ISO + image into the unclaimed space before partition 1. So together + with most `xorriso' MBR features, number 2 would be the most + natural choice. + The type_code may be "FAT12", "FAT16", "Linux", or a hexadecimal + number between 0x00 and 0xff. Not all those numbers will yield + usable results. For a list of codes search the Internet for + "Partition Types" or run fdisk command "L". + The disk_path must provide the necessary data bytes at commit time. + An empty disk_path disables this feature for the given partition + number. + With SUN Disk Label (selected by -boot_image any sparc_label=): + partition_number may be 2 to 8. Number 1 will always be the ISO + image. Partition start addresses are aligned to 320 KiB. The + type_code does not matter. Submit 0x0. + Partition image name "." causes the partition to become a copy of + the next lower valid one. + + +File: xorriso.info, Node: Jigdo, Next: Charset, Prev: Bootable, Up: Options + +9.11 Jigdo Template Extraction +============================== + +From man genisoimage: "Jigdo is a tool to help in the distribution of +large files like CD and DVD images; see http://atterer.net/jigdo/ for +more details. Debian CDs and DVD ISO images are published on the web in +jigdo format to allow end users to download them more efficiently." +`xorriso' can produce a .jigdo and a .template file together with a +single-session ISO image. The .jigdo file contains checksums and +symbolic file addresses. The .template file contains the compressed +ISO image with reference tags instead of the content bytes of the +listed files. +Input for this process are the normal arguments for a `xorriso' session +on a blank -outdev, and a .md5 file which lists those data files which +may be listed in the .jigdo file and externally referenced in the +.template file. Each designated file is represented in the .md5 file +by a single text line: +MD5 as 32 hex digits, 2 blanks, size as 12 decimal digits or blanks, 2 +blanks, symbolic file address +The file address in an .md5 line has to bear the same basename as the +disk_path of the file which it shall match. The directory path of the +file address is decisive for To=From mapping, not for file recognition. +After To=From mapping, the file address gets written into the .jigdo +file. Jigdo restore tools will convert these addresses into really +reachable data source addresses from which they can read. +If the list of jigdo parameters is not empty, then `xorriso' will +refuse to write to non-blank targets, it will disable multi-session +emulation, and padding will be counted as part of the ISO image. + +-jigdo parameter_name value + Clear Jigdo Template Extraction parameter list or add a parameter + to that list. The alias names are the corresponding genisoimage + options. They are accepted as parameter names as well. Especially + they are recognized by the -as mkisofs emulation command. + Parameter *clear* with any value empties the whole list. No + .jigdo and .template file will be produced. + *template_path* sets the disk_path for the .template file with the + holed and compressed ISO image copy. + Alias: -jigdo-template + *jigdo_path* sets the disk_path for the .jigdo file with the + checksums and download addresses for filling the holes in + .template. + Alias: -jigdo-jigdo + *md5_path* sets the disk_path where to find the .md5 input file. + Alias: -md5-list + *min_size* sets the minimum size for a data file to be listed in + the .jigdo file and being a hole in the .template file. + Alias: -jigdo-min-file-size + *exclude* adds a regular expression pattern which will get compared + with the absolute disk_path of any data file. A match causes the + file to stay in .template in any case. + Alias: -jigdo-exclude + *demand_md5* adds a regular expression pattern which will get + compared with the absolute disk_path of any data file that was not + found in the .md5 list. A match causes a MISHAP event. + Alias: -jigdo-force-md5 + *mapping* adds a string pair of the form To=From to the parameter + list. If a data file gets listed in the .jigdo file, then it is + referred by the file address from its line in the .md5 file. This + file address gets checked whether it begins with the From string. + If so, then this string will be replaced by the To string and a + ':' character, before it goes into the .jigdo file. The From + string should end by a '/' character. + Alias: -jigdo-map + *compression* chooses one of "bzip2" or "gzip" for the compression + of the template file. The jigdo file is put out uncompressed. + Alias: -jigdo-template-compress + *checksum_iso* chooses one or more of "md5", "sha1", "sha256", + "sha512" for the auxiliary "# Image Hex" checksums in the jigdo + file. The value may e.g. look like "md5,sha1,sha512". Value "all" + chooses all available algorithms. Note that MD5 stays always + enabled. + Alias: -checksum_algorithm_iso + *checksum_template* is like checksum_iso but for "# Template Hex". + Alias: -checksum_algorithm_template + + +File: xorriso.info, Node: Charset, Next: Exception, Prev: Jigdo, Up: Options + +9.12 Character sets +=================== + +File names are strings of non-zero bytes with 8 bit each. Unfortunately +the same byte string may appear as different peculiar national +characters on differently nationalized terminals. The meanings of byte +codes are defined in *character sets* which have names. Shell command +iconv -l lists them. +Character sets should not matter as long as only english alphanumeric +characters are used for file names or as long as all writers and readers +of the media use the same character set. Outside these constraints it +may be necessary to let `xorriso' convert byte codes. +There is an input conversion from input character set to the local +character set which applies when an ISO image gets loaded. A conversion +from local character set to the output character set is performed when +an image tree gets written. The sets can be defined independently by +options -in_charset and -out_charset. Normally one will have both +identical, if ever. +If conversions are desired then `xorriso' needs to know the name of the +local character set. `xorriso' can inquire the same info as shell +command "locale" with argument "charmap". This may be influenced by +environment variables LC_ALL, LC_CTYPE, or LANG and should match the +expectations of the terminal. +The default output charset is the local character set of the terminal +where `xorriso' runs. So by default no conversion happens between local +filesystem names and emerging names in the image. The situation stays +ambigous and the reader has to riddle what character set was used. +By option -auto_charset it is possible to attribute the output charset +name to the image. This makes the situation unambigous. But if your +terminal character set does not match the character set of the local +file names, then this attribute can become plainly wrong and cause +problems at read time. To prevent this it is necessary to check +whether the terminal properly displays all intended filenames. Check +especially the exotic national characters. +To enforce recording of a particular character set name without any +conversion at image generation time, set -charset and -local_charset to +the desired name, and enable -backslash_codes to avoid evil character +display on your terminal. + +-charset character_set_name + Set the character set from which to convert file names when + loading an image and to which to convert when writing an image. + +-local_charset character_set_name + Override the system assumption of the local character set name. + If this appears necessary, one should consider to set + -backslash_codes to "on" in order to avoid dangerous binary codes + being sent to the terminal. + + +File: xorriso.info, Node: Exception, Next: DialogCtl, Prev: Charset, Up: Options + +9.13 Exception processing +========================= + +Since the tasks of `xorriso' are manifold and prone to external +influence, there may arise the need for `xorriso' to report and handle +problem events. +Those events get classified when they are detected by one of the +software modules and forwarded to reporting and evaluation modules +which decide about reactions. Event classes are sorted by severity: +"NEVER" The upper end of the severity spectrum. +"ABORT" The program is being aborted and on its way to end. +"FATAL" The main purpose of the run failed or an important resource +failed unexpectedly. +"FAILURE" An important part of the job could not be performed. +"MISHAP" A FAILURE which can be tolerated during ISO image generation. +"SORRY" A less important part of the job could not be performed. +"WARNING" A situation is suspicious of being not intended by the user. +"HINT" A proposal to the user how to achieve better results. +"NOTE" A harmless information about noteworthy circumstances. +"UPDATE" A pacifier message during long running operations. +"DEBUG" A message which would only interest the program developers. +"ALL" The lower end of the severity spectrum. + +-abort_on severity + Set the severity threshold for events to abort the program. + Useful: "NEVER", "ABORT", "FATAL", "FAILURE" , "MISHAP", "SORRY" + It may become necessary to abort the program anyway, despite the + setting by this option. Expect not many "ABORT" events to be + ignorable. + A special property of this option is that it works preemptive if + given as program start argument. I.e. the first -abort_on setting + among the start arguments is in effect already when the first + operations of `xorriso' begin. Only "-abort_on" with dash "-" is + recognized that way. + +-return_with severity exit_value + Set the threshold and exit_value to be returned at program end if + no abort has happened. This is to allow `xorriso' to go on after + problems but to get a failure indicating exit value from the + program, nevertheless. Useful is a value lower than the -abort_on + threshold, down to "WARNING". + exit_value may be either 0 (indicating success to the starter of + the program) or a number between 32 and 63. Some other exit_values + are used by `xorriso' if it decides to abort the program run: + 1=abort due to external signal + 2=no program arguments given + 3=creation of `xorriso' main object failed + 4=failure to start libburnia-project.org libraries + 5=program abort during argument processing + 6=program abort during dialog processing + +-report_about severity + Set the threshold for events to be reported. + Useful: "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", + "ALL" + Regardless what is set by -report_about, messages get always + reported if they reach the severity threshold of -abort_on . + Event messages are sent to the info channel "I" which is usually + stderr but may be influenced by command -pkt_output. Info + messages which belong to no event get attributed severity "NOTE". + A special property of this option is that the first -report_about + setting among the start arguments is in effect already when the + first operations of `xorriso' begin. Only "-report_about" with + dash "-" is recognized that way. + +-signal_handling mode + Control the installation of a signal handler which shall react on + external signals (e.g. from program "kill" or from keys Ctrl+C) or + on signals caused by severe program errors. + Mode "on" is the default. It uses the signal handler of libburn + which produces ugly messages but puts much effort in releasing + optical drives before `xorriso' ends. + Mode "off" as first -signal_handling among the start arguments + prevents all own signal precautions of `xorriso'. Inherited signal + handler settings stay as they are. + It works like "sig_dfl" if given after other signal handling was + already established at program start. + Mode "sig_dfl" uses the system provided default handling of + signals, which is normally a sudden abort of the program. To + prevent stuck drives, the libburn handler is used during burning, + blanking, and formatting on MMC drives. + Mode "sig_ign" tries to ignore as many signal types as possible. + This imposes the risk that `xorriso' refuses to end until + externally kill -9 if performed. kill -9 then imposes the risk + that the drive is left in unusable state and needs poweroff to be + reset. So during burning, blanking, and formatting wait for at + least their normal run time before killing externally. + A special property of this option is that the first + -signal_handling setting among the start arguments is in effect + already when the first operations of `xorriso' begin. Only + "-signal_handling" with dash "-" is recognized that way. + +-error_behavior occasion behavior + Control the program behavior at problem event occasions. For now + this applies to occasions "image_loading" which is given while an + image tree is read from the input device, and to "file_extraction" + which is given with osirrox options like -extract. + With "image_loading" there are three behaviors available: + "best_effort" goes on with reading after events with severity + below FAILURE if the threshold of option -abort_on allows this. + "failure" aborts image tree reading on first event of at least + SORRY. It issues an own FAILURE event. This is the default. + "fatal" acts like "failure" but issues the own event as FATAL. + With occasion "file_extraction" there are three behaviors: + "keep" maintains incompletely extracted files on disk. This is the + default. + "delete" removes files which encountered errors during content + extraction. + "best_effort" starts a revovery attempt by means of -extract_cut + if the file content stems from the loaded ISO image and is not + filtered. + + +File: xorriso.info, Node: DialogCtl, Next: Inquiry, Prev: Exception, Up: Options + +9.14 Dialog mode control +======================== + +-dialog "on"|"off"|"single_line" + Enable or disable to enter dialog mode after all arguments are + processed. In dialog mode input lines get prompted via readline + or from stdin. + If no -abort_on severity was set when dialog starts, then "NEVER" + is set to avoid abort in most cases of wrong input or other + problems. Before dialog begins, the default is "FAILURE" which + e.g. aborts on unknown commands. + Mode "on" supports input of newline characters within quotation + marks and line continuation by trailing backslash outside + quotation marks. Mode "single_line" does not. + +-page length width + Describe terminal to the text pager. See also above, paragraph + Result pager. + If parameter length is nonzero then the user gets prompted after + that number of terminal lines. Zero length disables paging. + Parameter width is the number of characters per terminal line. It + is used to compute the number of terminal lines which get occupied + by an output line. A usual terminal width is 80. + +-use_readline "on"|"off" + If "on" then use readline for dialog. Else use plain stdin. + See also above, paragraph Dialog, Readline, Result pager. + +-reassure "on"|"tree"|"off" + If "on" then ask the user for "y" or "n": + before deleting or overwriting any file in the ISO image, + before overwriting any disk file during restore operations, + before rolling back pending image changes, + before committing image changes to media, + before changing the input drive, + before blanking or formatting media, + before ending the program. + With setting "tree" the reassuring prompt will appear for an + eventual directory only once and not for each file in its whole + subtree. + Setting "off" silently kills any kind of image file object resp. + performs above irrevocable actions. + To really produce user prompts, option -dialog needs to be set to + "on". Note that the prompt does not appear in situations where + file removal is forbidden by option -overwrite. -reassure only + imposes an additional curb for removing existing file objects. + Be aware that file objects get deleted from the ISO image + immediately after confirmation. They are gone even if the running + command gets aborted and its desired effect gets revoked. In case + of severe mess-up, consider to use -rollback to revoke the whole + session. + + +File: xorriso.info, Node: Inquiry, Next: Navigate, Prev: DialogCtl, Up: Options + +9.15 Drive and media related inquiry actions +============================================ + +-devices + Show list of available MMC drives with the addresses of their + libburn standard device files. + This is only possible when no ISO image changes are pending. + After this option was executed, there is no drive current and no + image loaded. + In order to be visible, a device has to offer rw-permissions with + its libburn standard device file. Thus it might be only the + *superuser* who is able to see all drives. + Drives which are occupied by other processes get not shown. + +-device_links + Like -devices, but presenting the drives with addresses of + symbolic links which point to the actual device files. + Modern GNU/Linux systems may shuffle drive addresses from boot to + boot. The udev daemon is supposed to create links which always + point to the same drive, regardless of its system address. The + command -device_links shows the addresses of such links if they + begin by "/dev/dvd" or "/dev/cd". Precedence is: "dvdrw", "cdrw", + "dvd", "cdrom", "cd". + +-toc + Show media specific table of content. This is the session history + of the medium, not the ISO image directory tree. + In case of overwriteable media holding a valid ISO image, it may + happen that only a single session gets shown. But if the first + session on the overwriteable media was written by `xorriso' then a + complete session history can be emulated. + A drive which is incapable of writing may show any media as CD-ROM + or DVD-ROM with only one or two sessions on it. The last of these + sessions is supposed to be the most recent real session then. + Some read-only drives and media show no usable session history at + all. Option -rom_toc_scan might help. + +-mount_cmd drive entity id path + Emit an appropriate command line for mounting the ISO session + indicated by drive, entity and id. The result will be different + on GNU/Linux and on FreeBSD. + drive can be "indev" or "outdev" to indicate already acquired + drives, or it can be the path of a not yet acquired drive. Prefix + "stdio:" for non-MMC drives is not mandatory. + entity must be either "sbsector" with the superblock sector + address as id, or "track" with a track number as id, or "session" + with a session number, or "volid" with a search pattern for the + volume id, or "auto" with any text as id. + path will be used as mount point and must already exist as a + directory on disk. + The command gets printed to the result channel. See option -mount + for direct execution of this command. + +-mount_opts option[:option...] + Set options which influence -mount and -mount_cmd. Currently there + is only option "exclusive" which is default and its counterpart + "shared". The latter causes `xorriso' not to give up the affected + drive with command -mount. On GNU/Linux it adds mount option + "loop" which may allow to mount several sessions of the same block + device at the same time. One should not write to a mounted optical + medium, of course. Take care to umount all sessions before + ejecting. + +-session_string drive entity id format + Print to the result channel a text which gets composed according to + format and the parameters of the addressed session. + Formats "linux:"path or "freebsd:"path produce the output of + -mount_cmd for the given operating systems. + In other texts `xorriso' will substitute the following parameter + names. An optional prefix "string:" will be removed. + "%device%" will be substituted by the mountable device path of the + drive address. + "%sbsector%" will be substituted by the session start sector. + "%track%", "%session%", "%volid%" will be substituted by track + number, session number, resp. volume id of the depicted session. + +-print_size + Print the foreseeable consumption of 2048 byte blocks by next + -commit. This can last a while as a -commit gets prepared and only + in last moment is revoked by this option. The result depends on + several settings and also on the kind of output device. If no + -jidgo options are given and not command -as "mkisofs" was used, + then -padding (300 kB by default) is not counted as part of the + image size. + +-tell_media_space + Print available space on the output medium and the free space after + subtracting already foreseeable consumption by next -commit. + +-pvd_info + Print various id strings which can be found in loaded ISO images. + Some of them may be changed by options like -volid or -publisher. + For these ids -pvd_info reports what would be written with the + next -commit. + + +File: xorriso.info, Node: Navigate, Next: Verify, Prev: Inquiry, Up: Options + +9.16 Navigation in ISO image and disk filesystem +================================================ + +-cd iso_rr_path + Change the current working directory in the ISO image. This is + prepended to iso_rr_paths which do not begin with '/'. + It is possible to set the working directory to a path which does + not exist yet in the ISO image. The necessary parent directories + will be created when the first file object is inserted into that + virtual directory. Use -mkdir if you want to enforce the + existence of the directory already at first insertion. + +-cdx disk_path + Change the current working directory in the local filesystem. To + be prepended to disk_paths which do not begin with '/'. + +-pwd + Tell the current working directory in the ISO image. + +-pwdx + Tell the current working directory in the local filesystem. + +-ls iso_rr_pattern [***] + List files in the ISO image which match shell patterns (i.e. with + wildcards '*' '?' '[a-z]'). If a pattern does not begin with '/' + then it is compared with addresses relative to -cd. + Directories are listed by their content rather than as single file + item. + Pattern expansion may be disabled by command -iso_rr_pattern. + +-lsd iso_rr_pattern [***] + Like -ls but listing directories as themselves and not by their + content. This resembles shell command ls -d. + +-lsl iso_rr_pattern [***] + Like -ls but also list some of the file attributes. The output + format resembles shell command ls -ln. + File type 'e' indicates the El Torito boot catalog. + If the file has non-trivial ACL, then a '+' is appended to the + permission info. If the file is hidden, then 'I' for "iso_rr", + 'J' for "joliet", resp. 'H' for "on" gets appended. Together with + ACL it is 'i', 'j', resp. 'h'. + +-lsdl iso_rr_pattern [***] + Like -lsd but also list some of the file attributes. The output + format resembles shell command ls -dln. + +-lsx disk_pattern [***] + List files in the local filesystem which match shell patterns. + Patterns which do not begin with '/' are used relative to -cdx. + Directories are listed by their content rather than as single file + item. + Pattern expansion may be disabled by command -disk_pattern. + +-lsdx disk_pattern [***] + Like -lsx but listing directories as themselves and not by their + content. This resembles shell command ls -d. + +-lslx disk_pattern [***] + Like -lsx but also listing some of the file attributes. Output + format resembles shell command ls -ln. + +-lsdlx disk_pattern [***] + Like -lsdx but also listing some of the file attributes. Output + format resembles shell command ls -dln. + +-getfacl iso_rr_pattern [***] + Print the access permissions of the given files in the ISO image + using the format of shell command getfacl. If a file has no ACL + then it gets fabricated from the -chmod settings. A file may have + a real ACL if it was introduced into the ISO image while option + -acl was set to "on". + +-getfacl_r iso_rr_pattern [***] + Like -gefacl but listing recursively the whole file trees + underneath eventual directories. + +-getfattr iso_rr_pattern [***] + Print the xattr of the given files in the ISO image. If a file + has no such xattr then noting is printed for it. + +-getfattr_r iso_rr_pattern [***] + Like -gefattr but listing recursively the whole file trees + underneath eventual directories. + +-du iso_rr_pattern [***] + Recursively list size of directories and files in the ISO image + which match one of the patterns. similar to shell command du -k. + +-dus iso_rr_pattern [***] + List size of directories and files in the ISO image which match + one of the patterns. Similar to shell command du -sk. + +-dux disk_pattern [***] + Recursively list size of directories and files in the local + filesystem which match one of the patterns. Similar to shell + command du -k. + +-dusx disk_pattern [***] + List size of directories and files in the local filesystem which + match one of the patterns. Similar to shell command du -sk. + +-findx disk_path [-name pattern] [-type t] [-exec action [params]] -- + Like -find but operating on local filesystem and not on the ISO + image. This is subject to the settings of -follow. + -findx accepts the same -type arguments as -find. Additionally it + recognizes type "mountpoint" (or "m") which matches subdirectories + which reside on a different device than their parent. It never + matches the disk_path given as start address for -findx. + -findx accepts the -exec actions as does -find. But except the + following few actions it will always perform action "echo". + + in_iso + reports the path if its counterpart exists in the ISO image. + For this the disk_path of the -findx command gets replaced by + the iso_rr_path given as parameter. + E.g.: -findx /home/thomas -exec in_iso /thomas_on_cd -- + not_in_iso + reports the path if its counterpart does not exist in the ISO + image. The report format is the same as with command -compare. + add_missing iso_rr_path_start + adds the counterpart if it does not yet exist in the ISO + image and marks it for "rm_merge" as non-removable. + E.g.: -findx /home/thomas -exec add_missing /thomas_on_cd -- + is_full_in_iso + reports if the counterpart in the ISO image contains files. + To be used with -type "m" to report mount points. + empty_iso_dir + deletes all files from the counterpart in the ISO image. To + be used with -type "m" to truncate mount points. + estimate_size + prints a lower and an upper estimation of the number of + blocks which the found files together will occupy in the + emerging ISO image. This does not account for the superblock, + for the directories in the -findx path, or for image padding. + list_extattr mode + prints a script to the result channel, which would use + FreeBSD command setextattr to set the file's xattr name-value + pairs of user namespace. See -find for a description of + parameter mode. + E.g. -exec list_extattr e - + +-compare disk_path iso_rr_path + Compare attributes and eventual data file content of a fileobject + in the local filesystem with a file object in the ISO image. The + iso_rr_path may well point to an image file object which is not + yet committed, i.e. of which the data content still resides in the + local filesystem. Such data content is prone to externally caused + changes. + If iso_rr_path is empty then disk_path is used as path in the ISO + image too. + Differing attributes are reported in detail, differing content is + summarized. Both to the result channel. In case of no differences + no result lines are emitted. + +-compare_r disk_path iso_rr_path + Like -compare but working recursively. I.e. all file objects below + both addresses get compared whether they have counterparts below + the other address and whether both counterparts match. + +-compare_l disk_prefix iso_rr_prefix disk_path [***] + Perform -compare_r with each of the disk_path arguments. + iso_rr_path will be composed from disk_path by replacing + disk_prefix by iso_rr_prefix. + +-show_stream iso_rr_path [***] + Display the content stream chain of data files in the ISO image. + The chain consists of the iso_rr_name and one or more streams, + separated by " < " marks. A stream description consists of one or + more texts, separated by ":" characters. The first text tells the + stream type, the following ones, if ever, describe its individual + properties. Frequently used types are: + disk:'disk_path' for local filesystem objects. + image:'iso_rr_path' for ISO image file objects. + cout:'disk_path offset count' for -cut_out files. + extf:'filter_name' for external filters. + Example: + '/abc/xyz.gz' < extf:'gzip' < disk:'/home/me/x' + +-show_stream_r iso_rr_path [***] + Like -show_stream but working recursively. + + +File: xorriso.info, Node: Verify, Next: Restore, Prev: Navigate, Up: Options + +9.17 Evaluation of readability and recovery +=========================================== + +It is not uncommon that optical media produce read errors. The reasons +may be various and get obscured by error correction which is performed +by the drives and based on extra data on the media. If a drive returns +data then one can quite trust that they are valid. But at some degree +of read problems the correction will fail and the drive is supposed to +indicate error. +`xorriso' can scan a medium for readable data blocks, classify them +according to their read speed, save them to a file, and keep track of +successfuly saved blocks for further tries on the same medium. +By option -md5 checksums may get recorded with data files and whole +sessions. These checksums are reachable only via indev and a loaded +image. They work independently of the media type and can detect +transmission errors. + +-check_media [option [option ...]] -- + Try to read data blocks from the indev drive, optionally copy them + to a disk file, and finally report about the encountered quality. + Several options may be used to modify the default behavior. + The options given with this command override the default settings + which may have been changed by option -check_media_defaults. See + there for a description of options. + The result list tells intervals of 2 KiB blocks with start + address, number of blocks and quality. Qualities which begin with + "+" are supposed to be valid readable data. Qualities with "-" are + unreadable or corrupted data. "0" indicates qualities which are + not covered by the check run or are regularly allowed to be + unreadable (e.g. gaps between tracks). + Alternatively it is possible to report damaged files rather than + blocks. + If -md5 is "on" then the default mode what=tracks looks out for + libisofs checksum tags for the ISO session data and checks them + against the checksums computed from the data stream. + +-check_media_defaults [option [option ...]] -- + Preset options for runs of -check_media, -extract_cut and + best_effort file extraction. Options given with -check_media will + override the preset options. -extract_cut will override some + options automatically. + An option consists of a keyword, a "=" character, and a value. + Options may override each other. So their sequence matters. + The default setting at program start is: + use=indev what=tracks min_lba=-1 max_lba=-1 retry=default + time_limit=28800 item_limit=100000 data_to=" event=ALL + abort_file=/var/opt/xorriso/do_abort_check_media + sector_map=" map_with_volid=off patch_lba0=off report=blocks + bad_limit=valid slow_limit=1.0 chunk_size=0s + Option "reset=now" restores these startup defaults. + Non-default options are: + + report="files" + lists the files which use damaged blocks (not with + use=outdev). The format is like with find -exec + report_damage. Note that a MD5 session mismatch marks all + files of the session as damaged. If finer distinction is + desired, perform -md5 off before -check_media. + report="blocks_files" + first lists damaged blocks and then affected files. + use="outdev" + reads from the output drive instead of the input drive. This + avoids loading the ISO image tree from media. + use="sector_map" + does not read any media but loads the file given by option + sector_map= and processes this virtual outcome. + what="disc" + scans the payload range of a medium without respecting track + gaps. + what="image" + similar to "disc", but restricts scanning to the range of the + ISO 9660 image, if present. + min_lba=limit + omits all blocks with addresses lower than limit. + max_lba=limit + switches to what=disc and omits all blocks above limit. + retry="on" + forces read retries with single blocks when the normal read + chunk produces a read error. By default, retries are only + enabled with CD media. "retry=off" forbits retries for all + media types. + abort_file=disk_path + gives the path of the file which may abort a scan run. Abort + happens if the file exists and its mtime is not older than + the start time of the run. Use shell command "touch" to + trigger this. Other than an aborted program run, this will + report the tested and untested blocks and go on with running + `xorriso'. + time_limit=seconds + gives the number of seconds after which the scan shall be + aborted. This is useful for unattended scanning of media + which may else overwork the drive in its effort to squeeze + out some readable blocks. Abort may be delayed by the drive + gnawing on the last single read operation. Value -1 means + unlimited time. + item_limit=number + gives the number of report list items after which to abort. + Value -1 means unlimited item number. + data_to=disk_path + copies the valid blocks to the given file. + event=severity + sets the given severity for a problem event which shall be + issued at the end of a check run if data blocks were + unreadable or failed to match recorded MD5 checksums. + Severity "ALL" disables this event. + sector_map=disk_path + tries to read the file given by disk_path as sector bitmap + and to store such a map file after the scan run. The bitmap + tells which blocks have been read successfully in previous + runs. It allows to do several scans on the same medium, even + with intermediate eject, in order to collect readable blocks + whenever the drive is lucky enough to produce them. The + stored file contains a human readable TOC of tracks and their + start block addresses, followed by binary bitmap data. + map_with_volid="on" + examines tracks whether they are ISO images and prints their + volume ids into the human readable TOC of sector_map=. + patch_lba0="on" + transfers within the data_to= file a copy of the currently + loaded session head to the start of that file and patches it + to be valid at that position. This makes the loaded session + the default session of the image file when it gets mounted or + loaded as stdio: drive. But it usually makes the original + session 1 inaccessible. + patch_lba0="force" + performs patch_lba0="on" even if `xorriso' believes that the + copied data are not valid. + patch_lba0= may also bear a number. If it is 32 or higher it + is taken as start address of the session to be copied. In + this case it is not necessary to have an -indev and a loaded + image. ":force" may be appended after the number. + bad_limit=threshold + sets the highest quality which shall be considered as damage. + Choose one of "good", "md5_match", "slow", "partial", + "valid", "untested", "invalid", "tao_end", "off_track", + "md5_mismatch", "unreadable". + slow_limit=threshold + sets the time threshold for a single read chunk to be + considered slow. This may be a fractional number like 0.1 or + 1.5. + chunk_size=size + sets the number of bytes to be read in one read operation. + This gets rounded down to full blocks of 2048 bytes. 0 means + automatic size. + +-check_md5 severity iso_rr_path [***] + Compare the data content of the given files in the loaded image + with their recorded MD5 checksums, if there are any. In case of + any mismatch an event of the given severity is issued. It may then + be handled by appropriate settings of options -abort_on or + -return_with which both can cause non-zero exit values of the + program run. Severity ALL suppresses that event. + This option reports match and mismatch of data files to the result + channel. Non-data files cause NOTE events. There will also be + UPDATE events from data reading. + If no iso_rr_path is given then the whole loaded session is + compared with its MD5 sum. Be aware that this covers only one + session and not the whole image if there are older sessions. + +-check_md5_r severity iso_rr_path [***] + Like -check_md5 but checking all data files underneath the given + paths. Only mismatching data files will be reported. + + +File: xorriso.info, Node: Restore, Next: Emulation, Prev: Verify, Up: Options + +9.18 osirrox ISO-to-disk restore options +======================================== + +Normally `xorriso' only writes to disk files which were given as stdio: +pseudo-drives or as log files. But its alter ego osirrox is able to +extract file objects from ISO images and to create, overwrite, or +delete file objects on disk. +Disk file exclusions by -not_mgt, -not_leaf, -not_paths apply. If disk +file objects already exist then the settings of -overwrite and +-reassure apply. But -overwrite "on" only triggers the behavior of +-overwrite "nondir". I.e. directories cannot be deleted. +Access permissions of files in the ISO image do not restrict restoring. +The directory permissions on disk have to allow rwx. + +-osirrox "on"|"device_files"|"off"|"banned"|[:option:...] + Setting "off" disables disk filesystem manipulations. This is the + default unless the program was started with leafname "osirrox". + Elsewise the capability to restore files can be enabled explicitly + by -osirrox "on". It can be irrevocably disabled by -osirrox + "banned". + To enable restoring of special files by "device_files" is + potentially dangerous. The meaning of the number st_rdev (see man + 2 stat) depends much on the operating system. Best is to restore + device files only to the same system from where they were copied. + If not enabled, device files in the ISO image are ignored during + restore operations. + Due to a bug of previous versions, device files from previous + sessions might have been altered to major=0, minor=1. So this + combination does not get restored. + Option "concat_split_on" is default. It enables restoring of split + file directories as data files if the directory contains a + complete collection of -cut_out part files. With option + "concat_split_off" such directories are handled like any other ISO + image directory. + Option "auto_chmod_off" is default. If "auto_chmod_on" is set then + access restrictions for disk directories get circumvented if those + directories are owned by the effective user who runs `xorriso'. + This happens by temporarily granting rwx permission to the owner. + Option "sort_lba_on" may improve read performance with optical + drives. It allows to restore large numbers of hard links without + exhausting -temp_mem_limit. It does not preserve directory mtime + and it needs -osirrox option auto_chmod_on in order to extract + directories which offer no write permission. Default is + "sort_lba_off". + Option "o_excl_on" is the default unless the program was started + with leafname "osirrox". On GNU/Linux it tries to avoid using + drives which are mounted or in use by other libburn programs. + Option "o_excl_off" allows on GNU/Linux to access such drives. + Drives which get acquired while "o_excl_off" will refuse to get + blanked, formatted, written, or ejected. But be aware that even + harmless inquiries can spoil ongoing burns of CD-R[W] and DVD-R[W]. + Option "strict_acl_off" is default. It tolerates on FreeBSD the + presence of directory "default" ACLs in the ISO image. With + "strict_acl_on" these GNU/Linux ACLs cause on FreeBSD a FAILURE + event during restore with -acl "on". + +-extract iso_rr_path disk_path + Copy the file objects at and underneath iso_rr_path to their + corresponding addresses at and underneath disk_path. This is the + inverse of -map or -update_r. + If iso_rr_path is a directory and disk_path is an existing + directory then both trees will be merged. Directory attributes get + extracted only if the disk directory is newly created by the copy + operation. Disk files get removed only if they are to be replaced + by file objects from the ISO image. + As many attributes as possible are copied together with restored + file objects. + +-extract_single iso_rr_path disk_path + Like -extract, but if iso_rr_path is a directory then its sub tree + gets not restored. + +-extract_l iso_rr_prefix disk_prefix iso_rr_path [***] + Perform -extract with each of the iso_rr_path arguments. disk_path + will be composed from iso_rr_path by replacing iso_rr_prefix by + disk_prefix. + +-extract_cut iso_rr_path byte_offset byte_count disk_path + Copy a byte interval from a data file out of an ISO image into a + newly created disk file. The main purpose for this is to allow + handling of large files if they are not supported by mount -t + iso9660 and if the reading system is unable to buffer them as a + whole. + If the data bytes of iso_rr_path are stored in the loaded ISO + image, and no filter is applied, and byte_offset is a multiple of + 2048, then a special run of -check_media is performed. It may be + quicker and more rugged than the general reading method. + +-cpx iso_rr_path [***] disk_path + Copy single leaf file objects from the ISO image to the address + given by disk_path. If more then one iso_rr_path is given then + disk_path must be a directory or non-existent. In the latter case + it gets created and the extracted files get installed in it with + the same leafnames. + Missing directory components in disk_path will get created, if + possible. + Directories are allowed as iso_rr_path only with -osirrox + "concat_split_on" and only if they actually represent a complete + collection of -cut_out split file parts. + +-cpax iso_rr_path [***] disk_path + Like -cpx but restoring mtime, atime as in ISO image and trying to + set ownership and group as in ISO image. + +-cp_rx iso_rr_path [***] disk_path + Like -cpx but also extracting whole directory trees from the ISO + image. + The resulting disk paths are determined as with shell command cp + -r : If disk_path is an existing directory then the trees will be + inserted or merged underneath this directory and will keep their + leaf names. The ISO directory "/" has no leaf name and thus gets + mapped directly to disk_path. + +-cp_rax iso_rr_path [***] disk_path + Like -cp_rx but restoring mtime, atime as in ISO image and trying + to set ownership and group as in ISO image. + +-paste_in iso_rr_path disk_path byte_offset byte_count + Read the content of a ISO data file and write it into a data file + on disk beginning at the byte_offset. Write at most byte_count + bytes. This is the inverse of option -cut_out. + +-mount drive entity id path + Produce the same line as -mount_cmd and then execute it as + external program run after giving up the depicted drive. See also + -mount_opts. This demands -osirrox to be enabled and normally + will succeed only for the superuser. For safety reasons the mount + program is only executed if it is reachable as /bin/mount or + /sbin/mount. + + +File: xorriso.info, Node: Emulation, Next: Scripting, Prev: Restore, Up: Options + +9.19 Command compatibility emulations (cdrtools) +================================================ + +Writing of ISO 9660 on CD is traditionally done by program mkisofs as +ISO 9660 image producer and cdrecord as burn program. `xorriso' does +not strive for their comprehensive emulation. Nevertheless it is ready +to perform some of its core tasks under control of commands which in +said programs trigger comparable actions. + +-as personality option [options] -- + Perform the variable length option list as sparse emulation of the + program depicted by the personality word. + + Personality "*mkisofs*" accepts the options listed with: + -as mkisofs -help -- + Among them: -R (always on), -r, -J, -o, -M, -C, -dir-mode, + -file-mode, -path-list, -m, -exclude-list, -f, -print-size, -pad, + -no-pad, -V, -v, -version, -graft-points, -z, -no-emul-boot, -b, + -c, -boot-info-table, -boot-load-size, -input-charset, -G, + -output-charset, -U, -hide, -hide-joliet, -hide-list, + -hide-joliet-list, file paths and pathspecs. A lot of options are + not supported and lead to failure of the mkisofs emulation. Some + are ignored, but better do not rely on this tolerance. + The supported options are documented in detail in xorrisofs.info + and in man xorrisofs. The description here is focused on the effect + of mkisofs emulation in the context of a `xorriso' run. + Other than with the "cdrecord" personality there is no automatic + -commit at the end of a "mkisofs" option list. Verbosity settings + -v (= "UPDATE") and -quiet (= "SORRY") persist. The output file + persists until things happen like -commit, -rollback, -dev, or end + of `xorriso'. -pacifier gets set to "mkisofs" if files are added + to the image. + -graft-points is equivalent to -pathspecs on. Note that pathspecs + without "=" are interpreted differently than with `xorriso' option + -add. Directories get merged with the root directory of the ISO + image, other filetypes get mapped into that root directory. + If pathspecs are given and if no output file was chosen before or + during the "mkisofs" option list, then standard output (-outdev + "-") will get into effect. If -o points to a regular file, then + it will be truncated to 0 bytes when finally writing begins. This + truncation does not happen if the drive is chosen by `xorriso' + options before -as mkisofs or after its list delimiter. + Directories and symbolic links are no valid -o targets. + Writing to stdout is possible only if -as "mkisofs" was among the + start arguments or if other start arguments pointed the output + drive to standard output. + -print-size inhibits automatic image production at program end. + This ban is lifted only if the pending image changes get discarded. + Padding is counted as part of the ISO image if not option -emul-toc + is given. + If no -iso-level is given, then level 1 is chosen when the first + file or directory is added to the image. At the same occasion + directory names get allowed to violate the standard by -compliance + option allow_dir_id_ext. This may be avoided by option + -disallow_dir_id_ext. + Option -root is supported. Option -old-root is implemented by + `xorriso' commands -mkdir, -cp_clone, -find update_merge, and + -find rm_merge. -root and -old-root set command -disk_dev_ino to + "ino_only" and -md5 to "on", by default. -disk_dev_ino can be set + to "off" by --old-root-no-ino resp. to "on" by --old-root-devno . + -md5 can be set to "off" by --old-root-no-md5 . + Not original mkisofs options are --quoted_path_list , --hardlinks + , --acl , --xattr , --md5 , --stdio_sync . They work like the + `xorriso' options with the same name and hardcoded argument "on", + e.g. -acl "on". Explicit arguments are expected by --stdio_sync + and --scdbackup_tag. + The capability to preserve multi-session history on overwriteable + media gets disabled by default. It can be enabled by using + --emul-toc with the first session. See -compliance no_emul_toc. + --sort-weight gets as arguments a number and an iso_rr_path. The + number becomes the LBA sorting weight of regular file iso_rr_path + or of all regular files underneath directory iso_rr_path. (See + -find -exec sort_weight). + Adopted from grub-mkisofs are --protective-msdos-label (see + -boot_image grub partition_table=on) and + --modification-date=YYYYMMDDhhmmsscc (see -volume_date uuid). For + EFI bootable GRUB boot images use --efi-boot. It performs + -boot_image grub efi_path= surrounded by two -boot_image "any" + "next". Alternative option -e from Fedora genisoimage sets + bin_path and platform_id for EFI, but performs no "next". + For MBR bootable ISOLINUX images there is -isohybrid-mbr FILE, + where FILE is one of the Syslinux files mbr/isohdp[fp]x*.bin . Use + this instead of -G to apply the effect of -boot_image isolinux + partition_table=on. + --boot-catalog-hide is -boot_image any cat_hidden=on. + -mips-boot is the same as -boot_image any mips_path= . + -mipsel-boot leads to mipsel_path= . + -partition_offset number is -boot_image any + partition_offset=number. + Option -append_partition is supported. + -untranslated_name_len number is -compliance + untranslated_name_len=number. + --old-empty is -compliance old_empty. + The options of genisoimage Jigdo Template Extraction are + recognized and performed via `xorriso' option -jigdo. See the + "Alias:" names there for the meaning of the genisoimage options. + + Personalities "*xorrisofs*", "*genisoimage*", and "*genisofs*" are + aliases for "mkisofs". + If `xorriso' is started with one of the leafnames "xorrisofs", + "genisofs", "mkisofs", or "genisoimage", then it performs + -read_mkisofsrc and prepends -as "genisofs" to the command line + arguments. I.e. all arguments will be interpreted mkisofs style + until "--" is encountered. From then on, options are interpreted + as `xorriso' options. + --no_rc as first argument of such a program start prevents + interpretation of startup files. See section FILES below. + + Personality "*cdrecord*" accepts the options listed with: + -as cdrecord -help -- + Among them: -v, dev=, speed=, blank=, fs=, -eject, -atip, + padsize=, tsize=, -isosize, -multi, -msinfo, + --grow_overwriteable_iso, write_start_address=, track source file + path or "-" for standard input as track source. + It ignores most other options of cdrecord and cdrskin but refuses + on -audio, -scanbus, and on blanking modes unknown to `xorriso'. + The scope is only a single data track per session to be written to + blank, overwriteable, or appendable media. The medium gets closed + if closing is applicable and not option -multi is present. + If an input drive was aquired, then it is given up. This is only + allowed if no image changes are pending. + dev= must be given as `xorriso' device address. Addresses like + 0,0,0 or ATA:1,1,0 are not supported. + If a track source is given, then an automatic -commit happens at + the end of the "cdrecord" option list. + --grow_overwriteable_iso enables emulation of multi-session on + overwriteable media. To enable emulation of a TOC, the first + session needs -C 0,32 with -as mkisofs (but no -M) and + --grow_overwriteable_iso write_start_address=32s with -as cdrecord. + A much more elaborate libburn based cdrecord emulator is the + program cdrskin. + Personalites "*xorrecord*", "*wodim*", and "*cdrskin*" are aliases + for "cdrecord". + If `xorriso' is started with one of the leafnames "xorrecord", + "cdrskin", "cdrecord", or "wodim", then it automatically prepends + -as "cdrskin" to the command line arguments. I.e. all arguments + will be interpreted cdrecord style until "--" is encountered. + From then on, options are interpreted as `xorriso' options. + --no_rc as first argument of such a program start prevents + interpretation of `xorriso' startup files. See section FILES + below. + +-read_mkisofsrc + Try one by one to open for reading: ./.mkisofsrc , $MKISOFSRC , + $HOME/.mkisofsrc , $(dirname $0)/.mkisofsrc + On success interpret the file content as of man mkisofs + CONFIGURATION, and end this command. Do not try further files. + The last address is used only if start argument 0 has a + non-trivial dirname. + The reader currently interprets the following NAME=VALUE pairs: + APPI (-application_id) , PUBL (-publisher) , SYSI (-system_id) , + VOLI (-volid) , VOLS (-volset_id) + Any other lines will be silently ignored. + +-pacifier behavior_code + Control behavior of UPDATE pacifiers during write operations. The + following behavior codes are defined: + "xorriso" is the default format: + Writing: sector XXXXX of YYYYYY [fifo active, nn% fill] + "cdrecord" looks like: + X of Y MB written (fifo nn%) [buf mmm%] + "mkisofs" + nn% done, estimate finish Tue Jul 15 20:13:28 2008 + +-scdbackup_tag list_path record_name + Set the parameter "name" for a scdbackup checksum record. It will + be appended in an scdbackup checksum tag to the -md5 session tag if + the image starts at LBA 0. This is the case if it gets written as + first session onto a sequential medium, or piped into a program, + named pipe or character device. + If list_path is not empty then the record will also be appended to + the data file given by this path. + Program scdbackup_verify will recognize and verify tag resp. + record. + + +File: xorriso.info, Node: Scripting, Next: Frontend, Prev: Emulation, Up: Options + +9.20 Scripting, dialog and program control features +=================================================== + +-no_rc + Only if used as first command line argument this option prevents + reading and interpretation of startup files. See section FILES + below. + +-options_from_file fileaddress + Read quoted input from fileaddress and execute it like dialog + lines. Empty lines and lines which begin by # are ignored. + Normally one line should hold one `xorriso' command and all its + arguments. Nevertheless lines may be concatenated by a trailing + backslash. + See also section "Command processing", paragraph "Quoted input". + +-help + Print helptext. + +-version + Print program name and version, component versions, license. + +-list_extras code + Tell whether certain extra features were enabled at compile time. + Code "all" lists all features and a headline. Other codes pick a + single feature. Code "codes" lists them. They share names with + related commands (see also there): + "acl" tells whether xorriso has an adapter for local filesystems + ACLs. + "xattr" tells whether xorriso has an adapter for local filesystems + EA. + "jigdo" tells whether production of Jigdo files is possible. + "zisofs" tells whether zisofs and built-in gzip filters are + enabled. + "external_filter" tells whether external filter processes are + allowed and whether they are allowed if real user id and effective + user id differ. + "dvd_obs" tells whether 64 kB output to DVD media is default. + "use_readline" tells whether readline may be enabled in dialog + mode. +-history textline + Copy textline into libreadline history. + +-status mode|filter + Print the current settings of `xorriso'. Modes: + short... print only important or altered settings + long ... print all settings including defaults + long_history like long plus history lines + Filters begin with '-' and are compared literally against the + output lines of -status:long_history. A line is put out only if + its start matches the filter text. No wildcards. + +-status_history_max number + Set maximum number of history lines to be reported with -status + "long_history". + +-list_delimiter word + Set the list delimiter to be used instead of "--". It has to be a + single word, must not be empty, not longer than 80 characters, and + must not contain quotation marks. + For brevity the list delimiter is referred as "--" throughout this + text. + +-backslash_codes "on"|"off"|mode[:mode] + Enable or disable the interpretation of symbolic representations + of special characters with quoted input, or with program + arguments, or with program text output. If enabled the following + translations apply: + \a=bell(007) \b=backspace(010) \e=Escape(033) \f=formfeed(014) + \n=linefeed(012) \r=carriage_return(015) \t=tab(011) + \v=vtab(013) \\=backslash(134) \[0-7][0-7][0-7]=octal_code + \x[0-9a-f][0-9a-f]=hex_code \cC=control-C + Translations can occur with quoted input in 3 modes: + "in_double_quotes" translates only inside " quotation. + "in_quotes" translates inside " and ' quotation. + "with_quoted_input" translates inside and outside quotes. + With the start program arguments there is mode: + "with_program_arguments" translates all program arguments. + Mode "encode_output" encodes output characters. It combines + "encode_results" with "encode_infos". Inside single or double + quotation marks encoding applies to ASCII characters octal 001 to + 037 , 177 to 377 and to backslash(134). Outside quotation marks + some harmless control characters stay unencoded: bell(007), + backspace(010), tab(011), linefeed(012), formfeed(014), + carriage_return(015). + Mode "off" is default and disables any translation. Mode "on" is + "with_quoted_input:with_program_arguments:encode_output". + +-temp_mem_limit number["k"|"m"] + Set the maximum size of temporary memory to be used for image + dependent buffering. Currently this applies to pattern expansion, + LBA sorting, restoring of hard links. + Default is 16m = 16 MiB, minimum 64k = 64 kiB, maximum 1024m = 1 + GiB. + +-print text + Print a text line to the result channel which is by default stdout. + +-print_info text + Print a text line to the info channel which is by default stderr. + +-print_mark text + Print a text line to the mark channel which is by default directed + to both, result and info channel. An empty text will cause no + output at all. + +-prompt text + Show text at beginning of output line and wait for the user to hit + the Enter key resp. to send a line via stdin. + +-sleep seconds + Wait for the given number of seconds before perfoming the next + command. Expect coarse granularity no better than 1/100 seconds. + +-errfile_log mode path|channel + If problem events are related to input files from the filesystem, + then their disk_paths can be logged to a file or to output + channels R or I. + Mode can either be "plain" or "marked". The latter causes marker + lines which give the time of log start, burn session start, burn + session end, log end or program end. In mode "plain", only the + file paths are logged. + If path is "-" or "-R" then the log is directed to the result + channel. Path "-I" directs it to the info message channel. Any + text that does not begin with "-" is used as path for a file to + append the log lines. + Problematic files can be recorded multiple times during one + program run. If the program run aborts then the list might not be + complete because some input file arguments might not have been + processed at all. + The errfile paths are transported as messages of very low severity + "ERRFILE". This transport becomes visible with -report_about + "ALL". + +-session_log path + If path is not empty it gives the address of a plain text file + where a log record gets appended after each session. This log can + be used to determine the start_lba of a session for mount options + -o sbsector= resp. -s from date or volume id. + Record format is: timestamp start_lba size volume-id + The first three items are single words, the rest of the line is + the volume id. + +-scsi_log "on"|"off" + Mode "on" enables very verbous logging of SCSI commands and drive + replies. Logging messages get printed to stderr, not to any of + the `xorriso' output channels. + A special property of this option is that the first -scsi_log + setting among the start arguments is in effect already when the + first operations of `xorriso' begin. Only "-scsi_log" with dash + "-" is recognized that way. + +-end + End program after writing pending changes. + +-rollback_end + Discard pending changes. End program immediately. + +# any text + Only in dialog or file execution mode, and only as first + non-whitespace in line: Do not execute the line but store it in + readline history. + + +File: xorriso.info, Node: Frontend, Next: ExDevices, Prev: Scripting, Up: Options + +9.21 Support for frontend programs via stdin and stdout +======================================================= + +-pkt_output "on"|"off" + Consolidate text output on stdout and classify each line by a + channel indicator: + 'R:' for result lines, + 'I:' for notes and error messages, + 'M:' for -mark texts. + Next is a decimal number of which only bit 0 has a meaning for now. + 0 means no newline at end of payload, 1 means that the newline + character at the end of the output line belongs to the payload. + After another colon and a blank follows the payload text. + Example: + I:1: enter option and arguments : + +-logfile channel fileaddress + Copy output of a channel to the given file. Channel may be one of: + "." for all channels, "I" for info messages, "R" for result lines, + "M" for -mark texts. + +-mark text + If text is not empty it will get put out on "M" channel each time + `xorriso' is ready for the next dialog line or before `xorriso' + performs a command that was entered to the pager prompt. + +-prog text + Use text as name of this program in subsequent messages + +-prog_help text + Use text as name of this program and perform -help. + + +File: xorriso.info, Node: Examples, Next: Files, Prev: Options, Up: Top + +10 Examples +*********** + +* Menu: + +* ExDevices:: As superuser learn about available drives +* ExCreate:: Blank medium and compose a new ISO image as batch run +* ExDialog:: A dialog session doing about the same +* ExGrowing:: Manipulate an existing ISO image on the same medium +* ExModifying:: Copy modified ISO image from one medium to another +* ExBootable:: Bring a prepared ISOLINUX tree onto medium and make it bootable +* ExCharset:: Change existing file name tree from ISO-8859-1 to UTF-8 +* ExPseudo:: Operate on storage facilities other than optical drives +* ExCdrecord:: Burn an existing ISO image file to medium +* ExMkisofs:: Perform multi-session runs as of cdrtools traditions +* ExGrowisofs:: Let `xorriso' work underneath growisofs +* ExException:: Adjust thresholds for verbosity, exit value and program abort +* ExTime:: Examples of input timestrings +* ExIncBackup:: Incremental backup of a few directory trees +* ExRestore:: Restore directory trees from a particular ISO session to disk +* ExRecovery:: Try to retrieve blocks from a damaged medium + + +File: xorriso.info, Node: ExDevices, Next: ExCreate, Prev: Frontend, Up: Examples + +10.1 As superuser learn about available drives +============================================== + +On Linux or FreeBSD consider to give rw-permissions to those users or +groups which shall be able to use the drives with `xorriso'. On +Solaris use pfexec. Consider to restrict privileges of `xorriso' to +"base,sys_devices" and to give r-permission to user or group. + +$ xorriso -device_links +1 -dev '/dev/cdrom1' rwrw-- : 'TSSTcorp' 'DVD-ROM SH-D162C +1 -dev '/dev/cdrw' rwrw-- : 'TSSTcorp' 'CDDVDW SH-S223B' +2 -dev '/dev/cdrw3' rwrw-- : 'HL-DT-ST' 'BDDVDRW_GGC-H20L' + + +File: xorriso.info, Node: ExCreate, Next: ExDialog, Prev: ExDevices, Up: Examples + +10.2 Blank medium and compose a new ISO image as batch run +========================================================== + +Aquire drive /dev/sr2, make medium ready for writing a new image, fill +the image with the files from hard disk directories /home/me/sounds and +/home/me/pictures. +Because no -dialog "on" is given, the program will then end by writing +the session to the medium. + +$ xorriso -outdev /dev/sr2 \ +-blank as_needed \ +-map /home/me/sounds /sounds \ +-map /home/me/pictures /pictures + +The ISO image may be shaped in a more elaborate way like the following: +Omit some unwanted stuff by removing it from the image directory tree. +Reintroduce some wanted stuff. + +$ cd /home/me +$ xorriso -outdev /dev/sr2 \ +-blank as_needed \ +-map /home/me/sounds /sounds \ +-map /home/me/pictures /pictures \ +-rm_r \ +/sounds/indecent \ +'/pictures/*private*' \ +/pictures/confidential \ +-- \ +-cd / \ +-add pictures/confidential/work* -- + +Note that '/pictures/*private*' is a pattern for iso_rr_paths while +pictures/confidential/work* gets expanded by the shell with addresses +from the hard disk. Options -add and -map have different argument rules +but finally the same effect: they put files into the image. + + +File: xorriso.info, Node: ExDialog, Next: ExGrowing, Prev: ExCreate, Up: Examples + +10.3 A dialog session doing about the same as the previous example +================================================================== + +Some settings are already given as start argument. The other activities +are done as dialog input. The pager gets set to 20 lines of 80 +characters. +The drive is acquired by option -dev rather than -outdev in order to see +the message about its current content. By option -blank this content is +made ready for being overwritten and the loaded ISO image is made empty. +In order to be able to eject the medium, the session needs to be +committed explicitly. + +$ xorriso -dialog on -page 20 80 -disk_pattern on + + enter option and arguments : +-dev /dev/sr2 + + enter option and arguments : +-blank as_needed + + enter option and arguments : +-map /home/me/sounds /sounds -map /home/me/pictures /pictures + + enter option and arguments : +-rm_r /sounds/indecent /pictures/*private* /pictures/confidential + + enter option and arguments : +-cdx /home/me/pictures -cd /pictures + + enter option and arguments : +-add confidential/office confidential/factory + + enter option and arguments : +-du / + + enter option and arguments : +-commit_eject all -end + + +File: xorriso.info, Node: ExGrowing, Next: ExModifying, Prev: ExDialog, Up: Examples + +10.4 Manipulate an existing ISO image on the same medium +======================================================== + +Load image from drive. Remove (i.e. hide) directory /sounds and its +subordinates. Rename directory /pictures/confidential to +/pictures/restricted. Change access permissions of directory +/pictures/restricted. Add new directory trees /sounds and /movies. +Burn to the same medium, check whether the tree can be loaded, and +eject. + +$ xorriso -dev /dev/sr2 \ +-rm_r /sounds -- \ +-mv \ +/pictures/confidential \ +/pictures/restricted \ +-- \ +-chmod go-rwx /pictures/restricted -- \ +-map /home/me/prepared_for_dvd/sounds_dummy /sounds \ +-map /home/me/prepared_for_dvd/movies /movies \ +-commit -eject all + + +File: xorriso.info, Node: ExModifying, Next: ExBootable, Prev: ExGrowing, Up: Examples + +10.5 Copy modified ISO image from one medium to another +======================================================= + +Load image from input drive. Do the same manipulations as in the +previous example. Aquire output drive and blank it. Burn the modified +image as first and only session to the output drive. + +$ xorriso -indev /dev/sr2 \ +-rm_r /sounds -- \ +... +-outdev /dev/sr0 -blank as_needed \ +-commit -eject all + + +File: xorriso.info, Node: ExBootable, Next: ExCharset, Prev: ExModifying, Up: Examples + +10.6 Bring a prepared ISOLINUX tree onto medium and make it bootable +==================================================================== + +The user has already created a suitable file tree on disk and copied the +ISOLINUX files into subdirectory ./boot/isolinux of that tree. Now +`xorriso' can burn an El Torito bootable medium: + +$ xorriso -outdev /dev/sr0 -blank as_needed \ +-map /home/me/ISOLINUX_prepared_tree / \ +-boot_image isolinux dir=/boot/isolinux + + +File: xorriso.info, Node: ExCharset, Next: ExPseudo, Prev: ExBootable, Up: Examples + +10.7 Change existing file name tree from ISO-8859-1 to UTF-8 +============================================================ + +This example assumes that the existing ISO image was written with +character set ISO-8859-1 but that the readers expected UTF-8. Now a new +session with the same files gets added with converted file names. In +order to avoid any weaknesses of the local character set, this command +pretends that it uses already the final target set UTF-8. Therefore +strange file names may appear in messages, which will be made +terminal-safe by option -backslash_codes. + +$ xorriso -in_charset ISO-8859-1 -local_charset UTF-8 \ +-out_charset UTF-8 -backslash_codes on -dev /dev/sr0 \ +-alter_date m +0 / -- -commit -eject all + + +File: xorriso.info, Node: ExPseudo, Next: ExCdrecord, Prev: ExCharset, Up: Examples + +10.8 Operate on storage facilities other than optical drives +============================================================ + +Full read-write operation is possible with regular files and block +devices: + +$ xorriso -dev /tmp/regular_file ... + +Paths underneath /dev normally need prefix "stdio:" + +$ xorriso -dev stdio:/dev/sdb ... + +If /dev/sdb is to be used frequently and /dev/sda is the system disk, +then consider to place the following lines in a `xorriso' Startup File. +They allow to use /dev/sdb without prefix and protect disk /dev/sda +from `xorriso': + +-drive_class banned /dev/sda* +-drive_class harmless /dev/sdb + +Other writeable file types are supported write-only: + +$ xorriso -outdev /tmp/named_pipe ... + +Among the write-only drives is standard output: + +$ xorriso -outdev - \ +... +| gzip >image.iso.gz + + +File: xorriso.info, Node: ExCdrecord, Next: ExMkisofs, Prev: ExPseudo, Up: Examples + +10.9 Burn an existing ISO image file to medium +============================================== + +Actually this works with any kind of data, not only ISO images: + +$ xorriso -as cdrecord -v dev=/dev/sr0 blank=as_needed image.iso + + +File: xorriso.info, Node: ExMkisofs, Next: ExGrowisofs, Prev: ExCdrecord, Up: Examples + +10.10 Perform multi-session runs as of cdrtools traditions +========================================================== + +Between both processes there can be performed arbitrary transportation +or filtering. +The first session is written like this: + +$ xorriso -as mkisofs prepared_for_iso/tree1 | \ +xorriso -as cdrecord -v dev=/dev/sr0 blank=fast -multi -eject - + +Follow-up sessions are written like this: + +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +$ m=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +$ xorriso -as mkisofs -M /dev/sr0 -C $m prepared_for_iso/tree2 | \ +xorriso -as cdrecord -v dev=/dev/sr0 -waiti -multi -eject - + +Always eject the drive tray between sessions. The old sessions get read +via /dev/sr0. Its device driver might not be aware of the changed +content before it loads the medium again. In this case the previous +session would not be loaded and the new session would contain only the +newly added files. +For the same reason do not let `xorriso' -as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. + +This example works for multi-session media only. Add cdrskin option +--grow_overwriteable_iso to all -as cdrecord runs in order to enable +multi-session emulation on overwriteable media. + + +File: xorriso.info, Node: ExGrowisofs, Next: ExException, Prev: ExMkisofs, Up: Examples + +10.11 Let `xorriso' work underneath growisofs +============================================= + +growisofs expects an ISO formatter program which understands options -C +and -M. If `xorriso' gets started by name "xorrisofs" then it is +suitable for that. + +$ export MKISOFS="xorrisofs" +$ growisofs -Z /dev/dvd /some/files +$ growisofs -M /dev/dvd /more/files + +If no "xorrisofs" is available on your system, then you will have to +create a link pointing to the `xorriso' binary and tell growisofs to +use it. E.g. by: + +$ ln -s $(which xorriso) "$HOME/xorrisofs" +$ export MKISOFS="$HOME/xorrisofs" + +One may quit mkisofs emulation by argument "--" and make use of all +`xorriso' commands. growisofs dislikes options which start with "-o" +but -outdev must be set to "-". So use "outdev" instead: + +$ growisofs -Z /dev/dvd -- outdev - -update_r /my/files /files +$ growisofs -M /dev/dvd -- outdev - -update_r /my/files /files + +growisofs has excellent burn capabilities with DVD and BD. It does not +emulate session history on overwriteable media, though. + + +File: xorriso.info, Node: ExException, Next: ExTime, Prev: ExGrowisofs, Up: Examples + +10.12 Adjust thresholds for verbosity, exit value and program abort +=================================================================== + +Be quite verbous, exit 32 if severity "FAILURE" was encountered, do not +abort prematurely but forcibly go on until the end of commands. + +$ xorriso ... \ +-report_about UPDATE \ +-return_with FAILURE 32 \ +-abort_on NEVER \ +... + + +File: xorriso.info, Node: ExTime, Next: ExIncBackup, Prev: ExException, Up: Examples + +10.13 Examples of input timestrings +=================================== + +As printed by program date: +'Thu Nov 8 14:51:13 CET 2007' + + The same without ignored parts: +'Nov 8 14:51:13 2007' + + The same as expected by date: +110814512007.13 + + Four weeks in the future: ++4w + + The current time: ++0 + + Three hours ago: +-3h + + Seconds since Jan 1 1970: +=1194531416 + + +File: xorriso.info, Node: ExIncBackup, Next: ExRestore, Prev: ExTime, Up: Examples + +10.14 Incremental backup of a few directory trees +================================================= + +This changes the directory trees /open_source_project and /personal_mail +in the ISO image so that they become exact copies of their disk +counterparts. ISO file objects get created, deleted or get their +attributes adjusted accordingly. +ACL, xattr, hard links and MD5 checksums will be recorded. Accelerated +comparison is enabled at the expense of potentially larger backup size. +Only media with the expected volume id or blank media are accepted. +Files with names matching *.o or *.swp get excluded explicitly. +When done with writing the new session gets checked by its recorded MD5. + +$ xorriso \ +-abort_on FATAL \ +-for_backup -disk_dev_ino on \ +-assert_volid 'PROJECTS_MAIL_*' FATAL \ +-dev /dev/sr0 \ +-volid PROJECTS_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \ +-not_leaf '*.o' -not_leaf '*.swp' \ +-update_r /home/thomas/projects /projects \ +-update_r /home/thomas/personal_mail /personal_mail \ +-commit -toc -check_md5 FAILURE -- -eject all + +To be used several times on the same medium, whenever an update of the +two disk trees to the medium is desired. Begin with a blank medium and +update it until he run fails gracefully due to lack of remaining space +on the old one. +This makes sense if the full backup leaves substantial remaining +capacity on media and if the expected changes are much smaller than the +full backup. To apply zisofs compression to those data files which get +newly copied from the local filesystem, insert these options +immediately before -commit : + +-hardlinks perform_update \ +-find / -type f -pending_data -exec set_filter --zisofs -- \ + +Options -disk_dev_ino and -for_backup depend on stable device and inode +numbers on disk. Without them, an update run may use -md5 "on" to match +recorded MD5 sums against the current file content on hard disk. This +is usually much faster than the default which compares both contents +directly. +With *mount* option *-o "sbsector="* on GNU/Linux resp. *-s* on FreeBSD +it is possible to access the session trees which represent the older +backup versions. With CD media, GNU/Linux mount accepts session numbers +directly by its option "session=". +Multi-session media and most overwriteable media written by `xorriso' +can tell the sbsectors of their sessions by `xorriso' option -toc. +Used after -commit the following option prints the matching mount +command for the newly written session (here for mount point /mnt): + +-mount_cmd "indev" "auto" "auto" /mnt + +Options -mount_cmd and -mount are also able to produce the mount +commands for older sessions in the table-of-content. E.g. as superuser: + +# osirrox -mount /dev/sr0 "volid" '*2008_12_05*' /mnt + +Above example produces a result similar to -root / -old-root / with +mkisofs. For getting the session trees accumulated in the new +sessions, let all -update commands use a common parent directory and +clone it after updating is done: +-update_r /home/thomas/projects /current/projects \ +-update_r /home/thomas/personal_mail /current/personal_mail \ +-clone /current /"$(date '+%Y_%m_%d_%H%M%S')" \ +The cloned tree will have a name like /2011_02_12_155700. + +Sessions on multi-session media are separated by several MB of unused +blocks. So with small sessions the payload capacity can become +substantially lower than the overall media capacity. If the remaining +space on a medium does not suffice for the next gap, the drive is +supposed to close the medium automatically. + +*Better do not use your youngest backup for -update_r*. Have at least +two media which you use alternatingly. So only older backups get +endangered by the new write operation, while the newest backup is +stored safely on a different medium. +Always have a blank medium ready to perform a full backup in case the +update attempt fails due to insufficient remaining capacity. This +failure will not spoil the old medium, of course. + + +File: xorriso.info, Node: ExRestore, Next: ExRecovery, Prev: ExIncBackup, Up: Examples + +10.15 Restore directory trees from a particular ISO session to disk +=================================================================== + +This is an alternative to mounting the medium and using normal file +operations. +First check which backup sessions are on the medium: + +$ xorriso -outdev /dev/sr0 -toc + +Then load the desired session and copy the file trees to disk. Enable +restoring of ACL, xattr and hard links. Avoid to create +/home/thomas/restored without rwx-permission. + +$ xorriso -for_backup \ +-load volid 'PROJECTS_MAIL_2008_06_19*' \ +-indev /dev/sr0 \ +-osirrox on:auto_chmod_on \ +-chmod u+rwx / -- \ +-extract /open_source_projects \ +/home/thomas/restored/open_source_projects \ +-extract /personal_mail /home/thomas/restored/personal_mail \ +-rollback_end + +The final command -rollback_end prevents an error message about the +altered image being discarded. + + +File: xorriso.info, Node: ExRecovery, Prev: ExRestore, Up: Examples + +10.16 Try to retrieve blocks from a damaged medium +================================================== + + +$ xorriso -abort_on NEVER -indev /dev/sr0 \ +-check_media time_limit=1800 report=blocks_files \ +data_to="$HOME"/dvd_copy sector_map="$HOME"/dvd_copy.map -- + +This can be repeated several times, if necessary with -eject or with +other -indev drives. See the human readable part of +"$HOME"/dvd_copy.map for addresses which can be used on +"$HOME"/dvd_copy with mount option -o sbsector= resp. -s. + + +File: xorriso.info, Node: Files, Next: Seealso, Prev: Examples, Up: Top + +11 Files +******** + +11.1 Program Alias Names +======================== + +Normal installation of `xorriso' creates three links or copies which by +their program name pre-select certain settings: + +*xorrisofs* starts `xorriso' with -as mkisofs emulation. +*xorrecord* starts `xorriso' with -as cdrecord emulation. +*osirrox* starts with -osirrox "on:o_excl_off" which allows to copy +files from ISO image to disk and to apply option -mount to one or more +of the existing ISO sessions. + +11.2 Startup Files +================== + +If not -no_rc is given as the first argument then `xorriso' attempts on +startup to read and execute lines from the following files: + +/etc/default/xorriso +/etc/opt/xorriso/rc +/etc/xorriso/xorriso.conf +$HOME/.xorrisorc + +The files are read in the sequence given above, but none of them is +required to exist. The line format is described with command +-options_from_file. +If mkisofs emulation was enabled by program name "xorrisofs", "mkisofs", +"genisoimage", or "genisofs", then afterwards -read_mkisofsrc is +performed, which reads .mkisofsrc files. See there. + +11.3 Runtime control files +========================== + +The default setting of -check_media abort_file= is: + +/var/opt/xorriso/do_abort_check_media + +File: xorriso.info, Node: Seealso, Next: Bugreport, Prev: Files, Up: Top + +12 See also +*********** + +For the mkisofs emulation of `xorriso' + xorrisofs(1) + +For the cdrecord emulation of `xorriso' + xorrecord(1) + +For mounting `xorriso' generated ISO 9660 images (-t iso9660) + mount(8) + +Libreadline, a comfortable input line facility + readline(3) + +Other programs which produce ISO 9660 images + mkisofs(8), genisoimage(8) + +Other programs which burn sessions to optical media + growisofs(1), cdrecord(1), wodim(1), cdrskin(1) + +ACL and xattr + getfacl(1), setfacl(1), getfattr(1), setfattr(1) + +MD5 checksums + md5sum(1) + +On FreeBSD some commands differ: + getextattr(8), setextattr(8), md5(1) + + +File: xorriso.info, Node: Bugreport, Next: Legal, Prev: Seealso, Up: Top + +13 Reporting bugs +***************** + +To report bugs, request help, or suggest enhancements for `xorriso', +please send electronic mail to the public list <bug-xorriso@gnu.org>. +If more privacy is desired, mail to <scdbackup@gmx.net>. + +Please describe what you expect `xorriso' to do, the program arguments +resp. commands by which you tried to achieve it, the messages of +`xorriso', and the undesirable outcome of your program run. + +Expect to get asked more questions before solutions can be proposed. + + +File: xorriso.info, Node: Legal, Next: CommandIdx, Prev: Bugreport, Up: Top + +14 Author, Copyright, Credits +***************************** + +14.1 Author +=========== + +Thomas Schmitt <scdbackup@gmx.net> +for libburnia-project.org + +14.2 Copyright +============== + +Copyright (c) 2007 - 2011 Thomas Schmitt +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of `xorriso'. If you +make use of the license to derive modified versions of `xorriso' then +you are entitled to modify this text under that same license. + +14.3 Credits +============ + +`xorriso' is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Thanks to Andy Polyakov who invented emulated growing, to Derek Foreman +and Ben Jansens who once founded libburn. +Compliments towards Joerg Schilling whose cdrtools served me for ten +years. + + +File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top + +15 Alphabetic Command List +************************** + +�[index�] +* Menu: + +* # starts a comment line: Scripting. (line 162) +* -abort_on controls abort on error: Exception. (line 27) +* -abstract_file sets abstract file name: SetWrite. (line 160) +* -acl controls handling of ACLs: Loading. (line 142) +* -add inserts one or more paths: Insert. (line 42) +* -add_plainly inserts one or more paths: Insert. (line 61) +* -alter_date sets timestamps in ISO image: Manip. (line 147) +* -alter_date_r sets timestamps in ISO image: Manip. (line 167) +* -append_partition adds arbitrary file after image end: Bootable. + (line 199) +* -application_id sets application id: SetWrite. (line 119) +* -as emulates mkisofs or cdrecord: Emulation. (line 13) +* -assert_volid rejects undesired images: Loading. (line 83) +* -auto_charset learns character set from image: Loading. (line 97) +* -backslash_codes enables backslash conversion: Scripting. (line 67) +* -ban_stdio_write demands real drive: Loading. (line 246) +* -biblio_file sets biblio file name: SetWrite. (line 167) +* -blank erases media: Writing. (line 45) +* -boot_image controls bootability: Bootable. (line 26) +* -calm_drive reduces drive activity: Loading. (line 235) +* -cd sets working directory in ISO: Navigate. (line 7) +* -cdx sets working directory on disk: Navigate. (line 16) +* -charset sets input/output character set: Charset. (line 43) +* -check_md5 verifies file checksum: Verify. (line 147) +* -check_md5_r verifies file tree checksums: Verify. (line 163) +* -check_media reads media block by block: Verify. (line 21) +* -check_media_defaults sets -check_media options: Verify. (line 40) +* -chgrp sets group in ISO image: Manip. (line 50) +* -chgrp_r sets group in ISO image: Manip. (line 55) +* -chmod sets permissions in ISO image: Manip. (line 58) +* -chmod_r sets permissions in ISO image: Manip. (line 70) +* -chown sets ownership in ISO image: Manip. (line 42) +* -chown_r sets ownership in ISO image: Manip. (line 47) +* -clone copies ISO directory tree: Insert. (line 171) +* -close controls media closing: SetWrite. (line 262) +* -close_damaged closes damaged track and session: Writing. (line 136) +* -close_filter_list bans filter registration: Filter. (line 52) +* -commit writes pending ISO image: Writing. (line 13) +* -commit_eject writes and ejects: Writing. (line 40) +* -compare reports ISO/disk differences: Navigate. (line 146) +* -compare_l reports ISO/disk differences: Navigate. (line 164) +* -compare_r reports ISO/disk differences: Navigate. (line 159) +* -compliance controls standard compliance: SetWrite. (line 14) +* -copyright_file sets copyright file name: SetWrite. (line 154) +* -cp_clone copies ISO directory tree: Insert. (line 183) +* -cp_rx copies file trees to disk: Restore. (line 108) +* -cpax copies files to disk: Restore. (line 104) +* -cpr inserts like with cp -r: Insert. (line 152) +* -cpx copies files to disk: Restore. (line 92) +* -cut_out inserts piece of data file: Insert. (line 126) +* -dev aquires one drive for input and output: AqDrive. (line 12) +* -device_links gets list of drives: Inquiry. (line 18) +* -devices gets list of drives: Inquiry. (line 7) +* -dialog enables dialog mode: DialogCtl. (line 7) +* -disk_dev_ino fast incremental backup: Loading. (line 189) +* -disk_pattern controls pattern expansion: Insert. (line 31) +* -displacement compensate altered image start address: Loading. + (line 35) +* -drive_class controls drive accessability: Loading. (line 53) +* -du show directory size in ISO image: Navigate. (line 89) +* -dummy controls write simulation: SetWrite. (line 251) +* -dus show directory size in ISO image: Navigate. (line 93) +* -dusx show directory size on disk: Navigate. (line 102) +* -dux show directory size on disk: Navigate. (line 97) +* -dvd_obs set write block size: SetWrite. (line 238) +* -early_stdio_test classifies stdio drives: Loading. (line 251) +* -eject ejects drive tray: Writing. (line 36) +* -end writes pending session and ends program: Scripting. (line 156) +* -errfile_log logs problematic disk files: Scripting. (line 118) +* -error_behavior controls error workarounds: Exception. (line 96) +* -external_filter registers data filter: Filter. (line 20) +* -external_filter unregisters data filter: Filter. (line 48) +* -extract copies file tree to disk: Restore. (line 60) +* -extract_cut copies file piece to disk: Restore. (line 81) +* -extract_l copies files to disk: Restore. (line 76) +* -extract_single copies file to disk: Restore. (line 72) +* -file_size_limit limits data file size: SetInsert. (line 7) +* -find traverses and alters ISO tree: CmdFind. (line 7) +* -findx traverses disk tree: Navigate. (line 106) +* -follow softlinks and mount points: SetInsert. (line 76) +* -for_backup -acl,-xattr,-hardlinks,-md5: Loading. (line 184) +* -format formats media: Writing. (line 72) +* -fs sets size of fifo: SetWrite. (line 255) +* -getfacl shows ACL in ISO image: Navigate. (line 70) +* -getfacl_r shows ACL in ISO image: Navigate. (line 77) +* -getfattr shows xattr in ISO image: Navigate. (line 81) +* -getfattr_r shows xattr in ISO image: Navigate. (line 85) +* -gid sets global ownership: SetWrite. (line 195) +* -grow_blindly overides next writeable address: AqDrive. (line 46) +* -hardlinks controls handling of hard links: Loading. (line 109) +* -help prints help text: Scripting. (line 20) +* -hide excludes file names from directory trees: Manip. (line 171) +* -history brings text into readline history: Scripting. (line 44) +* -in_charset sets input character set: Loading. (line 91) +* -indev aquires a drive for input: AqDrive. (line 24) +* -iso_rr_pattern controls pattern expansion: Manip. (line 10) +* -jigdo clears JTE or or adds parameter to JTE: Jigdo. (line 33) +* -joliet enables production of Joliet tree: SetWrite. (line 10) +* -list_delimiter replaces '--': Scripting. (line 60) +* -list_extras lists compile time extra features: Scripting. + (line 26) +* -list_formats lists available formats: Writing. (line 110) +* -list_profiles lists supported media: Writing. (line 150) +* -list_speeds lists available write speeds: Writing. (line 122) +* -load addresses a particular session as input: Loading. (line 11) +* -local_charset sets terminal character set: Charset. (line 47) +* -logfile logs output channels to file: Frontend. (line 20) +* -ls lists files in ISO image: Navigate. (line 26) +* -lsd lists files in ISO image: Navigate. (line 34) +* -lsdl lists files in ISO image: Navigate. (line 47) +* -lsdlx lists files on disk: Navigate. (line 66) +* -lsdx lists files on disk: Navigate. (line 58) +* -lsl lists files in ISO image: Navigate. (line 38) +* -lslx lists files on disk: Navigate. (line 62) +* -lsx lists files on disk: Navigate. (line 51) +* -map inserts path: Insert. (line 85) +* -map_l inserts paths from disk file: Insert. (line 94) +* -map_single inserts path: Insert. (line 90) +* -mark sets synchronizing message: Frontend. (line 25) +* -md5 controls handling of MD5 sums: Loading. (line 155) +* -mkdir creates ISO directory: Insert. (line 166) +* -mount issues mount command for ISO session: Restore. (line 126) +* -mount_cmd composes mount command line: Inquiry. (line 41) +* -mount_cmd controls mount command: Inquiry. (line 57) +* -mv renames file in ISO image: Manip. (line 35) +* -no_rc disables startup files: Scripting. (line 7) +* -not_leaf sets exclusion pattern: SetInsert. (line 62) +* -not_list sets exclusions from disk file: SetInsert. (line 67) +* -not_mgt controls file exclusion: SetInsert. (line 23) +* -not_paths sets absolute exclusion paths: SetInsert. (line 55) +* -options_from_file reads commands from file: Scripting. (line 12) +* -osirrox enables ISO-to-disk copying: Restore. (line 18) +* -out_charset sets output character set: SetWrite. (line 185) +* -outdev aquires a drive for output: AqDrive. (line 31) +* -overwrite enables overwriting in ISO: SetInsert. (line 127) +* -pacifier controls pacifier text form: Emulation. (line 158) +* -padding sets amount or mode of image padding: SetWrite. (line 268) +* -page set terminal geometry: DialogCtl. (line 19) +* -paste_in copies file into disk file: Restore. (line 121) +* -path_list inserts paths from disk file: Insert. (line 75) +* -pathspecs sets meaning of = with -add: SetInsert. (line 118) +* -pkt_output consolidates text output: Frontend. (line 7) +* -preparer_id sets preparer id: SetWrite. (line 173) +* -print prints result text line: Scripting. (line 99) +* -print_info prints message text line: Scripting. (line 102) +* -print_mark prints synchronizing text line: Scripting. (line 105) +* -print_size predicts image size: Inquiry. (line 80) +* -prog sets program name: Frontend. (line 30) +* -prog_help prints help text: Frontend. (line 33) +* -prompt prompts for enter key: Scripting. (line 110) +* -publisher sets publisher id: SetWrite. (line 113) +* -pvd_info shows image id strings: Inquiry. (line 93) +* -pwd tells working directory in ISO: Navigate. (line 20) +* -pwdx tells working directory on disk: Navigate. (line 23) +* -quoted_not_list sets exclusions: SetInsert. (line 72) +* -quoted_path_list inserts paths from disk file: Insert. (line 80) +* -read_mkisofsrc searches and reads .mkisofsrc file: Emulation. + (line 146) +* -reassure enables confirmation question: DialogCtl. (line 32) +* -report_about controls verbosity: Exception. (line 55) +* -return_with controls exit value: Exception. (line 39) +* -rm deletes files from ISO image: Manip. (line 21) +* -rm_r deletes trees from ISO image: Manip. (line 28) +* -rmdir deletes ISO directory: Manip. (line 32) +* -rollback discards pending changes: Writing. (line 9) +* -rollback_end ends program without writing: Scripting. (line 159) +* -rom_toc_scan searches for sessions: Loading. (line 210) +* -scdbackup_tag enables scdbackup checksum tag: Emulation. (line 168) +* -scsi_log reports SCSI commands: Scripting. (line 147) +* -session_log logs written sessions: Scripting. (line 138) +* -session_string composes session info line: Inquiry. (line 67) +* -set_filter applies filter to file: Filter. (line 60) +* -set_filter_r applies filter to file tree: Filter. (line 85) +* -setfacl sets ACL in ISO image: Manip. (line 73) +* -setfacl_list sets ACL in ISO image: Manip. (line 101) +* -setfacl_r sets ACL in ISO image: Manip. (line 98) +* -setfattr sets xattr in ISO image: Manip. (line 111) +* -setfattr_list sets xattr in ISO image: Manip. (line 127) +* -setfattr_r sets xattr in ISO image: Manip. (line 124) +* -show_stream shows data source and filters: Navigate. (line 169) +* -show_stream_r shows data source and filters: Navigate. (line 183) +* -signal_handling controls handling of system signals: Exception. + (line 69) +* -sleep waits for a given time span: Scripting. (line 114) +* -speed set write speed: SetWrite. (line 211) +* -split_size enables large file splitting: SetInsert. (line 140) +* -status shows current settings: Scripting. (line 47) +* -status_history_max curbs -status history: Scripting. (line 56) +* -stdio_sync controls stdio buffer: SetWrite. (line 245) +* -stream_recording controls defect management: SetWrite. (line 226) +* -system_id sets system id: SetWrite. (line 128) +* -tell_media_space reports free space: Inquiry. (line 89) +* -temp_mem_limit curbs memory consumption: Scripting. (line 92) +* -toc shows list of sessions: Inquiry. (line 28) +* -uid sets global ownership: SetWrite. (line 191) +* -update inserts path if different: Insert. (line 99) +* -update_l inserts paths if different: Insert. (line 121) +* -update_r inserts paths if different: Insert. (line 110) +* -use_readline enables readline for dialog: DialogCtl. (line 28) +* -version prints help text: Scripting. (line 23) +* -volid sets volume id: SetWrite. (line 89) +* -volset_id sets volume set id: SetWrite. (line 108) +* -volume_date sets volume timestamp: SetWrite. (line 135) +* -xattr controls handling of xattr (EA): Loading. (line 150) +* -zisofs controls zisofs production: SetWrite. (line 199) + + +File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top + +16 Alphabetic List of Concepts and Objects +****************************************** + +�[index�] +* Menu: + +* ACL, _definiton: Extras. (line 38) +* ACL, control handling, -acl: Loading. (line 142) +* ACL, set in ISO image, -setfacl: Manip. (line 73) +* ACL, set in ISO image, -setfacl_list: Manip. (line 101) +* ACL, set in ISO image, -setfacl_r: Manip. (line 98) +* ACL, show in ISO image, -getfacl: Navigate. (line 70) +* ACL, show in ISO image, -getfacl_r: Navigate. (line 77) +* Appendable media, _definition: Media. (line 38) +* Appended Filesystem Image, -append_partition: Bootable. (line 199) +* Backslash Interpretation, _definition: Processing. (line 48) +* Backup, enable fast incremental, -disk_dev_ino: Loading. (line 189) +* Backup, enable features, -for_backup: Loading. (line 184) +* Backup, scdbackup checksum tag, -scdbackup: Emulation. (line 168) +* Blank media, _definition: Media. (line 29) +* Blind growing, _definition: Methods. (line 40) +* Bootability, control, -boot_image: Bootable. (line 26) +* Bugs, reporting: Bugreport. (line 6) +* cdrecord, Emulation: Emulation. (line 111) +* Character Set, _definition: Charset. (line 6) +* Character Set, for input, -in_charset: Loading. (line 91) +* Character Set, for input/output, -charset: Charset. (line 43) +* Character Set, for output, -out_charset: SetWrite. (line 185) +* Character set, learn from image, -auto_charset: Loading. (line 97) +* Character Set, of terminal, -local_charset: Charset. (line 47) +* Closed media, _definition: Media. (line 43) +* Comment, #: Scripting. (line 162) +* Control, signal handling, -signal_handling: Exception. (line 69) +* Create, new ISO image, _definiton: Methods. (line 6) +* Cylinder alignment, _definiton: Bootable. (line 167) +* Cylinder size, _definiton: Bootable. (line 156) +* Damaged track and session, close, -close_damaged: Writing. (line 136) +* Delete, from ISO image, -rm: Manip. (line 21) +* Delete, from ISO image, -rm_r: Manip. (line 28) +* Delete, ISO directory, -rmdir: Manip. (line 32) +* Dialog, bring text into history, -history: Scripting. (line 44) +* Dialog, confirmation question, -reassure: DialogCtl. (line 32) +* Dialog, enable dialog mode, -dialog: DialogCtl. (line 7) +* Dialog, line editing, -use_readline: DialogCtl. (line 28) +* Dialog, terminal geometry, -page: DialogCtl. (line 19) +* Directories, copy, -cp_clone: Insert. (line 183) +* Directory, copy, -clone: Insert. (line 171) +* Directory, create, -mkdir: Insert. (line 166) +* Directory, delete, -rmdir: Manip. (line 32) +* disk_path, _definition: Insert. (line 6) +* Drive, _definiton: Drives. (line 6) +* Drive, accessability, -drive_class: Loading. (line 53) +* Drive, classify stdio, -early_stdio_test: Loading. (line 251) +* Drive, demand real MMC, -ban_stdio_write: Loading. (line 246) +* Drive, eject tray, -eject: Writing. (line 36) +* Drive, for input and output, -dev: AqDrive. (line 12) +* Drive, for input, -indev: AqDrive. (line 24) +* Drive, for output, -outdev: AqDrive. (line 31) +* Drive, get drive list, -device_links: Inquiry. (line 18) +* Drive, get drive list, -devices: Inquiry. (line 7) +* Drive, list supported media, -list_profiles: Writing. (line 150) +* Drive, reduce activity, -calm_drive: Loading. (line 235) +* Drive, report SCSI commands, -scsi_log: Scripting. (line 147) +* Drive, write and eject, -commit_eject: Writing. (line 40) +* EA, _definiton: Extras. (line 54) +* El Torito, _definiton: Extras. (line 19) +* Emulation, -as: Emulation. (line 13) +* Emulation, .mkisofsrc, -read_mkisofsrc: Emulation. (line 146) +* Emulation, cdrecord, -as: Emulation. (line 111) +* Emulation, mkisofs, -as: Emulation. (line 16) +* Emulation, pacifier form, -pacifier: Emulation. (line 158) +* Examples: Examples. (line 6) +* extattr, _definiton: Extras. (line 54) +* Filter, _definition: Filter. (line 6) +* Filter, apply to file tree, -set_filter_r: Filter. (line 85) +* Filter, apply to file, -set_filter: Filter. (line 60) +* Filter, ban registration, -close_filter_list: Filter. (line 52) +* Filter, register, -external_filter: Filter. (line 20) +* Filter, show chain, -show_stream: Navigate. (line 169) +* Filter, show chains of tree, -show_stream_r: Navigate. (line 183) +* Filter, unregister, -unregister_filter: Filter. (line 48) +* Filter, zisofs parameters, -zisofs: SetWrite. (line 199) +* Group, global in ISO image, -gid: SetWrite. (line 195) +* Group, in ISO image, -chgrp: Manip. (line 50) +* Group, in ISO image, -chgrp_r: Manip. (line 55) +* Growing, _definition: Methods. (line 19) +* Hard links, control handling, -hardlinks: Loading. (line 109) +* hidden, set in ISO image, -hide: Manip. (line 171) +* Image, _definition: Model. (line 9) +* Image, demand volume id, -assert_volid: Loading. (line 83) +* Image, discard pending changes, -rollback: Writing. (line 9) +* Image, set abstract file name, -abstract_file: SetWrite. (line 160) +* Image, set application id, -application_id: SetWrite. (line 119) +* Image, set biblio file name, -biblio_file: SetWrite. (line 167) +* Image, set copyright file name, -copyright_file: SetWrite. (line 154) +* Image, set preparer id, -preparer_id: SetWrite. (line 173) +* Image, set publisher id, -publisher: SetWrite. (line 113) +* Image, set system id, -system_id: SetWrite. (line 128) +* Image, set volume id, -volid: SetWrite. (line 89) +* Image, set volume set id, -volset_id: SetWrite. (line 108) +* Image, set volume timestamp, -volume_date: SetWrite. (line 135) +* Image, show id strings, -pvd_info: Inquiry. (line 93) +* Insert, enable overwriting, -overwrite: SetInsert. (line 127) +* Insert, file exclusion absolute, -not_paths: SetInsert. (line 55) +* Insert, file exclusion from file, -not_list: SetInsert. (line 67) +* Insert, file exclusion pattern, -not_leaf: SetInsert. (line 62) +* Insert, file exclusion, -not_mgt: SetInsert. (line 23) +* Insert, file exclusion, -quoted_not_list: SetInsert. (line 72) +* Insert, if different, -update: Insert. (line 99) +* Insert, if different, -update_l: Insert. (line 121) +* Insert, if different, -update_r: Insert. (line 110) +* Insert, large file splitting, -split_size: SetInsert. (line 140) +* Insert, limit data file size, -file_size_limit: SetInsert. (line 7) +* Insert, links or mount points, -follow: SetInsert. (line 76) +* Insert, meaning of = with -add, -pathspecs: SetInsert. (line 118) +* Insert, non-dashed arguments, -add_plainly: Insert. (line 61) +* Insert, path, -map: Insert. (line 85) +* Insert, path, -map_single: Insert. (line 90) +* Insert, paths from disk file, -map_l: Insert. (line 94) +* Insert, paths from disk file, -path_list: Insert. (line 75) +* Insert, paths from disk file, -quoted_path_list: Insert. (line 80) +* Insert, paths, -cpr: Insert. (line 152) +* Insert, pathspecs, -add: Insert. (line 42) +* Insert, piece of data file, -cut_out: Insert. (line 126) +* iso_rr_path, _definition: Insert. (line 7) +* Jigdo Template Extraction, -jigdo: Jigdo. (line 33) +* Jigdo Template Extraction, _definition: Jigdo. (line 6) +* List delimiter, _definiton: Processing. (line 8) +* MBR, _definiton: Extras. (line 26) +* MBR, set, -boot_image system_area=: Bootable. (line 121) +* MD5, control handling, -md5: Loading. (line 155) +* Media, erase, -blank: Writing. (line 45) +* Media, format, -format: Writing. (line 72) +* Media, list formats, -list_formats: Writing. (line 110) +* Media, list write speeds, -list_speeds: Writing. (line 122) +* MIPS boot file, activation: Bootable. (line 176) +* mkisofs, Emulation: Emulation. (line 16) +* Modifying, _definition: Methods. (line 27) +* Multi-session media, _definition: Media. (line 7) +* Multi-session, _definition: Model. (line 18) +* Navigate, directory size in ISO image, -du: Navigate. (line 89) +* Navigate, directory size in ISO image, -dus: Navigate. (line 93) +* Navigate, directory size in on disk, -dusx: Navigate. (line 102) +* Navigate, directory size in on disk, -dux: Navigate. (line 97) +* Navigate, list disk files, -lsdlx: Navigate. (line 66) +* Navigate, list disk files, -lsdx: Navigate. (line 58) +* Navigate, list disk files, -lslx: Navigate. (line 62) +* Navigate, list disk files, -lsx: Navigate. (line 51) +* Navigate, list ISO files, -ls: Navigate. (line 26) +* Navigate, list ISO files, -lsd: Navigate. (line 34) +* Navigate, list ISO files, -lsdl: Navigate. (line 47) +* Navigate, list ISO files, -lsl: Navigate. (line 38) +* Navigate, set disk working directory, -cdx: Navigate. (line 16) +* Navigate, set ISO working directory, -cd: Navigate. (line 7) +* Navigate, tell disk working directory, -pwdx: Navigate. (line 23) +* Navigate, tell ISO working directory, -pwd: Navigate. (line 20) +* Next writeable address, -grow_blindly: AqDrive. (line 46) +* Overwriteable media, _definition: Media. (line 14) +* Ownership, global in ISO image, -uid: SetWrite. (line 191) +* Ownership, in ISO image, -chown: Manip. (line 42) +* Ownership, in ISO image, -chown_r: Manip. (line 47) +* Partition offset, _definiton: Bootable. (line 146) +* Partition table, _definiton: Bootable. (line 128) +* Pathspec, _definition: SetInsert. (line 120) +* Pattern expansion, _definition: Processing. (line 22) +* Pattern expansion, for disk paths, -disk_pattern: Insert. (line 31) +* Pattern expansion, for ISO paths, -iso_rr_pattern: Manip. (line 10) +* Permissions, in ISO image, -chmod: Manip. (line 58) +* Permissions, in ISO image, -chmod_r: Manip. (line 70) +* Problems, reporting: Bugreport. (line 6) +* Process, consolidate text output, -pkt_output: Frontend. (line 7) +* Process, control abort on error, -abort_on: Exception. (line 27) +* Process, control exit value, -return_with: Exception. (line 39) +* Process, control verbosity, -report_about: Exception. (line 55) +* Process, disable startup files, -no_rc: Scripting. (line 7) +* Process, end program and write, -end: Scripting. (line 156) +* Process, end program, no writing, -rollback_end: Scripting. (line 159) +* Process, error workarounds, -error_behavior: Exception. (line 96) +* Process, log output channels to file, -logfile: Frontend. (line 20) +* Process, read command file, -options_from_file: Scripting. (line 12) +* Process, set synchronizing message, -mark: Frontend. (line 25) +* Program, backslash conversion, -backslash_codes: Scripting. (line 67) +* Program, curb memory, -temp_mem_limit: Scripting. (line 92) +* Program, end and write, -end: Scripting. (line 156) +* Program, end without writing, -rollback_end: Scripting. (line 159) +* Program, list extra features, -list_extras: Scripting. (line 26) +* Program, print help text, -help: Scripting. (line 20) +* Program, print help text, -prog_help: Frontend. (line 33) +* Program, print message text line, -print_info: Scripting. (line 102) +* Program, print result text line, -print: Scripting. (line 99) +* Program, print synchronizing text line, -print_mark: Scripting. + (line 105) +* Program, print version, -version: Scripting. (line 23) +* Program, prompt for enter key, -prompt: Scripting. (line 110) +* Program, replace --, -list_delimiter: Scripting. (line 60) +* Program, set name, -prog: Frontend. (line 30) +* Program, show current settings, -status: Scripting. (line 47) +* Program, status history, -status_history_max: Scripting. (line 56) +* Program, wait a time span, -sleep: Scripting. (line 114) +* Quoted input, _definiton: Processing. (line 42) +* Recovery, retrieve blocks, -check_media: Verify. (line 21) +* Rename, in ISO image, -mv: Manip. (line 35) +* Restore, copy file into disk file, -paste_in: Restore. (line 121) +* Restore, copy file piece to disk, -extract_cut: Restore. (line 81) +* Restore, copy file to disk, -extract_single: Restore. (line 72) +* Restore, copy file tree to disk, -extract: Restore. (line 60) +* Restore, copy file trees to disk, -cp_rx: Restore. (line 108) +* Restore, copy files to disk, -cpax: Restore. (line 104) +* Restore, copy files to disk, -cpx: Restore. (line 92) +* Restore, copy files to disk, -extract_l: Restore. (line 76) +* Restore, enable ISO-to-disk, -osirrox: Restore. (line 18) +* Rock Ridge, _definiton: Extras. (line 6) +* Session, _definition: Model. (line 6) +* Session, altered start address, -displacement: Loading. (line 35) +* Session, info string, -session_string: Inquiry. (line 67) +* Session, issue mount command, -mount: Restore. (line 126) +* Session, log when written, -session_log: Scripting. (line 138) +* Session, mount command line, -mount_cmd: Inquiry. (line 41) +* Session, mount parameters, -mount_opts: Inquiry. (line 57) +* Session, select as input, -load: Loading. (line 11) +* SUN Disk Label, production: Bootable. (line 187) +* SUN SPARC boot images, activation: Bootable. (line 220) +* System area, _definiton: Bootable. (line 121) +* Table-of-content, search sessions, -rom_toc_scan: Loading. (line 210) +* Table-of-content, show, -toc: Inquiry. (line 28) +* Timestamps, set in ISO image, -alter_date: Manip. (line 147) +* Timestamps, set in ISO image, -alter_date_r: Manip. (line 167) +* Tree, disk, traverse, -findx: Navigate. (line 106) +* Tree, ISO, traverse and alter, -find: CmdFind. (line 7) +* Verify, check blocks, -check_media: Verify. (line 21) +* Verify, compare ISO and disk file, -compare: Navigate. (line 146) +* Verify, compare ISO and disk tree, -compare_r: Navigate. (line 159) +* Verify, compare ISO and disk, -compare_l: Navigate. (line 164) +* Verify, file checksum, -check_md5: Verify. (line 147) +* Verify, file tree checksums, -check_md5_r: Verify. (line 163) +* Verify, preset -check_media, -check_media_defaults: Verify. (line 40) +* Write, block size, -dvd_obs: SetWrite. (line 238) +* Write, bootability, -boot_image: Bootable. (line 26) +* Write, buffer syncing, -stdio_sync: SetWrite. (line 245) +* Write, close media, -close: SetWrite. (line 262) +* Write, compliance to specs, -compliance: SetWrite. (line 14) +* Write, defect management, -stream_recording: SetWrite. (line 226) +* Write, enable Joliet, -joliet: SetWrite. (line 10) +* Write, fifo size, -fs: SetWrite. (line 255) +* Write, free space, -tell_media_space: Inquiry. (line 89) +* Write, log problematic disk files, -errfile_log: Scripting. (line 118) +* Write, log written sessions, -session_log: Scripting. (line 138) +* Write, padding image, -padding: SetWrite. (line 268) +* Write, pending ISO image, -commit: Writing. (line 13) +* Write, predict image size, -print_size: Inquiry. (line 80) +* Write, set speed, -speed: SetWrite. (line 211) +* Write, simulation, -dummy: SetWrite. (line 251) +* xattr, _definiton: Extras. (line 54) +* xattr, control handling, -xattr: Loading. (line 150) +* xattr, set in ISO image, -setfattr: Manip. (line 111) +* xattr, set in ISO image, -setfattr_list: Manip. (line 127) +* xattr, set in ISO image, -setfattr_r: Manip. (line 124) +* xattr, show in ISO image, -getfattr: Navigate. (line 81) +* xattr, show in ISO image, -getfattr_r: Navigate. (line 85) + + + +Tag Table: +Node: Top420 +Node: Overview1375 +Node: Model3264 +Node: Media6151 +Node: Methods8817 +Node: Drives11386 +Node: Extras14699 +Node: Processing18416 +Node: Dialog21886 +Node: Options23549 +Node: AqDrive25157 +Node: Loading28194 +Node: Insert42463 +Node: SetInsert52169 +Node: Manip60737 +Node: CmdFind69467 +Node: Filter81572 +Node: Writing85910 +Node: SetWrite93911 +Node: Bootable107961 +Node: Jigdo121181 +Node: Charset125427 +Node: Exception128186 +Node: DialogCtl134299 +Node: Inquiry136886 +Node: Navigate141749 +Node: Verify150007 +Node: Restore158674 +Node: Emulation165579 +Node: Scripting175384 +Node: Frontend182549 +Node: Examples183848 +Node: ExDevices185025 +Node: ExCreate185684 +Node: ExDialog186966 +Node: ExGrowing188229 +Node: ExModifying189034 +Node: ExBootable189537 +Node: ExCharset190089 +Node: ExPseudo190909 +Node: ExCdrecord191807 +Node: ExMkisofs192124 +Node: ExGrowisofs193464 +Node: ExException194599 +Node: ExTime195053 +Node: ExIncBackup195512 +Node: ExRestore199498 +Node: ExRecovery200458 +Node: Files201028 +Node: Seealso202326 +Node: Bugreport203049 +Node: Legal203630 +Node: CommandIdx204560 +Node: ConceptIdx219656 + +End Tag Table diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso.texi b/libisoburn/branches/1.1.8/xorriso/xorriso.texi new file mode 100644 index 00000000..ef659ed5 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso.texi @@ -0,0 +1,5749 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename xorriso.info +@settitle GNU xorriso 1.1.7 +@c %**end of header +@c +@c man-ignore-lines begin +@dircategory Archiving +@direntry +* Xorriso: (xorriso). Burns ISO 9660 on CD, DVD, BD. +@end direntry +@c man-ignore-lines end +@c +@c Notes about embedded man page: +@c This texinfo code contains the necessary info to produce a man page +@c which resembles much the version of xorriso.1 from which this code +@c was originally derived in march 2010. +@c One can produce the man page by applying the following rules: +@c The first line gets discarded. +@c Line start "@c man " will become "", the remainder is put out unaltered. +@c Lines "@*" will be converted to ".br" +@c "@c man-ignore-lines N" will discard N following lines. +@c "@c man-ignore-lines begin" discards all following lines +@c up to "@c man-ignore-lines end". +@c Line blocks of "@menu" "@end menu" will be discarded. +@c "@item word words" becomes "\fBword\fR words". +@c @b{...}, @command{...}, @dfn{...}, @emph{...}, @strong{...} +@c get mapped to \fB...\fR . +@c @abbr{...}, @code{...}, @file{...}, @i{...}, @option{...}, @r{...}, +@c @ref{...}, @samp{...},@var{...}, get mapped to ... . +@c @ref{...}, @xref{...} get mapped to empty text. +@c @email{...} gets mapped to <...> . +@c Mapped {...} content is subject to the rules except {...} mapping. +@c @minus{} will become "-". +@c @@ , @{, @} will get stripped of their first @. +@c Other lines which begin by "@" will be discarded. +@c In lines not stemming from "@c man", "\" becomes "\\" +@c "-" which are not preceded by an uneven number of "\" will get +@c prepended one "\". +@c +@c +@c man .\" Hey, EMACS: -*- nroff -*- +@c man .\" +@c man .\" IMPORTANT NOTE: +@c man .\" +@c man .\" The original of this file is kept in xorriso/xorriso.texi +@c man .\" This here was generated by program xorriso/make_xorriso_1 +@c man .\" +@c man .\" +@c man .\" First parameter, NAME, should be all caps +@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +@c man .\" other parameters are allowed: see man(7), man(1) +@c man .TH XORRISO 1 "Version 1.1.7, Oct 26, 2011" +@c man .\" Please adjust this date whenever revising the manpage. +@c man .\" +@c man .\" Some roff macros, for reference: +@c man .\" .nh disable hyphenation +@c man .\" .hy enable hyphenation +@c man .\" .ad l left justify +@c man .\" .ad b justify to both left and right margins +@c man .\" .nf disable filling +@c man .\" .fi enable filling +@c man .\" .br insert line break +@c man .\" .sp <n> insert n+1 empty lines +@c man .\" for manpage-specific macros, see man(7) +@c man .nh +@c man-ignore-lines begin +@copying +xorriso - creates, loads, manipulates and writes ISO 9660 filesystem images +with Rock Ridge extensions. + +Copyright @copyright{} 2007 - 2011 Thomas Schmitt + +@quotation +Permission is granted to distrubute this text freely. +@end quotation +@end copying +@c man-ignore-lines end +@titlepage +@title Manual of GNU xorriso 1.1.7 +@author Thomas Schmitt +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents +@ifnottex +@node Top +@top GNU xorriso 1.1.7 +@c man-ignore-lines 1 + +@c man .SH NAME +xorriso - creates, loads, manipulates and writes ISO 9660 filesystem images +with Rock Ridge extensions. +@end ifnottex +@menu +* Overview:: Overview +* Model:: Session model +* Media:: Media types and states +* Methods:: Creating, Growing, Modifying, Blind Growing +* Drives:: Libburn drives +* Extras:: Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr +* Processing:: Command processing +* Dialog:: Dialog, Readline, Result pager +* Options:: Reference of commands +* Examples:: Examples +* Files:: Files +* Seealso:: See also +* Bugreport:: Reporting bugs +* Legal:: Author, Copyright, Credits +* CommandIdx:: Alphabetic Command List +* ConceptIdx:: Alphabetic List of Concepts and Objects +@end menu +@node Overview, Model, Top, Top +@chapter Overview +@c man .SH SYNOPSIS +@c man .B xorriso +@c man .RI [ settings | actions ] +@c man .br +@c man .SH DESCRIPTION +@c man .PP +@command{xorriso} +is a program which copies file objects from POSIX compliant +filesystems into Rock Ridge enhanced ISO 9660 filesystems and allows +session-wise manipulation of such filesystems. It can load the management +information of existing ISO images and it writes the session results to +optical media or to filesystem objects. +@* +Vice versa @command{xorriso} is able to copy file objects out of ISO 9660 +filesystems. +@c man .PP +@sp 1 +A special property of @command{xorriso} is that it needs neither an external +ISO 9660 +formatter program nor an external burn program for CD, DVD or BD but rather +incorporates the libraries of libburnia-project.org . +@c man .SS +@section Features +@c man .B Overview of features: +@* +Operates on an existing ISO image or creates a new one. +@* +Copies files from disk filesystem into the ISO image. +@* +Copies files from ISO image to disk filesystem (see osirrox). +@* +Renames or deletes file objects in the ISO image. +@* +Changes file properties in the ISO image. +@* +Updates ISO subtrees incrementally to match given disk subtrees. +@* +Writes result either as completely new image or as add-on session +to optical media or filesystem objects. +@* +Can activate ISOLINUX and GRUB boot images via El Torito and MBR. +@* +Can perform multi-session tasks as emulation of mkisofs and cdrecord. +@* +Can record and restore hard links and ACL. +@* +Content may get zisofs compressed or filtered by external processes. +@* +Can issue commands to mount older sessions on GNU/Linux or FreeBSD. +@* +Can check media for damages and copy readable blocks to disk. +@* +Can attach MD5 checksums to each data file and the whole session. +@* +Scans for optical drives, blanks re-useable optical media. +@* +Reads its instructions from command line arguments, dialog, and files. +@* +Provides navigation commands for interactive ISO image manipulation. +@* +Adjustable thresholds for abort, exit value, and problem reporting. +@c man .SS +@c man .B General information paragraphs: +@c man .br +@c man Session model +@c man .br +@c man Media types and states +@c man .br +@c man Creating, Growing, Modifying, Blind Growing +@c man .br +@c man Libburn drives +@c man .br +@c man Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr +@c man .br +@c man Command processing +@c man .br +@c man Dialog, Readline, Result pager +@c man .sp 1 +@c man Maybe you first want to have a look at section EXAMPLES near the end of +@c man this text before reading the next few hundred lines of background information. +@c man .SS +@node Model, Media, Overview, Top +@chapter Session model +@c man \fBSession model:\fR +@c man .br +@cindex Session, _definition +Unlike other filesystems, ISO 9660 is not intended for read-write operation but +rather for being generated in a single sweep and being written to media as a +@strong{session}. +@* +@cindex Image, _definition +The data content of the session is called filesystem @strong{image}. +@c man .PP +@sp 1 +The written image in its session can then be mounted by the operating system +for being used read-only. GNU/Linux is able to mount ISO images from block +devices, which may represent optical media, other media or via a loop device +even from regular disk files. FreeBSD mounts ISO images from devices that +represent arbitrary media or from regular disk files. +@c man .PP +@sp 1 +@cindex Multi-session, _definition +This session usage model has been extended on CD media by the concept of +@strong{multi-session} , +which allows to add information to the CD and gives the mount programs +of the operating systems the addresses of the entry points of each +session. The mount programs recognize block devices which represent +CD media and will by default mount the image in the last session. +@* +This session usually contains an updated directory tree for the whole medium +which governs the data contents in all recorded sessions. +So in the view of the mount program all sessions of a particular medium +together form a single filesystem image. +@* +Adding a session to an existing ISO image is in this text referred as +@strong{growing}. +@* +The multi-session model of the MMC standard does not apply to all media +types. But program growisofs by Andy Polyakov showed how to extend this +functionality to overwriteable media or disk files which carry valid ISO 9660 +filesystems. +@c man .PP +@sp 1 +@command{xorriso} provides growing as well as an own method named +@strong{modifying} which produces a completely new ISO image from the old +one and the modifications. +See paragraph Creating, Growing, Modifying, Blind Growing below. +@c man .PP +@sp 1 +@command{xorriso} adopts the concept of multi-session by loading an +image directory tree if present, +by allowing to manipulate it by several actions, +and by writing the new image to the target medium. +@c man .br +The first session of a @command{xorriso} run begins by the definition of +the input drive with the ISO image or by the definition of an output drive. +The session ends by command -commit which triggers writing. A -commit is +done automatically when the program ends regularly. +@c man .PP +@sp 1 +After -commit a new session begins with the freshly written one as input. +A new input drive can only be chosen as long as the loaded ISO image was +not altered. Pending alteration can be revoked by command -rollback. +@c man .PP +@sp 1 +Writing a session to the target is supposed to be very expensive in terms of +time and of consumed space on appendable or write-once media. Therefore all +intended manipulations of a particular ISO image should be done in a single +session. But in principle it is possible +to store intermediate states and to continue with image manipulations. +@c man .SS +@node Media, Methods, Model, top +@chapter Media types and states +@c man .B Media types and states: +There are two families of media in the MMC standard: +@* +@cindex Multi-session media, _definition +@strong{Multi-session media} are CD-R, CD-RW, DVD-R, DVD+R, DVD+R/DL, BD-R, and +unformatted DVD-RW. These media provide a table of content which +describes their existing sessions. See option @strong{-toc}. +@* +Similar to multi-session media are DVD-R DL and minimally blanked DVD-RW. +They allow only a single session of which the size must be known in advance. +@command{xorriso} will write onto them only if option -close is set to "on". +@* +@cindex Overwriteable media, _definition +@strong{Overwriteable media} are DVD-RAM, DVD+RW, BD-RE, and formatted DVD-RW. +They allow random write access but do not provide information about their +session history. If they contain one or more ISO 9660 sessions and if the +first session was written by @command{xorriso}, then a table of content can +be emulated. Else only a single overall session will be visible. +@* +DVD-RW media can be formatted by -format "full". +They can be made unformatted by -blank "deformat". +@* +Regular files and block devices are handled as overwriteable media. +Pipes and other writeable file types are handled as blank multi-session media. +@c man .PP +@sp 1 +These media can assume several states in which they offer different +capabilities. +@* +@sp 1 +@cindex Blank media, _definition +@strong{Blank} media can be written from scratch. They contain no ISO image +suitable for @command{xorriso}. +@* +Blank is the state of newly purchased optical media. +With used CD-RW and DVD-RW it can be achieved by action -blank "as_needed". +Overwriteable media are considered blank if they are new or if they have +been marked as blank by @command{xorriso}. +Action -blank "as_needed" can be used to do this marking on overwriteable +media, or to apply mandatory formatting to new media if necessary. +@* +@sp 1 +@cindex Appendable media, _definition +@strong{Appendable} media accept further sessions. Either they are MMC +multi-session media in appendable state, or they are overwriteable media +which contain an ISO image suitable for @command{xorriso}. +@* +Appendable is the state after writing a session with option -close off. +@* +@sp 1 +@cindex Closed media, _definition +@strong{Closed} media cannot be written. They may contain an ISO image suitable +for @command{xorriso}. +@* +Closed is the state of DVD-ROM media and of multi-session media which were +written with option -close on. If the drive is read-only hardware then it will +probably show any media as closed CD-ROM resp. DVD-ROM. +@* +Overwriteable media assume this state in such read-only drives or if they +contain unrecognizable data in the first 32 data blocks. +@* +Read-only drives may or may not show session histories of multi-session +media. Often only the first and the last session are visible. Sometimes +not even that. Option -rom_toc_scan might or might not help in such cases. +@c man .SS +@node Methods, Drives, Media, top +@chapter Creating, Growing, Modifying, Blind Growing: +@c man .B Creating, Growing, Modifying, Blind Growing: +@* +@cindex Create, new ISO image, _definiton +A new empty ISO image gets @strong{created} +if there is no input drive with a valid ISO 9660 image when the first time +an output drive is defined. This is achieved by option -dev on blank media +or by option -outdev on media in any state. +@* +The new empty image can be populated with directories and files. +Before it can be written, the medium in the output drive must get into +blank state if it was not blank already. +@c man .PP +@sp 1 +If there is a input drive with a valid ISO image, then this image gets loaded +as foundation for manipulations and extension. The constellation of input +and output drive determines which write method will be used. +They have quite different capabilities and constraints. +@c man .PP +@sp 1 +@cindex Growing, _definition +The method of @strong{growing} adds new data to the existing data on the +medium. These data comprise of new file content and they override the existing +ISO 9660 + Rock Ridge directory tree. It is possible to hide files from +previous sessions but they still exist on the medium and with many types of +optical media it is quite easy to recover them by mounting older sessions. +@* +Growing is achieved by option -dev. +@c man .PP +@sp 1 +@cindex Modifying, _definition +The write method of @strong{modifying} produces compact filesystem +images with no outdated files or directory trees. Modifying can write its +images to target media which are completely unsuitable for multi-session +operations. E.g. DVD-RW which were treated with -blank deformat_quickest, +DVD-R DL, named pipes, character devices, sockets. +On the other hand modified sessions cannot be written to appendable media +but to blank media only. +@* +So for this method one needs either two optical drives or has to work with +filesystem objects as source and/or target medium. +@* +Modifying takes place if input drive and output drive are not the same and +if option -grow_blindly is set to its default "off". +This is achieved by options -indev and -outdev. +@c man .PP +@sp 1 +@cindex Blind growing, _definition +If option -grow_blindly is set to a non-negative number and if -indev and +-outdev are both set to different drives, then @strong{blind growing} is +performed. It produces an add-on session which is ready for being written +to the given block address. This is the usage model of +@* + mkisofs -M $indev -C $msc1,$msc2 -o $outdev +@* +which gives much room for wrong parameter combinations and should thus only be +employed if a strict distinction between ISO formatter @command{xorriso} +and the burn program is desired. -C $msc1,$msc2 is equivalent to: +@* + -load sbsector $msc1 -grow_blindly $msc2 +@c man .SS +@node Drives, Extras, Methods, top +@chapter Libburn drives +@c man .B Libburn drives: +@c man .br +@cindex Drive, _definiton +Input drive, i.e. source of an existing or empty ISO image, can be any random +access readable libburn drive: optical media with readable data, +blank optical media, regular files, block devices. +@c man .PP +@sp 1 +Output drive, i.e. target for writing, can be any libburn drive. +Some drive types do not support the method of growing but only the methods +of modifying and blind growing. They all are suitable for newly created images. +@* +All drive file objects have to offer rw-permission to the user of +@command{xorriso}. +Even those which will not be useable for reading an ISO image. +@c man .PP +@sp 1 +MMC compliant (i.e. optical) drives on GNU/Linux usually get addressed by +the path of their block device or of their generic character device. E.g. +@* + -dev /dev/sr0 +@* + -dev /dev/hdc +@* + -dev /dev/sg2 +@* +On FreeBSD the device files have names like +@* + -dev /dev/cd0 +@* +On OpenSolaris: +@* + -dev /dev/rdsk/c4t0d0s2 +@* +Get a list of accessible drives by command +@* + -device_links +@* +It might be necessary to do this as +@strong{superuser} +in order to see all drives and to then allow rw-access for the intended users. +Consider to bundle the authorized users in a group like old "floppy". +@c man .PP +@sp 1 +Filesystem objects of nearly any type can be addressed by prefix "stdio:" and +their path in the filesystem. E.g.: +@* + -dev stdio:/dev/sdc +@* +The default setting of -drive_class allows to address files outside the +/dev tree without that prefix. E.g.: +@* + -dev /tmp/pseudo_drive +@* +If path leads to a regular file or to a block device then the emulated drive +is random access readable and can be used for the method of growing if it +already contains a valid ISO 9660 image. Any other file type is not readable +via "stdio:" and can only be used as target for the method of modifying or +blind growing. +Non-existing paths in existing directories are handled as empty regular files. +@c man .PP +@sp 1 +A very special kind of pseudo drive are open file descriptors. They are +depicted by "stdio:/dev/fd/" and descriptor number (see man 2 open). +@* +Addresses "-" or "stdio:/dev/fd/1" depict standard output, which normally is +the output channel for result texts. +To prevent a fatal intermingling of ISO image and text messages, all result +texts get redirected to stderr if -*dev "-" or "stdio:/dev/fd/1" is among +the start arguments of the program. +@* +Standard output is currently suitable for creating one session +per program run without dialog. Use in other situations is discouraged +and several restrictions apply: +@* +It is not allowed to use standard output as pseudo drive if it was not +among the start arguments. Do not try to fool this ban via backdoor addresses +to stdout. +@* +If stdout is used as drive, then -use_readline is permanently disabled. +Use of backdoors can cause severe memory and/or tty corruption. +@c man .PP +@sp 1 +Be aware that especially the superuser can write into any accessible file or +device by using its path with the "stdio:" prefix. By default any address +in the /dev tree without prefix "stdio:" will work only if it leads to a MMC +drive. +@* +One may use option +@strong{-ban_stdio_write} +to surely prevent this risk and to allow only MMC drives. +@* +One may prepend "mmc:" to a path to surely disallow any automatic "stdio:". +@c man .br +By option -drive_class one may ban certain paths or allow access without +prefix "stdio:" to other paths. +@c man .SS +@node Extras, Processing, Drives, top +@chapter Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr +@c man .B Rock Ridge, POSIX, X/Open, El Torito, ACL, xattr: +@c man .br +@cindex Rock Ridge, _definiton +@strong{Rock Ridge} +is the name of a set of additional information which enhance +an ISO 9660 filesystem so that it can represent a POSIX compliant filesystem +with ownership, access permissions, symbolic links, and other attributes. +@* +This is what @command{xorriso} uses for a decent representation of the disk +files within the ISO image. Rock Ridge information is produced with any +@command{xorriso} image. +@c man .PP +@sp 1 +@command{xorriso} is not named "porriso" because POSIX only guarantees +14 characters +of filename length. It is the X/Open System Interface standard XSI which +demands a file name length of up to 255 characters and paths of up to 1024 +characters. Rock Ridge fulfills this demand. +@c man .PP +@sp 1 +@cindex El Torito, _definiton +An @strong{El Torito} +boot record points the BIOS bootstrapping facility to one or more boot +images, which are binary program files stored in the ISO image. +The content of the boot image files is not in the scope of El Torito. +@* +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images. +@command{xorriso} is able to create or maintain an El Torito object which +makes such an image bootable. For details see option -boot_image. +@* +@cindex MBR, _definiton +It is possible to make ISO images bootable from USB stick or other +hard-disk-like media by -boot_image argument system_area= . This installs +a Master Boot Record which may get adjusted according to the needs +of GRUB resp. ISOLINUX. +An @strong{MBR} contains boot code and a partition table. It does not hamper +CDROM booting. The new MBR of a follow-up session can get in effect +only on overwriteable media. +@* +Emulation -as mkisofs supports the example options out of the ISOLINUX wiki, +the options used in GRUB script grub-mkrescue, and the example in the +FreeBSD AvgLiveCD wiki. +@* +There is support for boot facilities other than PC BIOS: +EFI, MIPS Big Endian (SGI), MIPS Little Endian (DEC), SUN SPARC. +@* +@c man .PP +@sp 1 +@cindex ACL, _definiton +@strong{ACL} +are an advanced way of controlling access permissions to file objects. Neither +ISO 9660 nor Rock Ridge specify a way to record ACLs. So libisofs has +introduced a standard conformant extension named AAIP for that purpose. +It uses this extension if enabled by option +@strong{-acl}. +@* +AAIP enhanced images are supposed to be mountable normally, but one cannot +expect that the mounted filesystem will show and respect the ACLs. +For now, only @command{xorriso} is able to retrieve those ACLs. +It can bring them into +effect when files get restored to an ACL enabled file system or it can +print them in a format suitable for tool setfacl. +@* +Files with ACL show as group permissions the setting of entry "mask::" if +that entry exists. Nevertheless the non-listed group members get handled +according to entry "group::". When removing ACL from a file, +@command{xorriso} brings "group::" into effect. +@* +Recording and restoring of ACLs from and to local files works currently +only on GNU/Linux and FreeBSD. +@c man .PP +@sp 1 +@cindex xattr, _definiton +@cindex EA, _definiton +@cindex extattr, _definiton +@strong{xattr} (aka EA, or extattr) +are pairs of name and value which can be attached to file objects. AAIP is +able to represent them and @command{xorriso} allows to record and restore +pairs which +have names out of the user namespace. I.e. those which begin with "user.", +like "user.x" or "user.whatever". Name has to be a 0 terminated string. +Value may be any array of bytes which does not exceed the size of 4095 bytes. +xattr processing happens only if it is enabled by option +@strong{-xattr}. +@* +As with ACL, currently only @command{xorriso} is able to retrieve xattr +from AAIP enhanced images, to restore them to xattr capable file systems, +or to print them. +@* +Recording and restoring of xattr from and to local files works currently +only on GNU/Linux and FreeBSD, where they are known as extattr. +@c man .SS +@node Processing, Dialog, Extras, top +@chapter Command processing +@c man .B Command processing: +@c man .br +Commands are either actions which happen immediately or settings which +influence following actions. So their sequence does matter. +@* +@cindex List delimiter, _definiton +Commands consist of a command word, +followed by zero or more parameter words. If the list of parameter words +is of variable length (indicated by "[...]" or "[***]") then it has to be +terminated by either the @strong{list delimiter}, or the end of argument list, +or an end of an input line. +@c man .PP +@sp 1 +At program start the list delimiter is the word "@minus{}@minus{}". +This may be changed by option -list_delimiter in order to allow +"@minus{}@minus{}" as argument in a list of variable length. +It is advised to reset the delimiter to "@minus{}@minus{}" immediately +afterwards. +@* +For brevity the list delimiter is referred as "@minus{}@minus{}" +throughout this text. +@* +The list delimiter is silently tolerated if it appears after the parameters of +a command with a fixed list length. It is handled as normal text if it +appears among the arguments of such a command. +@c man .PP +@sp 1 +@cindex Pattern expansion, _definition +@strong{Pattern expansion} +converts a list of pattern words into a list of existing file addresses. +Unmatched pattern words appear themselves in that result list, though. +@* +Pattern matching supports the usual shell parser wildcards '*' '?' '[xyz]' +and respects '/' as separator which may only be matched literally. +@* +It is a property of some particular commands and not a general +feature. It gets controlled by commands -iso_rr_pattern and -disk_pattern. +Commands which may use pattern expansion all have variable argument +lists which are marked in this man page by "[***]" rather than "[...]". +@* +Some other commands perform pattern matching unconditionally. +@c man .PP +@sp 1 +Command and parameter words are either read from program arguments, where one +argument is one word, or from quoted input lines where words are recognized +similar to the quotation rules of a shell parser. +@* +@command{xorriso} is not a shell, although it might appear so on first glimpse. +Be aware that the interaction of quotation marks and pattern symbols like "*" +differs from the usual shell parsers. In @command{xorriso}, a quotation mark +does not make a pattern symbol literal. +@c man .PP +@sp 1 +@cindex Quoted input, _definiton +@strong{Quoted input} +converts whitespace separated text pieces into words. +The double quotation mark " and the single quotation mark ' can be used to +enclose whitespace and make it part of words (e.g. of file names). Each mark +type can enclose the marks of the other type. A trailing backslash \ outside +quotations or an open quotation cause the next input line to be appended. +@* +@cindex Backslash Interpretation, _definition +Quoted input accepts any ASCII character except NUL (0) as content of quotes. +Nevertheless it can be cumbersome for the user to produce those characters +at all. Therefore quoted input and program arguments allow optional +@strong{Backslash Interpretation} +which can represent all ASCII characters except NUL (0) by backslash codes +as in $'...' of bash. +@* +It is not enabled by default. See option -backslash_codes. +@c man .PP +@sp 1 +When the program starts then it first looks for argument -no_rc. If this is +not present then it looks for its startup files and +reads their content as command input lines. Then it interprets +the program arguments as commands and parameters. Finally it enters +dialog mode if command -dialog "on" was executed up to then. +@c man .PP +@sp 1 +The program ends either by command -end, or by the end of program arguments +if not dialog was enabled up to that moment, or by a problem +event which triggers the threshold of command -abort_on. +@c man .SS +@node Dialog, Options, Processing, top +@chapter Dialog, Readline, Result pager +@c man .B Dialog, Readline, Result pager: +@c man .br +Dialog mode prompts for a quoted input line, parses it into words, and performs +them as commands with their parameters. It provides assisting services +to make dialog more comfortable. +@c man .PP +@sp 1 +Readline is an enhancement for the input line. You may know it already from +the bash shell. Whether it is available in @command{xorriso} depends on the +availability +of package readline-dev at the time when @command{xorriso} was built from +its sourcecode. +@* +It allows to move the cursor over the text in the line by help of the +Leftward and the Rightward arrow key. +Text may be inserted at the cursor position. The Delete key removes the +character under the cursor. Upward and Downward arrow keys navigate through +the history of previous input lines. +@* +@c man-ignore-lines 1 +See info readline +@c man See man readline +for more info about libreadline. +@c man .PP +@sp 1 +Option -page activates a built-in result text pager which may be convenient in +dialog. After an action has put out the given number of terminal lines, +the pager prompts the user for a line of input. +@* +An empty line lets @command{xorriso} resume work until the next page is put out. +@* +The single character "@@" disables paging for the current action. +@* +"@@@@@@", "x", "q", "X", or "Q" urge the current action to abort and suppress +further result output. +@* +Any other line will be interpreted as new dialog line. The current action +is urged to abort. Afterwards, the input line is executed. +@c man .PP +@sp 1 +Some actions apply paging to their info output, too. +@* +The urge to abort may or may not be obeyed by the current action. All actions +try to abort as soon as possible. +@node Options, Examples, Dialog, top +@chapter Options +@c man .br +@c man .SH OPTIONS +@c man .br +All command words are shown with a leading dash although this dash is not +mandatory for the option to be recognized. Nevertheless within option -as +the dashes of the emulated options are mandatory. +@* +Normally any number of leading dashes is ignored with command words and +inner dashes are interpreted as underscores. +@menu +* AqDrive:: Aquiring source and target drive +* Loading:: Influencing the behavior of image loading +* Insert:: Inserting files into ISO image +* SetInsert:: Settings for file insertion +* Manip:: File manipulations +* CmdFind:: Tree traversal command -find +* Filter:: Filters for data file content +* Writing:: Writing the result, drive control +* SetWrite:: Settings for result writing +* Bootable:: Bootable ISO images +* Jigdo:: Jigdo Template Extraction +* Charset:: Character sets +* Exception:: Exception processing +* DialogCtl:: Dialog mode control +* Inquiry:: Drive and media related inquiry actions +* Navigate:: Navigation in ISO image and disk filesystem +* Verify:: Evaluation of readability and recovery +* Restore:: osirrox ISO-to-disk restore options +* Emulation:: Command compatibility emulations (cdrtools) +* Scripting:: Scripting, dialog and program control features +* Frontend:: Support for frontend programs via stdin and stdout +@end menu +@c man .TP +@node AqDrive, Loading, Options, Options +@section Aquiring source and target drive +@c man .B Aquiring source and target drive: +@c man .PP +The effect of aquiring a drive may depend on several options in the +next paragraph "Influencing the behavior of image loading". +If desired, their enabling commands have to be performed before the +commands which aquire the drive. +@table @asis +@sp 1 +@c man .TP +@item -dev address +@kindex -dev aquires one drive for input and output +@cindex Drive, for input and output, -dev +Set input and output drive to the same address and load an ISO image if it +is present. +If there is no ISO image then create a blank one. +Set the image expansion method to growing. +@* +This is only allowed as long as no changes are pending in the currently +loaded ISO image. If changes are pending, then one has to perform -commit +or -rollback first. +@* +Special address string "-" means standard output, to which several restrictions +apply. See above paragraph "Libburn drives". +@* +An empty address string "" gives up the current device +without aquiring a new one. +@c man .TP +@item -indev address +@kindex -indev aquires a drive for input +@cindex Drive, for input, -indev +Set input drive and load an ISO image if present. +If the new input drive differs +from -outdev then switch from growing to modifying or to blind growing. +It depends on the setting of -grow_blindly which of both gets activated. +The same rules and restrictions apply as with -dev. +@c man .TP +@item -outdev address +@kindex -outdev aquires a drive for output +@cindex Drive, for output, -outdev +Set output drive and if it differs from the input drive then switch from +growing to modifying or to blind growing. Unlike -dev and -indev this action +does not load a new ISO image. So it can be performed even if there are pending +changes. +@* +-outdev can be performed without previous -dev or -indev. In that case an +empty ISO image with no changes pending is created. It can either be populated +by help of -map, -add et.al. or it can be discarded silently if -dev or -indev +are performed afterwards. +@* +Special address string "-" means standard output, to which several restrictions +apply. See above paragraph "Libburn drives". +@* +An empty address string "" gives up the current output drive +without aquiring a new one. No writing is possible without an output drive. +@c man .TP +@item -grow_blindly "off"|predicted_nwa +@kindex -grow_blindly overides next writeable address +@cindex Next writeable address, -grow_blindly +If predicted_nwa is a non-negative number then perform blind growing rather +than modifying if -indev and -outdev are set to different drives. +"off" or "-1" switch to modifying, which is the default. +@* +predicted_nwa is the block address where the add-on session of blind +growing will finally end up. It is the responsibility of the user to ensure +this final position and the presence of the older sessions. Else the +overall ISO image will not be mountable or will produce read errors when +accessing file content. @command{xorriso} will write the session to the address +as obtained from examining -outdev and not necessarily to predicted_nwa. +@* +During a run of blind growing, the input drive is given up before output +begins. The output drive is given up when writing is done. +@end table +@c man .TP +@c man .B Influencing the behavior of image loading: +@node Loading, Insert, AqDrive, Options +@section Influencing the behavior of image loading +@c man .PP +The following options should normally be performed before loading an image +by aquiring an input drive. In rare cases it is desirable to activate +them only after image loading. +@table @asis +@sp 1 +@c man .TP +@item -load entity id +@kindex -load addresses a particular session as input +@cindex Session, select as input, -load +Load a particular (possibly outdated) ISO session from -dev or -indev. +Usually all available sessions are shown with option -toc. +@* +entity depicts the kind of addressing. id depicts the particular +address. The following entities are defined: +@* +"auto" with any id addresses the last session in -toc. This is the default. +@* +"session" with id being a number as of a line "ISO session", column "Idx". +@* +"track" with id being a number as of a line "ISO track", column "Idx". +@* +"lba" or "sbsector" with a number as of a line "ISO ...", column "sbsector". +@* +"volid" with a search pattern for a text as of a line "ISO ...", +column "Volume Id". +@* +Adressing a non-existing entity or one which does not represent an ISO +image will either abandon -indev or at least lead to a blank image. +@* +If an input drive is set at the moment when -load is executed, then the +addressed ISO image is loaded immediately. Else, the setting will be pending +until the next -dev or -indev. After the image has been loaded once, the +setting is valid for -rollback until next -dev or -indev, where it +will be reset to "auto". +@c man .TP +@item -displacement [-]lba +@kindex -displacement compensate altered image start address +@cindex Session, altered start address, -displacement +Compensate a displacement of the image versus the start address +for which the image was prepared. This affects only loading of ISO images +and reading of their files. The multi-session method of growing is not allowed +as long as -displacement is non-zero. I.e. -indev and -outdev must be +different. The displacement gets reset to 0 before the drive +gets re-aquired after writing. +@* +Examples: +@* +If a track of a CD starts at block 123456 and gets copied to a disk file +where it begins at block 0, then this copy can be loaded with +-displacement -123456. +@* +If an ISO image was written onto a partition with offset of 640000 blocks of +512 bytes, then it can be loaded from the base device by -displacement 160000. +@* +In both cases, the ISO sessions should be self contained, i.e. not add-on +sessions to an ISO image outside their track resp. partition. +@c man .TP +@item -drive_class "harmless"|"banned"|"caution"|"clear_list" disk_pattern +@kindex -drive_class controls drive accessability +@cindex Drive, accessability, -drive_class +Add a drive path pattern to one of the safety lists or make those lists empty. +There are three lists defined which get tested in the following sequence: +@* +If a drive address path matches the "harmless" list then the drive will be +accepted. If it is not a MMC device then the prefix "stdio:" will be prepended +automatically. This list is empty by default. +@* +Else if the path matches the "banned" list then the drive will not be +accepted by @command{xorriso} but rather lead to a FAILURE event. +This list is empty by default. +@* +Else if the path matches the "caution" list and if it is not a MMC device, +then its address must have the prefix "stdio:" or it will be rejected. +This list has by default one entry: "/dev". +@* +If a drive path matches no list then it is considered "harmless". By default +these are all paths which do not begin with directory "/dev". +@* +A path matches a list if one of its parent paths or itself matches a list +entry. Address prefix "stdio:" or "mmc:" will be ignored when +testing for matches. +@* +By pseudo-class "clear_list" and pseudo-patterns "banned", "caution", +"harmless", or "all", the lists may be made empty. +@* +E.g.: -drive_class clear_list banned +@* +One will normally define the -drive_class lists in one of the @command{xorriso} +Startup Files. +@* +Note: This is not a security feature but rather a bumper for the superuser to +prevent inadverted mishaps. For reliably blocking access to a device file you +have to deny its rw-permissions in the filesystem. +@c man .TP +@item -assert_volid pattern severity +@kindex -assert_volid rejects undesired images +@cindex Image, demand volume id, -assert_volid +Refuse to load ISO images with volume ids which do not match the given +search pattern. When refusing an image, give up the input drive and issue +an event of the given severity (like FAILURE, see -abort_on). An empty search +pattern accepts any image. +@* +This option does not hamper the creation of an empty image from blank +input media and does not discard an already loaded image. +@c man .TP +@item -in_charset character_set_name +@kindex -in_charset sets input character set +@cindex Character Set, for input, -in_charset +Set the character set from which to convert file names when loading an +image. See paragraph "Character sets" for more explanations. +When loading the written image after -commit the setting of -out_charset +will be copied to -in_charset. +@c man .TP +@item -auto_charset "on"|"off" +@kindex -auto_charset learns character set from image +@cindex Character set, learn from image, -auto_charset +Enable or disable recording and interpretation of the output character +set name in an xattr attribute of the image root directory. If enabled and +if a recorded character set name is found, then this name will be used as +namoe of the input character set when reading an image. +@* +Note that the default output charset is the local character set of the +terminal where @command{xorriso} runs. Before attributing this local +character set +to the produced ISO image, check whether the terminal properly displays +all intended filenames, especially exotic national characters. +@c man .TP +@item -hardlinks mode[:mode...] +@kindex -hardlinks controls handling of hard links +@cindex Hard links, control handling, -hardlinks +Enable or disable loading and recording of hardlink relations. +@* +In default mode "off", iso_rr files lose their inode numbers at image load +time. Each iso_rr file object which has no inode number at image generation +time will get a new unique inode number if -compliance is set to new_rr. +@* +Mode "on" preserves inode numbers from the loaded image if such numbers +were recorded. +When committing a session it searches for families of iso_rr files +which stem from the same disk file, have identical content filtering and have +identical properties. The family members all get the same inode number. +Whether these numbers are respected at mount time depends on the operating +system. +@* +Commands -update and -update_r track splits and fusions of hard links in +filesystems which have stable device and inode numbers. This can cause +automatic last minute changes before the session gets written. Command +-hardlinks "perform_update" may be used to do these changes earlier, +e.g. if you need to apply filters to all updated files. +@* +Mode "without_update" avoids hardlink processing during update commands. +Use this if your filesystem situation does not allow -disk_dev_ino "on". +@* +@command{xorriso} commands which extract files from an ISO image try to +hardlink files +with identical inode number. The normal scope of this operation is from +image load to image load. One may give up the accumulated hard link addresses +by -hardlinks "discard_extract". +@* +A large number of hardlink families may exhaust -temp_mem_limit +if not -osirrox "sort_lba_on" and -hardlinks "cheap_sorted_extract" +are both in effect. This restricts hard linking to other files restored by +the same single extract command. -hardlinks "normal_extract" re-enables +wide and expensive hardlink accumulation. +@* +@c man .TP +@item -acl "on"|"off" +@kindex -acl controls handling of ACLs +@cindex ACL, control handling, -acl +Enable or disable processing of ACLs. +If enabled, then @command{xorriso} will obtain ACLs from disk file objects, +store ACLs in the ISO image using the libisofs specific AAIP format, +load AAIP data from ISO images, test ACL during file comparison, +and restore ACLs to disk files when extracting them from ISO images. +See also options -getfacl, -setfacl. +@c man .TP +@item -xattr "on"|"off" +@kindex -xattr controls handling of xattr (EA) +@cindex xattr, control handling, -xattr +Enable or disable processing of xattr attributes in user namespace. +If enabled, then @command{xorriso} will handle xattr similar to ACL. +See also options -getfattr, -setfattr and above paragraph about xattr. +@c man .TP +@item -md5 "on"|"all"|"off"|"load_check_off" +@kindex -md5 controls handling of MD5 sums +@cindex MD5, control handling, -md5 +Enable or disable processing of MD5 checksums for the overall session and for +each single data file. If enabled then images with checksum tags get loaded +only if the tags of superblock and directory tree match properly. The MD5 +checksums of data files and whole session get loaded from the image if there +are any. +@* +With options -compare and -update the recorded MD5 of a file +will be used to avoid content reading from the image. Only the disk file +content will be read and compared with that MD5. This can save much time +if -disk_dev_ino "on" is not suitable. +@* +At image generation time they are computed for each file which gets its data +written into the new session. The checksums of files which have their data +in older sessions get copied into the new session. Superblock, tree and whole +session get a checksum tag each. +@* +Mode "all" will additionally check during image generation whether the checksum +of a data file changed between the time when its reading began and the time +when it ended. This implies reading every file twice. +@* +Mode "load_check_off" together with "on" or "all" will load recorded MD5 sums +but not test the recorded checksum tags of superblock and directory tree. +This is necessary if growisofs was used as burn program, because it does +not overwrite the superblock checksum tag of the first session. +Therefore load_check_off is in effect when @command{xorriso} -as mkisofs +option -M is performed. +@* +The test can be re-enabled by mode "load_check_on". +@* +Checksums can be exploited via options -check_md5, -check_md5_r, via find +actions get_md5, check_md5, and via -check_media. +@c man .TP +@item -for_backup +@kindex -for_backup -acl,-xattr,-hardlinks,-md5 +@cindex Backup, enable features, -for_backup +Enable all extra features which help to produce or to restore backups with +highest fidelity of file properties. +Currently this is a shortcut for: -hardlinks on -acl on -xattr on -md5 on. +@c man .TP +@item -disk_dev_ino "on"|"ino_only"|"off" +@kindex -disk_dev_ino fast incremental backup +@cindex Backup, enable fast incremental, -disk_dev_ino +Enable or disable processing of recorded file identification numbers +(dev_t and ino_t). If enabled they are stored as xattr and allow +to substantially accelerate file comparison. The root node gets a global start +timestamp. If during comparison a file with younger timestamps is found in the +ISO image, then it is suspected to have inconsistent content. +@* +If device numbers and inode numbers of the disk filesystems are persistent +and if no irregular alterations of timestamps or system clock happen, +then potential content changes can be detected without reading that content. +File content change is assumed if any of mtime, ctime, device number or inode +number have changed. +@* +Mode "ino_only" replaces the precondition that device numbers are stable by the +precondition that mount points in the compared tree always lead to the +same filesystems. Use this if mode "on" always sees all files changed. +@* +The speed advantage appears only if the loaded session was produced with +-disk_dev_ino "on" too. +@* +Note that -disk_dev_ino "off" is totally in effect only if -hardlinks is "off", +too. +@c man .TP +@item -rom_toc_scan "on"|"force"|"off"[:"emul_on"|"emul_off"] +@kindex -rom_toc_scan searches for sessions +@cindex Table-of-content, search sessions, -rom_toc_scan +Read-only drives do not tell the actual media type but show any media as +ROM (e.g. as DVD-ROM). The session history of MMC multi-session media might +be truncated to first and last session or even be completely false. +(The emulated history of overwriteable media is not affected by this.) +@* +To have in case of failure a chance of getting the session history and +especially the address of the last session, there is a scan for ISO 9660 +filesystem headers which might help but also might yield worse results +than the drive's table of content. At its end it can cause read attempts +to invalid addresses and thus ugly drive behavior. +Setting "on" enables that scan for alleged read-only media. +@* +Some operating systems are not able to mount the most recent session of +multi-session DVD or BD. If on such a system @command{xorriso} has no own MMC +capabilities then it may still find that session from a scanned table of +content. Setting "force" handles any media like a ROM medium with setting "on". +@* +On the other hand the emulation of session history on overwriteable media +can hamper reading of partly damaged media. Setting "off:emul_off" disables +the elsewise trustworthy table-of-content scan for those media. +@* +To be in effect, the -rom_toc_scan setting has to be made before the -*dev +command which aquires drive and medium. +@c man .TP +@item -calm_drive "in"|"out"|"all"|"revoke"|"on"|"off" +@kindex -calm_drive reduces drive activity +@cindex Drive, reduce activity, -calm_drive +Reduce drive noise until it is actually used again. Some drives stay alert +for substantial time after they have been used for reading. This reduces +the startup time for the next drive operation but can be loud and waste +energy if no i/o with the drive is expected to happen soon. +@* +Modes "in", "out", "all" immediately calm down -indev, -outdev, resp. both. +Mode "revoke" immediately alerts both. +Mode "on" causes -calm_drive to be performed automatically after each -dev, +-indev, and -outdev. Mode "off" disables this. +@c man .TP +@item -ban_stdio_write +@kindex -ban_stdio_write demands real drive +@cindex Drive, demand real MMC, -ban_stdio_write +Allow for writing only the usage of MMC optical drives. Disallow +to write the result into files of nearly arbitrary type. +Once set, this command cannot be revoked. +@c man .TP +@item -early_stdio_test "on"|"appendable_wo"|"off" +@kindex -early_stdio_test classifies stdio drives +@cindex Drive, classify stdio, -early_stdio_test +If enabled by "on" then regular files and block devices get tested for +effective access permissions. This implies to try opening those files for +writing, which otherwise will happen only later and only if actual +writing is desired. +@* +The test result is used for classifying the pseudo drives as overwriteable, +read-only, write-only, or uselessly empty. This may lead to earlier detection +of severe problems, and may avoid some less severe error events. +@* +Mode "appendable_wo" is like "on" with the additional property that +non-empty write-only files are regarded as appendable rather than blank. +@end table +@c man .TP +@c man .B Inserting files into ISO image: +@node Insert, SetInsert, Loading, Options +@section Inserting files into ISO image +@c man .PP +The following commands expect file addresses of two kinds: +@c man .br +@cindex disk_path, _definition +@strong{disk_path} +is a path to an object in the local filesystem tree. +@c man .br +@cindex iso_rr_path, _definition +@strong{iso_rr_path} +is the Rock Ridge name of a file object in the ISO image. (Do not +confuse with the lowlevel ISO 9660 names visible if Rock Ridge gets ignored.) +@c man .PP +@sp 1 +Note that in the ISO image you are as powerful as the superuser. Access +permissions of the existing files in the image do not apply to your write +operations. They are intended to be in effect with the read-only mounted image. +@c man .PP +@sp 1 +If the iso_rr_path of a newly inserted file leads to an existing +file object in the ISO image, then the following collision handling +happens: +@* +If both objects are directories then they get merged by recursively inserting +the subobjects from filesystem into ISO image. +If other file types collide then the setting of command +@strong{-overwrite} +decides. +@* +Renaming of files has similar collision handling, but directories can only +be replaced, not merged. Note that if the target directory exists, then -mv +inserts the source objects into this directory rather than attempting +to replace it. +@c man .PP +@sp 1 +The commands in this section alter the ISO image and not the local filesystem. +@table @asis +@sp 1 +@c man .TP +@item -disk_pattern "on"|"ls"|"off" +@kindex -disk_pattern controls pattern expansion +@cindex Pattern expansion, for disk paths, -disk_pattern +Set the pattern expansion mode for the disk_path arguments of several +commands which support this feature. +@* +Setting "off" disables this feature for all commands which are marked in this +man page by "disk_path [***]" or "disk_pattern [***]". +@* +Setting "on" enables it for all those commands. +@* +Setting "ls" enables it only for those which are marked by +"disk_pattern [***]". +@* +Default is "ls". +@c man .TP +@item -add pathspec [...] | disk_path [***] +@kindex -add inserts one or more paths +@cindex Insert, pathspecs, -add +Insert the given files or directory trees from filesystem +into the ISO image. +@* +If -pathspecs is set to "on" then pattern expansion is always disabled and +character '=' has a special meaning. It separates the ISO image path +from the disk path: +@* +iso_rr_path=disk_path +@* +The separator '=' can be escaped by '\'. +If iso_rr_path does not begin with '/' then -cd is prepended. +If disk_path does not begin with '/' then -cdx is prepended. +@* +If no '=' is given then the word is used as both, iso_rr_path and disk path. +If in this case the word does not begin with '/' then -cdx is prepended to +the disk_path and -cd is prepended to the iso_rr_path. +@* +If -pathspecs is set to "off" then -disk_pattern expansion applies, if enabled. +The resulting words are used as both, iso_rr_path and disk path. Relative +path words get prepended the setting of -cdx to disk_path and the setting +of -cd to iso_rr_path. +@c man .TP +@item -add_plainly mode +@kindex -add_plainly inserts one or more paths +@cindex Insert, non-dashed arguments, -add_plainly +If set to mode "unknown" then any command word that does not begin with "-" and +is not recognized as known command will be subject to a virtual -add command. +I.e. it will be used as pathspec or as disk_path and added to the image. +If enabled, -disk_pattern expansion applies to disk_paths. +@* +Mode "dashed" is similar to "unknown" but also adds unrecognized command +words even if they begin with "-". +@* +Mode "any" announces that all further words are to be added as pathspecs +or disk_paths. This does not work in dialog mode. +@* +Mode "none" is the default. It prevents any words from being understood +as files to add, if they are not parameters to appropriate commands. +@c man .TP +@item -path_list disk_path +@kindex -path_list inserts paths from disk file +@cindex Insert, paths from disk file, -path_list +Like -add but read the parameter words from file disk_path +or standard input if disk_path is "-". +The list must contain exactly one pathspec resp. disk_path pattern per line. +@c man .TP +@item -quoted_path_list disk_path +@kindex -quoted_path_list inserts paths from disk file +@cindex Insert, paths from disk file, -quoted_path_list +Like -path_list but with quoted input reading rules. Lines get split into +parameter words for -add. Whitespace outside quotes is discarded. +@c man .TP +@item -map disk_path iso_rr_path +@kindex -map inserts path +@cindex Insert, path, -map +Insert file object disk_path into the ISO image as iso_rr_path. If disk_path +is a directory then its whole sub tree is inserted into the ISO image. +@c man .TP +@item -map_single disk_path iso_rr_path +@kindex -map_single inserts path +@cindex Insert, path, -map_single +Like -map, but if disk_path is a directory then its sub tree is not inserted. +@c man .TP +@item -map_l disk_prefix iso_rr_prefix disk_path [***] +@kindex -map_l inserts paths from disk file +@cindex Insert, paths from disk file, -map_l +Perform -map with each of the disk_path arguments. iso_rr_path will be +composed from disk_path by replacing disk_prefix by iso_rr_prefix. +@c man .TP +@item -update disk_path iso_rr_path +@kindex -update inserts path if different +@cindex Insert, if different, -update +Compare file object disk_path with file object iso_rr_path. If they do not +match, then perform the necessary image manipulations to make iso_rr_path +a matching copy of disk_path. By default this comparison will imply lengthy +content reading before a decision is made. Options -disk_dev_ino or -md5 may +accelerate comparison if they were already in effect when the loaded session +was recorded. +@* +If disk_path is a directory and iso_rr_path does not exist yet, then the +whole subtree will be inserted. Else only directory attributes will be +updated. +@c man .TP +@item -update_r disk_path iso_rr_path +@kindex -update_r inserts paths if different +@cindex Insert, if different, -update_r +Like -update but working recursively. I.e. all file objects below both +addresses get compared whether they have counterparts below the other address +and whether both counterparts match. If there is a mismatch then the necessary +update manipulation is done. +@* +Note that the comparison result may depend on option -follow. Its setting +should always be the same as with the first adding of disk_path as iso_rr_path. +@* +If iso_rr_path does not exist yet, then it gets added. If disk_path does not +exist, then iso_rr_path gets deleted. +@c man .TP +@item -update_l disk_prefix iso_rr_prefix disk_path [***] +@kindex -update_l inserts paths if different +@cindex Insert, if different, -update_l +Perform -update_r with each of the disk_path arguments. iso_rr_path will be +composed from disk_path by replacing disk_prefix by iso_rr_prefix. +@c man .TP +@item -cut_out disk_path byte_offset byte_count iso_rr_path +@kindex -cut_out inserts piece of data file +@cindex Insert, piece of data file, -cut_out +Map a byte interval of a regular disk file into a regular file in the ISO +image. +This may be necessary if the disk file is larger than a single medium, or if +it exceeds the traditional limit of 2 GiB - 1 for old operating systems, +or the limit of 4 GiB - 1 for newer ones. Only the newest Linux kernels +seem to read properly files >= 4 GiB - 1. +@* +A clumsy remedy for this limit is to backup file pieces and to concatenate +them at restore time. A well tested chopping size is 2047m. +It is permissible to request a higher byte_count than available. The +resulting file will be truncated to the correct size of a final piece. +To request a byte_offset higher than available yields no file in +the ISO image but a SORRY event. +E.g: +@* + -cut_out /my/disk/file 0 2047m \ +@* + /file/part_1_of_3_at_0_with_2047m_of_5753194821 \ +@* + -cut_out /my/disk/file 2047m 2047m \ +@* + /file/part_2_of_3_at_2047m_with_2047m_of_5753194821 \ +@* + -cut_out /my/disk/file 4094m 2047m \ +@* + /file/part_3_of_3_at_4094m_with_2047m_of_5753194821 +@* +While option -split_size is set larger than 0, and if all pieces of a file +reside in the same ISO directory with no other files, and if the names look +like above, then their ISO directory will be recognized and handled like a +regular file. This affects options -compare*, -update*, and overwrite +situations. +See option -split_size for details. +@c man .TP +@item -cpr disk_path [***] iso_rr_path +@kindex -cpr inserts like with cp -r +@cindex Insert, paths, -cpr +Insert the given files or directory trees from filesystem +into the ISO image. +@* +The rules for generating the ISO addresses are similar as with +shell command cp -r. Nevertheless, directories of the iso_rr_path +are created if necessary. Especially a not yet existing iso_rr_path +will be handled as directory if multiple disk_paths are present. +The leafnames of the multiple disk_paths will be grafted under that +directory as would be done with an existing directory. +@* +If a single disk_path is present then a non-existing iso_rr_path will +get the same type as the disk_path. +@* +If a disk_path does not begin with '/' then -cdx is prepended. +If the iso_rr_path does not begin with '/' then -cd is prepended. +@c man .TP +@item -mkdir iso_rr_path [...] +@kindex -mkdir creates ISO directory +@cindex Directory, create, -mkdir +Create empty directories if they do not exist yet. +Existence as directory generates a WARNING event, existence as +other file causes a FAILURE event. +@c man .TP +@item -clone iso_rr_path_original iso_rr_path_copy +@kindex -clone copies ISO directory tree +@cindex Directory, copy, -clone +Create a copy of the ISO file object iso_rr_path_original with the new +address iso_rr_path_copy. If the original is a directory then copy all +files and directories underneath. If iso_rr_path_original is a boot catalog +file, then it gets not copied but is silently ignored. +@* +The copied ISO file objects have the same attributes. Copied data files +refer to the same content source as their originals. +The copies may then be manipulated independendly of their originals. +@* +This command will refuse execution if the address iso_rr_path_copy +already exists in the ISO tree. +@c man .TP +@item -cp_clone iso_rr_path_original [***] iso_rr_path_dest +@kindex -cp_clone copies ISO directory tree +@cindex Directories, copy, -cp_clone +Create copies of one or more ISO file objects as with command -clone. +In case of collision merge directories with existing ones, but do not overwrite +existing ISO file objects. +@* +The rules for generating the copy addresses are the same as with +command -cpr (see above) resp. shell command cp -r. Other than with -cpr, +relative iso_rr_path_original will get prepended the -cd path and not +the -cdx path. Consider to -mkdir iso_rr_path_dest before -cp_clone +so the copy address does not depend on the number of iso_rr_path_original +arguments. +@end table +@c man .TP +@c man .B Settings for file insertion: +@node SetInsert, Manip, Insert, Options +@section Settings for file insertion +@c man .TP +@table @asis +@item -file_size_limit value [value [...]] @minus{}@minus{} +@kindex -file_size_limit limits data file size +@cindex Insert, limit data file size, -file_size_limit +Set the maximum permissible size for a single data file. The values get +summed up for the actual limit. If the only value is "off" then the file +size is not limited by @command{xorriso}. +Default is a limit of 100 extents, 4g -2k each: +@* + -file_size_limit 400g -200k @minus{}@minus{} +@* +When mounting ISO 9660 filesystems, old operating systems can handle only files +up to 2g -1 @minus{}@minus{}. Newer ones are good up to 4g -1 @minus{}@minus{}. +You need quite a new Linux kernel to read correctly the final bytes +of a file >= 4g if its size is not aligned to 2048 byte blocks. +@* +@command{xorriso}'s own data read capabilities are not affected by +operating system size limits. Such limits apply to mounting only. Nevertheless, +the target filesystem of an -extract must be able to take the file size. +@c man .TP +@item -not_mgt code[:code[...]] +@kindex -not_mgt controls file exclusion +@cindex Insert, file exclusion, -not_mgt +Control the behavior of the exclusion lists. +@* +Exclusion processing happens before disk_paths get mapped to the ISO image +and before disk files get compared with image files. +The absolute disk path of the source is matched against the -not_paths list. +The leafname of the disk path is matched against the patterns in the -not_leaf +list. If a match is detected then the disk path will not be regarded as an +existing file and not be added to the ISO image. +@* +Several codes are defined. +The _on/_off settings persist until they are revoked by their_off/_on +counterparts. +@* +"erase" empties the lists which were accumulated by -not_paths and -not_leaf. +@* +"reset" is like "erase" but also re-installs default behavior. +@* +"off" disables exclusion processing temporarily without invalidating +the lists and settings. +@* +"on" re-enables exclusion processing. +@* +"param_off" applies exclusion processing only to paths below disk_path +parameter of commands. I.e. explicitly given disk_paths are exempted +from exclusion processing. +@* +"param_on" applies exclusion processing to command parameters as well as +to files below such parameters. +@* +"subtree_off" with "param_on" excludes parameter paths only if they +match a -not_paths item exactly. +@* +"subtree_on" additionally excludes parameter paths which lead to a file +address below any -not_paths item. +@* +"ignore_off" treats excluded disk files as if they were missing. I.e. they +get reported with -compare and deleted from the image with -update. +@* +"ignore_on" keeps excluded files out of -compare or -update activities. +@c man .TP +@item -not_paths disk_path [***] +@kindex -not_paths sets absolute exclusion paths +@cindex Insert, file exclusion absolute, -not_paths +Add the given paths to the list of excluded absolute disk paths. If a given +path is relative, then the current -cdx is prepended to form an absolute path. +Pattern matching, if enabled, happens at definition time and not when exclusion +checks are made. +@* +(Do not forget to end the list of disk_paths by "@minus{}@minus{}") +@c man .TP +@item -not_leaf pattern +@kindex -not_leaf sets exclusion pattern +@cindex Insert, file exclusion pattern, -not_leaf +Add a single shell parser style pattern to the list of exclusions for +disk leafnames. These patterns are evaluated when the exclusion checks are +made. +@c man .TP +@item -not_list disk_path +@kindex -not_list sets exclusions from disk file +@cindex Insert, file exclusion from file, -not_list +Read lines from disk_path and use each of them either as -not_paths argument, +if they contain a / character, or as -not_leaf pattern. +@c man .TP +@item -quoted_not_list disk_path +@kindex -quoted_not_list sets exclusions +@cindex Insert, file exclusion, -quoted_not_list +Like -not_list but with quoted input reading rules. Each word is +handled as one argument for -not_paths resp. -not_leaf. +@c man .TP +@item -follow occasion[:occasion[...]] +@kindex -follow softlinks and mount points +@cindex Insert, links or mount points, -follow +Enable or disable resolution of symbolic links and mountpoints under +disk_paths. This applies to actions -add, -du*x, -ls*x, -findx, +and to -disk_pattern expansion. +@* +There are two kinds of follow decisison to be made: +@* +"link" is the hop from a symbolic link to its target file object. +If enabled then symbolic links are handled as their target file objects, +else symbolic links are handled as themselves. +@* +"mount" is the hop from one filesystem to another subordinate filesystem. +If enabled then mountpoint directories are handled as any other directory, +else mountpoints are handled as empty directories if they are encountered in +directory tree traversals. +@* +Less general than above occasions: +@* +"pattern" is mount and link hopping, but only during -disk_pattern expansion. +@* +"param" is link hopping for parameter words (after eventual pattern expansion). +If enabled then -ls*x will show the link targets rather than the links +themselves. -du*x, -findx, and -add will process the link targets but not +follow links in an eventual directory tree below the targets (unless "link" +is enabled). +@* +Occasions can be combined in a colon separated list. All occasions +mentioned in the list will then lead to a positive follow decision. +@* +"off" prevents any positive follow decision. Use it if no other occasion +applies. +@* +Shortcuts: +@* +"default" is equivalent to "pattern:mount:limit=100". +@* +"on" always decides positive. Equivalent to "link:mount". +@* +@sp 1 + +Not an occasion but an optional setting is: +@* +"limit="<number> which sets the maximum number of link hops. +A link hop consists of a sequence of symbolic links and a final target +of different type. Nevertheless those hops can loop. Example: +@* + $ ln -s .. uploop +@* +Link hopping has a built-in loop detection which stops hopping at the first +repetition of a link target. Then the repeated link is handled as itself +and not as its target. +Regrettably one can construct link networks which +cause exponential workload before their loops get detected. +The number given with "limit=" can curb this workload at the risk of truncating +an intentional sequence of link hops. +@c man .TP +@item -pathspecs "on"|"off" +@kindex -pathspecs sets meaning of = with -add +@cindex Insert, meaning of = with -add, -pathspecs +Control parameter interpretation with @command{xorriso} +actions -add and -path_list. +@* +@cindex Pathspec, _definition +"on" enables pathspecs of the form +@strong{target=source} +like with program mkisofs -graft-points. +It also disables -disk_pattern expansion for command -add. +@* +"off" disables pathspecs of the form target=source +and re-enables -disk_pattern expansion. +@c man .TP +@item -overwrite "on"|"nondir"|"off" +@kindex -overwrite enables overwriting in ISO +@cindex Insert, enable overwriting, -overwrite +Allow or disallow to overwrite existing files in the +ISO image by files with the same name. +@* +With setting "off", name collisions cause FAILURE events. +With setting "nondir", only directories are protected by such events, other +existing file types get treated with -rm before the new file gets added. +Setting "on" allows automatic -rm_r. I.e. a non-directory can replace an +existing directory and all its subordinates. +@* +If restoring of files is enabled, then the overwrite rule applies to the +target file objects on disk as well, but "on" is downgraded to "nondir". +@c man .TP +@item -split_size number["k"|"m"] +@kindex -split_size enables large file splitting +@cindex Insert, large file splitting, -split_size +Set the threshold for automatic splitting of regular files. Such splitting +maps a large disk file onto a ISO directory with several part files in it. +This is necessary if the size of the disk file exceeds -file_size_limit. +Older operating systems can handle files in mounted ISO 9660 filesystems +only if they are smaller than 2 GiB resp. 4 GiB. +@* +Default is 0 which will exclude files larger than -file_size_limit by a +FAILURE event. +A well tested -split_size is 2047m. Sizes above -file_size_limit are not +permissible. +@* +While option -split_size is set larger than 0 such a directory with split +file pieces will be recognized and handled like a regular file by options +-compare* , -update*, and in overwrite situations. There are -ossirox +options "concat_split_on" and "concat_split_off" which control the handling +when files get restored to disk. +@* +In order to be recognizable, the names of the part files have to +describe the splitting by 5 numbers: +@* + part_number,total_parts,byte_offset,byte_count,disk_file_size +@* +which are embedded in the following text form: +@* + part_#_of_#_at_#_with_#_of_# +@* +Scaling characters like "m" or "k" are taken into respect. +All digits are interpreted as decimal, even if leading zeros are present. +@* +E.g: /file/part_1_of_3_at_0_with_2047m_of_5753194821 +@* +No other files are allowed in the directory. All parts have to be present and +their numbers have to be plausible. E.g. byte_count must be valid as -cut_out +argument and their contents may not overlap. +@end table +@c man .TP +@c man .B File manipulations: +@node Manip, CmdFind, SetInsert, Options +@section File manipulations +@c man .PP +The following commands manipulate files in the ISO image, regardless whether +they stem from the loaded image or were newly inserted. +@c man .PP +@table @asis +@sp 1 +@c man .TP +@item -iso_rr_pattern "on"|"ls"|"off" +@kindex -iso_rr_pattern controls pattern expansion +@cindex Pattern expansion, for ISO paths, -iso_rr_pattern +Set the pattern expansion mode for the iso_rr_path arguments of several +commands which support this feature. +@* +Setting "off" disables pattern expansion for all commands which are marked +in this man page by "iso_rr_path [***]" or "iso_rr_pattern [***]". +@* +Setting "on" enables it for all those commands. +@* +Setting "ls" enables it only for those which are marked by +"iso_rr_pattern [***]". +@* +Default is "on". +@c man .TP +@item -rm iso_rr_path [***] +@kindex -rm deletes files from ISO image +@cindex Delete, from ISO image, -rm +Delete the given files from the ISO image. +@* +Note: This does not free any space on the -indev medium, even if +the deletion is committed to that same medium. +@* +The image size will shrink if the image is written to a different +medium in modification mode. +@c man .TP +@item -rm_r iso_rr_path [***] +@kindex -rm_r deletes trees from ISO image +@cindex Delete, from ISO image, -rm_r +Delete the given files or directory trees from the ISO image. +See also the note with option -rm. +@c man .TP +@item -rmdir iso_rr_path [***] +@kindex -rmdir deletes ISO directory +@cindex Delete, ISO directory, -rmdir +@cindex Directory, delete, -rmdir +Delete empty directories. +@c man .TP +@item -mv iso_rr_path [***] iso_rr_path +@kindex -mv renames file in ISO image +@cindex Rename, in ISO image, -mv +Rename the given file objects in the ISO tree to the last +argument in the list. Use the same rules as with shell command mv. +@* +If pattern expansion is enabled and if the last argument contains wildcard +characters then it must match exactly one existing file address, or else the +command fails with a FAILURE event. +@c man .TP +@item -chown uid iso_rr_path [***] +@kindex -chown sets ownership in ISO image +@cindex Ownership, in ISO image, -chown +Set ownership of file objects in the ISO image. uid may either be a decimal +number or the name of a user known to the operating system. +@c man .TP +@item -chown_r uid iso_rr_path [***] +@kindex -chown_r sets ownership in ISO image +@cindex Ownership, in ISO image, -chown_r +Like -chown but affecting all files below eventual directories. +@c man .TP +@item -chgrp gid iso_rr_path [***] +@kindex -chgrp sets group in ISO image +@cindex Group, in ISO image, -chgrp +Set group attribute of file objects in the ISO image. gid may either be a +decimal number or the name of a group known to the operating system. +@c man .TP +@item -chgrp_r gid iso_rr_path [***] +@kindex -chgrp_r sets group in ISO image +@cindex Group, in ISO image, -chgrp_r +Like -chgrp but affecting all files below eventual directories. +@c man .TP +@item -chmod mode iso_rr_path [***] +@kindex -chmod sets permissions in ISO image +@cindex Permissions, in ISO image, -chmod +Equivalent to shell command chmod in the ISO image. +mode is either an octal number beginning with "0" or a comma separated +list of statements of the form [ugoa]*[+-=][rwxst]* . +@* +Like: go-rwx,u+rwx . +@* +@strong{Personalities}: +u=user, g=group, o=others, a=all +@* +@strong{Operators}: ++ adds given permissions, - revokes given permissions, += revokes all old permissions and then adds the given ones. +@* +@strong{Permissions}: +r=read, w=write, x=execute|inspect, s=setuid|setgid, t=sticky bit +@* +For octal numbers see man 2 stat. +@c man .TP +@item -chmod_r mode iso_rr_path [***] +@kindex -chmod_r sets permissions in ISO image +@cindex Permissions, in ISO image, -chmod_r +Like -chmod but affecting all files below eventual directories. +@c man .TP +@item -setfacl acl_text iso_rr_path [***] +@kindex -setfacl sets ACL in ISO image +@cindex ACL, set in ISO image, -setfacl +Attach the given ACL to the given iso_rr_paths. If the files already have +ACLs, then those get deleted before the new ones get into effect. +If acl_text is empty, or contains the text "clear" or the text +"@minus{}@minus{}remove-all", +then the existing ACLs will be removed and no new ones will be +attached. Any other content of acl_text will be interpreted as a list of +ACL entries. It may be in the long multi-line format as put out by -getfacl +but may also be abbreviated as follows: +@* +ACL entries are separated by comma or newline. If an entry is empty text or +begins with "#" then it will be ignored. A valid entry has to begin +by a letter out of @{ugom@} for "user", "group", "other", "mask". It has to +contain two colons ":". A non-empty text between those ":" gives a user id +resp. group id. After the second ":" there may be letters out of @{rwx- #@}. +The first three give read, write resp. execute permission. +Letters "-", " " and TAB are ignored. "#" causes the rest of the entry to +be ignored. Letter "X" or any other letters are not supported. Examples: +@* + g:toolies:rw,u:lisa:rw,u:1001:rw,u::wr,g::r,o::r,m::rw +@* + group:toolies:rw@minus{},user::rw@minus{},group::r@minus{}@minus{},other::r@minus{}@minus{},mask::rw@minus{} +@* +A valid entry may be prefixed by "d", some following characters and ":". +This indicates that the entry goes to the "default" ACL rather than to the +"access" ACL. Example: +@* + u::rwx,g::rx,o::,d:u::rwx,d:g::rx,d:o::,d:u:lisa:rwx,d:m::rwx +@c man .TP +@item -setfacl_r acl_text iso_rr_path [***] +@kindex -setfacl_r sets ACL in ISO image +@cindex ACL, set in ISO image, -setfacl_r +Like -setfacl but affecting all files below eventual directories. +@c man .TP +@item -setfacl_list disk_path +@kindex -setfacl_list sets ACL in ISO image +@cindex ACL, set in ISO image, -setfacl_list +Read the output of -getfacl_r or shell command getfacl -R and apply it to the +iso_rr_paths as given in lines beginning with "# file:". This will change +ownership, group and ACL of the given files. +If disk_path is "-" then lines are read from standard input. Line "@@" ends the +list, "@@@@@@" aborts without changing the pending iso_rr_path. +@* +Since -getfacl and getfacl -R strip leading "/" from file paths, the setting of +-cd does always matter. +@c man .TP +@item -setfattr [-]name value iso_rr_path [***] +@kindex -setfattr sets xattr in ISO image +@cindex xattr, set in ISO image, -setfattr +Attach the given xattr pair of name and value to the given iso_rr_paths. +If the given name is prefixed by "-", then the pair with that name gets +removed from the xattr list. If name is "@minus{}@minus{}remove@minus{}all" +then all user namespace +xattr of the given iso_rr_paths get deleted. In case of deletion, value must +be an empty text. +@* +Only names from the user namespace are allowed. I.e. a name has to begin with +"user.", like "user.x" or "user.whatever". +@* +Values and names undergo the normal input processing of @command{xorriso}. +See also option -backslash_codes. Other than with option -setfattr_list, +the byte value 0 cannot be expressed via -setfattr. +@c man .TP +@item -setfattr_r [-]name value iso_rr_path [***] +@kindex -setfattr_r sets xattr in ISO image +@cindex xattr, set in ISO image, -setfattr_r +Like -setfattr but affecting all files below eventual directories. +@c man .TP +@item -setfattr_list disk_path +@kindex -setfattr_list sets xattr in ISO image +@cindex xattr, set in ISO image, -setfattr_list +Read the output of -getfattr_r or shell command getfattr -Rd and apply it to +the iso_rr_paths as given in lines beginning with "# file:". All previously +existing user space xattr of the given iso_rr_paths will be deleted. +If disk_path is "-" then lines are read from standard input. +@* +Since -getfattr and getfattr -Rd strip leading "/" from file paths, the setting +of -cd does always matter. +@* +Empty input lines and lines which begin by "#" will be ignored +(except "# file:"). Line "@@" ends the list, "@@@@@@" aborts without changing +the pending iso_rr_path. Other input lines must have the form +@* + name="value" +@* +Name must be from user namespace. I.e. user.xyz where xyz should consist of +printable characters only. The separator "=" is not allowed in names. +Value may contain any kind of bytes. It must be in quotes. Trailing +whitespace after the end quote will be ignored. Non-printables bytes and quotes +must be represented as \XYZ by their octal ASCII code XYZ. +Use code \000 for 0-bytes. +@c man .TP +@item -alter_date type timestring iso_rr_path [***] +@kindex -alter_date sets timestamps in ISO image +@cindex Timestamps, set in ISO image, -alter_date +Alter the date entries of a file in the ISO image. type is +one of "a", "m", "b" for access time, modification time, +both times. +@* +timestring may be in the following formats +(see also section EXAMPLES): +@* +As expected by program date: + MMDDhhmm[[CC]YY][.ss]] +@* +As produced by program date: +@* + [Day] MMM DD hh:mm:ss [TZON] YYYY +@* +Relative times counted from current clock time: +@* + +|-Number["s"|"h"|"d"|"w"|"m"|"y"] +@* +where "s" means seconds, "h" hours, "d" days, "w" weeks, "m"=30d, +"y"=365.25d plus 1d added to multiplication result. +@* +Absolute seconds counted from Jan 1 1970: +@* + =Number +@* +@command{xorriso}'s own timestamps: +@* + YYYY.MM.DD[.hh[mm[ss]]] +@* +scdbackup timestamps: +@* + YYMMDD[.hhmm[ss]] +@* +where "A0" is year 2000, "B0" is 2010, etc. +@c man .TP +@item -alter_date_r type timestring iso_rr_path [***] +@kindex -alter_date_r sets timestamps in ISO image +@cindex Timestamps, set in ISO image, -alter_date_r +Like -alter_date but affecting all files below eventual directories. +@c man .TP +@item -hide hide_state iso_rr_path [***] +@kindex -hide excludes file names from directory trees +@cindex hidden, set in ISO image, -hide +Prevent the names of the given files from showing up in the directory trees +of ISO 9660 and/or Joliet when the image gets written. +The data content of such hidden files will be included in the +resulting image, even if they do not show up in any directory. +But you will need own means to find nameless data in the image. +@* +Warning: Data which are hidden from the ISO 9660 tree will not be copied +by the write method of modifying. +@* +Possible values of hide_state are: "iso_rr" for hiding from ISO 9660 tree, +"joliet" for Joliet tree, "on" for both trees. "off" means visibility in +both directory trees. +@* +This command does not apply to the boot catalog. +Rather use: -boot_image "any" "cat_hidden=on" +@end table +@c man .TP +@c man .B Tree traversal command -find: +@node CmdFind, Filter, Manip, Options +@section Tree traversal command -find +@c man .PP +@table @asis +@c man .TP +@item -find iso_rr_path [test [op] [test ...]] [-exec action [params]] @minus{}@minus{} +@kindex -find traverses and alters ISO tree +@cindex Tree, ISO, traverse and alter, -find +A restricted substitute for shell command find in the ISO image. +It performs an action on matching file objects at or below iso_rr_path. +@* +If not used as last command in the line then the argument list +needs to get terminated by "@minus{}@minus{}". +@* +Tests are optional. If they are omitted then action is applied to all file +objects. If tests are given then they form together an expression. +The action is applied only if the expression matches the file object. Default +expression operator between tests is -and, i.e. the expression matches only +if all its tests match. +@* +Available tests are: +@* +@table @asis +@sp 1 +@item -name pattern : +Matches if pattern matches the file leaf name. +@* +@item -wholename pattern : +Matches if pattern matches the file path as it would be printed by action +"echo". Character '/' is not special but can be matched by wildcards. +@* +@item -disk_name pattern : +Like -name but testing the leaf name of the file source on disk. +Can be true only for data files which stem not from the loaded image. +@* +@item -type type_letter : +Matches files of the given type: +"block", "char", "dir", "pipe", "file", "link", "socket", "eltorito", +and "Xotic" which matches what is not matched by the other types. +@* +Only the first letter is interpreted. E.g.: -find / -type d +@* +@item -damaged : +Matches files which use data blocks marked as damaged by a previous +run of -check_media. The damage info vanishes when a new ISO image gets +loaded. +@* +Note that a MD5 session mismatch marks all files of the session as damaged. +If finer distinction is desired, perform -md5 off before -check_media. +@* +@item -pending_data : +Matches files which get their content from outside the loaded ISO image. +@* +@item -lba_range start_lba block_count : +Matches files which use data blocks within the range of start_lba +and start_lba+block_count-1. +@* +@item -has_acl : +Matches files which have a non-trivial ACL. +@* +@item -has_xattr : +Matches files which have xattr name-value pairs from user namespace. +@* +@item -has_aaip : +Matches files which have ACL or any xattr. +@* +@item -has_any_xattr : +Matches files which have any xattr other than ACL. +@* +@item -has_md5 : +Matches data files which have MD5 checksums. +@* +@item -has_filter : +Matches files which are filtered by -set_filter. +@* +@item -hidden hide_state : +Matches files which are hidden in "iso_rr" tree, in "joliet" tree, +in both trees ("on"), or not hidden in any tree ("off"). +Those which are hidden in some tree match -not -hidden "off". +@* +@item -prune : +If this test is reached and the tested file is a directory then -find will not +dive into that directory. This test itself does always match. +@* +@item -decision "yes"|"no" : +If this test is reached then the evaluation ends immediately and action +is performed if the decision is "yes" or "true". See operator -if. +@* +@c man \fB\-true\fR and \fB\-false\fR : +@c man-ignore-lines 1 +@item -true and -false : +Always match resp. match not. Evaluation goes on. +@* +@item -sort_lba : +Always match. This causes -find to perform its action in a sequence sorted by +the ISO image block addresses of the files. It may improve throughput with +actions which read data from optical drives. Action will always get the +absolute path as parameter. +@* +Available operators are: +@* +@item -not : +Matches if the next test or sub expression does not match. +Several tests do this specifically: +@* +-undamaged, -lba_range with negative start_lba, -has_no_acl, -has_no_xattr, +-has_no_aaip, -has_no_filter . +@* +@item -and : +Matches if both neighboring tests or expressions match. +@* +@item -or : +Matches if at least one of both neighboring tests or expressions matches. +@* +@c man \fB\-sub\fR ... \fB\-subend\fR or \fB(\fR ... \fB)\fR : +@c man-ignore-lines 1 +@item -sub ... -subend or ( ... ) : +Enclose a sub expression which gets evaluated first before it +is processed by neighboring operators. +Normal precedence is: -not, -or , -and. +@* +@c man \fB\-if\fR ... \fB\-then\fR\ ... \fB\-elseif\fR ... \fB\-then\fR ... +@c man \fB\-else\fR ... \fB\-endif\fR : +@c man-ignore-lines 1 +@item -if ... -then ... -elseif ... -then ... -else ... -endif : +Enclose one or more sub expressions. If the -if expression matches, then +the -then expression is evaluated as the result of the whole expression +up to -endif. Else the next -elseif expression is evaluated and if it matches, +its -then expression. Finally in case of no match, the -else expression +is evaluated. +There may be more than one -elseif. Neither -else nor -elseif are mandatory. +If -else is missing and would be hit, then the result is a non-match. +@* +-if-expressions are the main use case for above test -decision. +@end table +@sp 1 + +Default action is @strong{echo}, +i.e. to print the address of the found file. Other actions are certain +@command{xorriso} commands which get performed on the found files. +These commands +may have specific parameters. See also their particular descriptions. +@c man .br +@table @asis +@sp 1 +@c man \fBchown\fR and \fBchown_r\fR +@c man-ignore-lines 1 +@item chown and chown_r +change the ownership and get the user id +as parameter. E.g.: -exec chown thomas @minus{}@minus{} +@* +@c man \fBchgrp\fR and \fBchgrp_r\fR +@c man-ignore-lines 1 +@item chgrp and Bchgrp_r +change the group attribute and get the group id +as parameter. E.g.: -exec chgrp_r staff @minus{}@minus{} +@* +@c man \fBchmod\fR and \fBchmod_r\fR +@c man-ignore-lines 1 +@item chmod and chmod_r +change access permissions and get a mode string +as parameter. E.g.: -exec chmod a-w,a+r @minus{}@minus{} +@* +@c man \fBalter_date\fR and \fBalter_date_r\fR +@c man-ignore-lines 1 +@item Balter_date and Balter_date_r +change the timestamps. They get a type +character and a timestring as parameters. +@* +E.g.: -exec alter_date "m" "Dec 30 19:34:12 2007" @minus{}@minus{} +@* +@item lsdl +prints file information like shell command ls -dl. +@* +@item compare +performs command -compare with the found file address as +iso_rr_path and the corresponding file address below its argument +disk_path_start. For this the iso_rr_path of the -find command gets +replaced by the disk_path_start. +@* +E.g.: -find /thomas -exec compare /home/thomas @minus{}@minus{} +@* +@item update +performs command -update with the found file address as +iso_rr_path. The corresponding file address is determined like with above +action "compare". +@* +@item update_merge +is like update but does not delete the found file if it is missing on disk. +It may be run several times and records with all visited files whether their +counterpart on disk has already been seen by one of the update_merge runs. +Finally, a -find run with action "rm_merge" may remove all files that +saw no counterpart on disk. +@* +Up to the next "rm_merge" or "clear_merge" all newly inserted files will +get marked as having a disk counterpart. +@* +@item rm +removes the found iso_rr_path from the image if it is not a directory +with files in it. I.e. this "rm" includes "rmdir". +@* +@item rm_r +removes the found iso_rr_path from the image, including whole +directory trees. +@* +@item rm_merge +removes the found iso_rr_path if it was visited by one or more previous actions +"update_merge" and saw no counterpart on disk in any of them. The marking from +the update actions is removed in any case. +@* +@item clear_merge +removes an eventual marking from action "update_merge". +@* +@item report_damage +classifies files whether they hit a data block that is +marked as damaged. The result is printed together with the address +of the first damaged byte, the maximum span of damages, file size, and the +path of the file. +@* +@item report_lba +prints files which are associated to image data blocks. +It tells the logical block address, the block number, the byte size, +and the path of each file. There may be reported more than one +line per file if the file is very large. In this case each line has a +different extent number in column "xt". +@* +@item getfacl +prints access permissions in ACL text form to the result channel. +@* +@item setfacl +attaches ACLs after removing existing ones. The new +ACL is given in text form as defined with option -setfacl. +@* +E.g.: -exec setfacl u:lisa:rw,u::rw,g::r,o::@minus{},m::rw @minus{}@minus{} +@* +@item getfattr +prints xattr name-value pairs from user namespace +to the result channel. +@* +@item get_any_xattr +prints xattr name-value pairs from any namespace +except ACL to the result channel. This is mostly for debugging of +namespace "isofs". +@* +@item list_extattr mode +prints a script to the result channel, which would use FreeBSD command +setextattr to set the file's xattr name-value pairs of user namespace. +Parameter mode controls the form of the output of names and values. +Default mode "e" prints harmless characters in shell quotation marks, +but represents texts with octal 001 to 037 and 0177 to 0377 by an embedded +echo -e command. +Mode "q" prints any characters in shell quotation marks. This might not be +terminal-safe but should work in script files. +Mode "r" uses no quotation marks. Not safe. +Mode "b" prints backslash encoding. Not suitable for shell parsing. +@* +E.g. -exec list_extattr e -- +@* +Option -backslash_codes does not affect the output. +@* +@item get_md5 +prints the MD5 sum, if recorded, together with file path. +@* +@item check_md5 +compares the MD5 sum, if recorded, with the file content +and reports if mismatch. +@* +E.g.: -find / -not -pending_data -exec check_md5 FAILURE @minus{}@minus{} +@* +@item make_md5 +equips a data file with an MD5 sum of its content. Useful to +upgrade the files in the loaded image to full MD5 coverage by the next +commit with -md5 "on". +@* +E.g.: -find / -type f -not -has_md5 -exec make_md5 @minus{}@minus{} +@* +@item setfattr +sets or deletes xattr name value pairs. +@* +E.g.: -find / -has_xattr -exec setfattr @minus{}@minus{}remove-all '' @minus{}@minus{} +@* +@item set_filter +applies or removes filters. +@* +E.g.: -exec set_filter @minus{}@minus{}zisofs @minus{}@minus{} +@* +@item mkisofs_r +applies the rules of mkisofs -r to the file object: +@* +user id and group id become 0, all r-permissions get granted, all w denied. +If there is any x-permission, then all three x get granted. +s- and t-bits get removed. +@* +@item sort_weight +attributes a LBA weight number to regular files. +@* +The number may range from -2147483648 to 2147483647. The higher it is, the +lower will be the block address of the file data in the emerging ISO image. +Currently the boot catalog has a hardcoded weight of 1 billion. +Normally it should occupy the block with the lowest possible address. +Data files get added or loaded with initial weight 0. +@* +E.g.: -exec sort_weight 3 @minus{}@minus{} +@* +@item show_stream +shows the content stream chain of a data file. +@* +@item hide +brings the file into one of the hide states "on", "iso_rr", "joliet", "off". +@* +E.g.: +@* + -find / -disk_name *_secret -exec hide on +@* +@item estimate_size +prints a lower and an upper estimation of the number of blocks which the +found files together will occupy in the emerging ISO image. +This does not account for the superblock, +for the directories in the -find path, or for image padding. +@* +@item find +performs another run of -find on the matching file address. +It accepts the same params as -find, except iso_rr_path. +@* +E.g.: +@* + -find / -name '???' -type d -exec find -name '[abc]*' -exec chmod a-w,a+r @minus{}@minus{} +@end table +@end table +@c man .TP +@c man .B Filters for data file content: +@c man .PP +@node Filter, Writing, CmdFind, Options +@section Filters for data file content +@cindex Filter, _definition +@strong{Filters} may be installed between data files in the ISO image and their +content source outside the image. They may also be used vice versa between +data content in the image and target files on disk. +@* +@sp 1 +Built-in filters are "@minus{}@minus{}zisofs" and +"@minus{}@minus{}zisofs-decode". The former is to be +applied via -set_filter, the latter is automatically applied if zisofs +compressed content is detected with a file when loading the ISO image. +@* +Another built-in filter pair is "@minus{}@minus{}gzip" +and "@minus{}@minus{}gunzip" with suffix ".gz". +They behave about like external gzip and gunzip but avoid forking a process +for each single file. So they are much faster if there are many small files. +@c man .PP +@table @asis +@sp 1 +@c man .TP +@item -external_filter name option[:option] program_path [arguments] @minus{}@minus{} +@kindex -external_filter registers data filter +@cindex Filter, register, -external_filter +Register a content filter by associating a name with a program path, +program arguments, and some behavioral options. Once registered it can be +applied to multiple data files in the ISO image, regardless whether their +content resides in the loaded ISO image or in the local filesystem. +External filter processes may produce synthetic file content by reading the +original content from stdin and writing to stdout whatever they want. +They must deliver the same output on the same input in repeated runs. +@* +Options are: +@* + "default" means that no other option is intended. +@* + "suffix=..." sets a file name suffix. If it is not empty then it will be +appended to the file name or removed from it. +@* + "remove_suffix" will remove a file name suffix +rather than appending it. +@* + "if_nonempty" will leave 0-sized files unfiltered. +@* + "if_reduction" will try filtering and revoke it if the content size does not +shrink. +@* + "if_block_reduction" will revoke if the number of 2 kB blocks does not shrink. +@* + "used=..." is ignored. Command -status shows it with the number of +files which currently have the filter applied. +@* +Examples: +@* + -external_filter bzip2 suffix=.bz2:if_block_reduction \ +@* + /usr/bin/bzip2 @minus{}@minus{} +@* + -external_filter bunzip2 suffix=.bz2:remove_suffix \ +@* + /usr/bin/bunzip2 @minus{}@minus{} +@c man .TP +@item -unregister_filter name +@kindex -external_filter unregisters data filter +@cindex Filter, unregister, -unregister_filter +Remove an -external_filter registration. This is only possible if the filter +is not applied to any file in the ISO image. +@c man .TP +@item -close_filter_list +@kindex -close_filter_list bans filter registration +@cindex Filter, ban registration, -close_filter_list +Irrevocably ban commands -external_filter and -unregister_filter, +but not -set_filter. Use this to prevent external filtering in general or +when all intended filters are registered. +External filters may also be banned totally at compile time of +@command{xorriso}. +By default they are banned if @command{xorriso} runs under setuid permission. +@c man .TP +@item -set_filter name iso_rr_path [***] +@kindex -set_filter applies filter to file +@cindex Filter, apply to file, -set_filter +Apply an -external_filter or a built-in filter to the given data files in the +ISO image. +If the filter suffix is not empty , then it will be applied to the file name. +Renaming only happens if the filter really gets attached and is not revoked by +its options. +By default files which already bear the suffix will not get filtered. The +others will get the suffix appended to their names. +If the filter has option "remove_suffix", then the filter will only be +applied if the suffix is present and can be removed. +Name oversize or collision caused by suffix change will prevent filtering. +@* +With most filter types this command will immediately run the filter once for +each file in order to determine the output size. +Content reading operations like -extract , -compare and image generation will +perform further filter runs and deliver filtered content. +@* +At image generation time the filter output must still be the same as the +output from the first run. Filtering for image generation does not happen +with files from the loaded ISO image if the write method of growing is in +effect (i.e -indev and -outdev are identical). +@* +The reserved filter name "@minus{}@minus{}remove-all-filters" revokes +filtering. This will revoke suffix renamings as well. +Use "@minus{}@minus{}remove-all-filters+" to +prevent any suffix renaming. +@c man .TP +@item -set_filter_r name iso_rr_path [***] +@kindex -set_filter_r applies filter to file tree +@cindex Filter, apply to file tree, -set_filter_r +Like -set_filter but affecting all data files below eventual directories. +@end table +@c man .TP +@c man .B Writing the result, drive control: +@node Writing, SetWrite, Filter, Options +@section Writing the result, drive control +@c man .PP +(see also paragraph about settings below) +@table @asis +@sp 1 +@c man .TP +@item -rollback +@kindex -rollback discards pending changes +@cindex Image, discard pending changes, -rollback +Discard the manipulated ISO image and reload it from -indev. +(Use -rollback_end if immediate program end is desired.) +@c man .TP +@item -commit +@kindex -commit writes pending ISO image +@cindex Write, pending ISO image, -commit +Perform the write operation. Afterwards, if -outdev is readable, make it +the new -dev and load the image from there. +Switch to growing mode. +(A subsequent -outdev will activate modification mode or blind growing.) +-commit is performed automatically at end of program if there +are uncommitted manipulations pending. +@* +So, to perform a final write operation with no new -dev +and no new loading of image, rather execute option -end. +If you want to go on without image loading, execute -commit_eject "none". +To eject after write without image loading, use -commit_eject "all". +@* +To suppress a final write, execute -rollback_end. +@* + +Writing can last quite a while. It is not unnormal with several +types of media that there is no progress visible for the first +few minutes or that the drive gnaws on the medium for a few +minutes after all data have been transmitted. +@command{xorriso} and the drives are in a client-server relationship. +The drives have much freedom about what to do with the media. +Some combinations of drives and media simply do not work, +despite the promises by their vendors. +If writing fails then try other media or another drive. The reason +for such failure is hardly ever in the code of the various +burn programs but you may well try some of those listed below +under SEE ALSO. +@c man .TP +@item -eject "in"|"out"|"all" +@kindex -eject ejects drive tray +@cindex Drive, eject tray, -eject +Eject the medium in -indev, resp. -outdev, resp. both drives. +Note: It is not possible yet to effectively eject disk files. +@c man .TP +@item -commit_eject "in"|"out"|"all"|"none" +@kindex -commit_eject writes and ejects +@cindex Drive, write and eject, -commit_eject +Combined -commit and -eject. When writing has finished do not make +-outdev the new -dev, and load no ISO image. Rather eject +-indev and/or -outdev. Give up any non-ejected drive. +@c man .TP +@item -blank mode +@kindex -blank erases media +@cindex Media, erase, -blank +Make media ready for writing from scratch (if not -dummy is activated). +@* +This affects only the -outdev not the -indev. +If both drives are the same and if the ISO image was altered +then this command leads to a FAILURE event. +Defined modes are: + as_needed, fast, all, deformat, deformat_quickest +@* +"as_needed" cares for used CD-RW, DVD-RW and for used overwriteable media +by applying -blank "fast". It applies -format "full" to yet unformatted +DVD-RAM and BD-RE. Other media in blank state are gracefully ignored. +Media which cannot be made ready for writing from scratch cause a FAILURE +event. +@* +"fast" makes CD-RW and unformatted DVD-RW re-usable, or invalidates +overwriteable ISO images. "all" might work more thoroughly and need more time. +@* +"deformat" converts overwriteable DVD-RW into unformatted ones. +@* +"deformat_quickest" is a faster way to deformat or blank DVD-RW +but produces media which are only suitable for a single session. +Some drives announce this state by not offering feature 21h, +but some drives offer it anyway. +If feature 21h is missing, then @command{xorriso} +will refuse to write on DVD-RW if not option -close is set to "on". +@* +The progress reports issued by some drives while blanking are +quite unrealistic. Do not conclude success or failure from the +reported percentages. Blanking was successful if no SORRY event or +worse occured. +@c man .TP +@item -format mode +@kindex -format formats media +@cindex Media, format, -format +Convert unformatted DVD-RW into overwriteable ones, "de-ice" DVD+RW, format +newly purchased BD-RE or BD-R, re-format DVD-RAM or BD-RE. +@* +Defined modes are: +@* + as_needed, full, fast, by_index_<num>, fast_by_index_<num> +@* +"as_needed" formats yet unformatted DVD-RW, DVD-RAM, BD-RE, or blank +unformatted BD-R. Other media are left untouched. +@* +"full" (re-)formats DVD-RW, DVD+RW, DVD-RAM, BD-RE, or blank unformatted BD-R. +@* +"fast" does the same as "full" but tries to be quicker. +@* +"by_index_" selects a format out of the descriptor list issued by option +-list_formats. The index number from that list is to be appended to the +mode word. E.g: "by_index_3". +@* +"fast_by_index_" does the same as "by_index_" but tries to be quicker. +@* +"by_size_" selects a format out of the descriptor list which provides at +least the given size. That size is to be appended to the mode word. +E.g: "by_size_4100m". This applies to media with Defect Management. +@* +"fast_by_size_" does the same as "by_size_" but tries to be quicker. +@* +The formatting action has no effect on media if -dummy is activated. +@* +Formatting is normally needed only once during the lifetime of a medium, +if ever. But it is a reason for re-formatting if: +@* + DVD-RW was deformatted by -blank, +@* + DVD+RW has read failures (re-format before next write), +@* + DVD-RAM or BD-RE shall change their amount of defect reserve. +@* +BD-R may be written unformatted or may be formatted before first use. +Formatting activates Defect Management which tries to catch and repair +bad spots on media during the write process at the expense of half speed +even with flawless media. +@* +The progress reports issued by some drives while formatting are +quite unrealistic. Do not conclude success or failure from the +reported percentages. Formatting was successful if no SORRY event +or worse occured. Be patient with apparently frozen progress. +@c man .TP +@item -list_formats +@kindex -list_formats lists available formats +@cindex Media, list formats, -list_formats +Put out a list of format descriptors as reported by the output drive for +the current medium. The list gives the index number after "Format idx", +a MMC format code, the announced size in blocks (like "2236704s") +and the same size in MiB. +@* +MMC format codes are manifold. Most important are: +"00h" general formatting, "01h" increases reserve space for DVD-RAM, +"26h" for DVD+RW, "30h" for BD-RE with reserve space, +"31h" for BD-RE without reserve space, "32h" for BD-R. +@* +Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space. +@c man .TP +@item -list_speeds +@kindex -list_speeds lists available write speeds +@cindex Media, list write speeds, -list_speeds +Put out a list of speed values as reported by the output drive with +the loaded medium. This does not necessarily mean that the medium is writable +or that these speeds are actually achievable. Especially the +lists reported with empty drive or with ROM media obviously advertise +speeds for other media. +@* +It is not mandatory to use speed values out of the listed range. +The drive is supposed to choose a safe speed that is as near to the desired +speed as possible. +@* +At the end of the list, "Write speed L" and "Write speed H" +are the best guesses for lower and upper speed limit. +"Write speed l" and "Write speed h" may appear only with CD +and eventually override the list of other speed offers. +@c man .TP +@item -close_damaged "as_needed"|"force" +@kindex -close_damaged closes damaged track and session +@cindex Damaged track and session, close, -close_damaged +Try to close the upcomming track and session if the drive reported the medium +as damaged. This may apply to CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, DVD+R DL, +or BD-R media. It is indicated by warning messages when the drive gets +aquired, and by a remark "but next track is damaged" with the line +"Media status :" of command -toc. +@* +The setting of option -close determines whether the medium stays appendable. +@* +Mode "as_needed" gracefully refuses on media which are not reported as +damaged. Mode "force" attempts the close operation even with media which +appear undamaged. +@* +No image changes are allowed to be pending before this command is performed. +After closing was attempted, both drives are given up. +@c man .TP +@item -list_profiles "in"|"out"|"all" +@kindex -list_profiles lists supported media +@cindex Drive, list supported media, -list_profiles +Put out a list of media types supported by -indev, resp. -outdev, resp. both. +The currently recognized type is marked by text "(current)". +@end table +@c man .TP +@c man .B Settings for result writing: +@node SetWrite, Bootable, Writing, Options +@section Settings for result writing +@c man .PP +Rock Ridge info will be generated by the program unconditionally. +ACLs will be written according to the setting of option -acl. +@table @asis +@sp 1 +@c man .TP +@item -joliet "on"|"off" +@kindex -joliet enables production of Joliet tree +@cindex Write, enable Joliet, -joliet +If enabled by "on", generate Joliet tree additional to ISO 9660 + Rock Ridge +tree. +@c man .TP +@item -compliance rule[:rule...] +@kindex -compliance controls standard compliance +@cindex Write, compliance to specs, -compliance +Adjust the compliance to specifications of ISO 9660 and its contemporary +extensions. In some +cases it is worth to deviate a bit in order to circumvent bugs of the intended +reader system or to get unofficial extra features. +@* +There are several adjustable rules which have a keyword each. If they +are mentioned with this option then their rule gets added to the relaxation +list. This list can be erased by rules "strict" or "clear". It can be reset +to its start setting by "default". All of the following relaxation rules +can be revoked individually by appending "_off". Like "deep_paths_off". +@* +Rule keywords are: +@* +"iso_9660_level="number chooses level 1 with ISO names of the form 8.3 +and -file_size_limit <= 4g - 1, or level 2 with ISO names up to +length 32 and the same -file_size_limit, or level 3 with ISO names up to +length 32 and -file_size_limit >= 400g -200k. If necessary -file_size_limit +gets adjusted. +@* +"allow_dir_id_ext" allows ISO names of directories to have a name extension +as with other file types. It does not force dots and it omits the version +number, though. This is a bad tradition of mkisofs which violates ECMA-119. +Especially ISO level 1 only allows 8 characters in a directory name and +not 8.3. +@* +"omit_version" does not add versions (";1") to ISO and Joliet file names. +@* +"only_iso_version" does not add versions (";1") to Joliet file names. +@* +"deep_paths" allows ISO file paths deeper than 8 levels. +@* +"long_paths" allows ISO file paths longer than 255 characters. +@* +"long_names" allows up to 37 characters with ISO file names. +@* +"no_force_dots" does not add a dot to ISO file names which have none. +@* +"no_j_force_dots" does not add a dot to Joliet file names which have none. +@* +"lowercase" allows lowercase characters in ISO file names. +@* +"full_ascii" allows all ASCII characters in ISO file names. +@* +"untranslated_names" might be dangerous for inadverted reader programs +which rely on the restriction to at most 37 characters in ISO file names. +This option allows ISO file names up to 96 characters with no character +conversion. If a file name has more characters, then image production will +fail deliberately. +@* +"untranslated_name_len="number enables untranslated_names with a smaller limit +for the length of file names. 0 disables this feature, -1 chooses maximum +length limit, numbers larger than 0 give the desired length limit. +@* +"joliet_long_names" allows Joliet leaf names up to 103 characters rather +than 64. +@* +"joliet_long_paths" allows Joliet paths longer than 240 characters. +@* +"always_gmt" stores timestamps in GMT representation with timezone 0. +@* +"rec_mtime" records with ISO files the disk file's mtime and not the +creation time of the image. +@* +"new_rr" uses Rock Ridge version 1.12 (suitable for GNU/Linux but not for older +FreeBSD or for Solaris). This implies "aaip_susp_1_10_off" which may be changed +by subsequent "aaip_susp_1_10". +@* +Default is "old_rr" which uses Rock Ridge version 1.10. This implies also +"aaip_susp_1_10" which may be changed by subsequent "aaip_susp_1_10_off". +@* +"aaip_susp_1_10" allows AAIP to be written as unofficial extension of RRIP +rather than as official extension under SUSP-1.12. +@* +"no_emul_toc" saves 64 kB with the first session on overwriteable media +but makes the image incapable of displaying its session history. +@* +"iso_9660_1999" causes the production of an additional directory tree +compliant to ISO 9660:1999. It can record long filenames for readers which +do not understand Rock Ridge. +@* +"old_empty" uses the old way of of giving block addresses in the range +of [0,31] to files with no own data content. The new way is to have +a dedicated block to which all such files will point. +@* +Default setting is +@* + "clear:only_iso_version:deep_paths:long_paths:no_j_force_dots: +@* + always_gmt:old_rr". +@* +Note: The term "ISO file" means the plain ISO 9660 names and attributes +which get visible if the reader ignores Rock Ridge. +@c man .TP +@item -volid text +@kindex -volid sets volume id +@cindex Image, set volume id, -volid +Specify the volume ID. @command{xorriso} accepts any text up to 32 characters, +but according to rarely obeyed specs stricter rules apply: +@* +ECMA 119 demands ASCII characters out of [A-Z0-9_]. Like: "IMAGE_23" +@* +Joliet allows 16 UCS-2 characters. Like: "Windows name" +@* +Be aware that the volume id might get used automatically as name of the +mount point when the medium is inserted into a playful computer system. +@* +If an ISO image gets loaded while the volume ID is set to default "ISOIMAGE" +or to "", then the volume ID of the loaded image will become the effective +volume id for the next write run. But as soon as command -volid is performed +afterwards, this pending id is overridden by the new setting. +@* +Consider this when setting -volid "ISOIMAGE" before executing -dev, -indev, +or -rollback. +If you insist in -volid "ISOIMAGE", set it again after those commands. +@c man .TP +@item -volset_id text +@kindex -volset_id sets volume set id +@cindex Image, set volume set id, -volset_id +Set the volume set id string to be written with the next -commit. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +@c man .TP +@item -publisher text +@kindex -publisher sets publisher id +@cindex Image, set publisher id, -publisher +Set the publisher id string to be written with the next -commit. This may +identify the person or organisation who specified what shall be recorded. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +@c man .TP +@item -application_id text +@kindex -application_id sets application id +@cindex Image, set application id, -application_id +Set the application id string to be written with the next -commit. This may +identify the specification of how the data are recorded. +Permissible are up to 128 characters. This setting gets overridden by +image loading. +@* +The special text "@@xorriso@@" gets converted to the id string of +@command{xorriso} +which is normally written as -preparer_id. It is a wrong tradition to write +the program id as -application_id. +@c man .TP +@item -system_id text +@kindex -system_id sets system id +@cindex Image, set system id, -system_id +Set the system id string to be written with the next -commit. This may +identify the system which can recognize and act upon the content of the +System Area in image blocks 0 to 15. +Permissible are up to 32 characters. This setting gets overridden by +image loading. +@c man .TP +@item -volume_date type timestring +@kindex -volume_date sets volume timestamp +@cindex Image, set volume timestamp, -volume_date +Set one of the four overall timestamps for subsequent image writing. +Available types are: +@* +"c" time when the volume was created. +@* +"m" time when volume was last modified. +@* +"x" time when the information in the volume expires. +@* +"f" time since when the volume is effectively valid. +@* +"uuid" sets a timestring that overrides "c" and "m" times literally. +It must consist of 16 decimal digits which form YYYYMMDDhhmmsscc, with +YYYY between 1970 and 2999. Time zone is GMT. +It is supposed to match this GRUB line: +@* + search @minus{}@minus{}fs-uuid @minus{}@minus{}set YYYY-MM-DD-hh-mm-ss-cc +@* +E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). +@* +Timestrings for the other types may be given as with option -alter_date. +They are prone to timezone computations. The timestrings "default" or +"overridden" cause default settings: "c" and "m" will show the current time +of image creation. "x" and "f" will be marked as insignificant. +"uuid" will be deactivated. +@c man .TP +@item -copyright_file text +@kindex -copyright_file sets copyright file name +@cindex Image, set copyright file name, -copyright_file +Set the copyright file name to be written with the next -commit. This should +be the ISO 9660 path of a file in the image which contains a copyright +statement. +Permissible are up to 37 characters. This setting gets overridden by +image loading. +@c man .TP +@item -abstract_file text +@kindex -abstract_file sets abstract file name +@cindex Image, set abstract file name, -abstract_file +Set the abstract file name to be written with the next -commit. This should +be the ISO 9660 path of a file in the image which contains an abstract +statement about the image content. +Permissible are up to 37 characters. This setting gets overridden by +image loading. +@c man .TP +@item -biblio_file text +@kindex -biblio_file sets biblio file name +@cindex Image, set biblio file name, -biblio_file +Set the biblio file name to be written with the next -commit. This should +be the ISO 9660 path of a file in the image which contains bibliographic +records. +Permissible are up to 37 characters. This setting gets overridden by +image loading. +@c man .TP +@item -preparer_id +@kindex -preparer_id sets preparer id +@cindex Image, set preparer id, -preparer_id +Set the preparer id string to be written with the next -commit. This may +identify the person or other entity which controls the preparation of the data +which shall be recorded. Normally this should be the id of @command{xorriso} +and not of the person or program which operates @command{xorriso}. +Please avoid to change it. Permissible are up to 128 characters. +@* +The special text "@@xorriso@@" gets converted to the id string of +@command{xorriso} which is default at program startup. +@* +Unlike other id strings, this setting is not influenced by image loading. +@c man .TP +@item -out_charset character_set_name +@kindex -out_charset sets output character set +@cindex Character Set, for output, -out_charset +Set the character set to which file names get converted when writing an +image. See paragraph "Character sets" for more explanations. +When loading the written image after -commit the setting of -out_charset +will be copied to -in_charset. +@c man .TP +@item -uid uid +@kindex -uid sets global ownership +@cindex Ownership, global in ISO image, -uid +User id to be used for all files when the new ISO tree gets written to media. +@c man .TP +@item -gid gid +@kindex -gid sets global ownership +@cindex Group, global in ISO image, -gid +Group id to be used for all files when the new ISO tree gets written to media. +@c man .TP +@item -zisofs option[:options] +@kindex -zisofs controls zisofs production +@cindex Filter, zisofs parameters, -zisofs +Set global parameters for zisofs compression. This data format is recognized +and transparently uncompressed by some Linux kernels. It is to be applied +via option -set_filter with built-in filter "@minus{}@minus{}zisofs". +Parameters are: +@* + "level="[0-9] zlib compression: 0=none, 1=fast,..., 9=slow +@* + "block_size="32k|64k|128k size of compression blocks +@* + "by_magic=on" enables an expensive test at image generation time which checks +files from disk whether they already are zisofs compressed, e.g. by program +mkzftree. +@* + "default" same as "level=6:block_size=32k:by_magic=off" +@c man .TP +@item -speed number[k|m|c|d|b] +@kindex -speed set write speed +@cindex Write, set speed, -speed +Set the burn speed. Default is 0 = maximum speed. +Speed can be given in media dependent numbers or as a +desired throughput per second in MMC compliant kB (= 1000) +or MB (= 1000 kB). Media x-speed factor can be set explicity +by "c" for CD, "d" for DVD, "b" for BD, "x" is optional. +@* +Example speeds: +@* + 706k = 706kB/s = 4c = 4xCD +@* + 5540k = 5540kB/s = 4d = 4xDVD +@* +If there is no hint about the speed unit attached, then the +medium in the -outdev will decide. Default unit is CD = 176.4k. +@* +MMC drives usually activate their own idea of speed and take +the speed value given by the burn program only as upper limit +for their own decision. +@c man .TP +@item -stream_recording "on"|"off"|"full"|"data"|number +@kindex -stream_recording controls defect management +@cindex Write, defect management, -stream_recording +Setting "on" tries to circumvent the management of defects on DVD-RAM, BD-RE, +or BD-R. Defect management keeps partly damaged media usable. But it reduces +write speed to half nominal speed even if the medium is in perfect shape. +For the case of flawless media, one may use -stream_recording "on" to get +full speed. +@* +"full" tries full speed with all write operations, whereas "on" does this +only above byte address 32s. One may give a number of at least 16s +in order to set an own address limit. +@* +"data" causes full speed to start when superblock and directory entries are +written and writing of file content blocks begins. +@c man .TP +@item -dvd_obs "default"|"32k"|"64k" +@kindex -dvd_obs set write block size +@cindex Write, block size, -dvd_obs +GNU/Linux specific: +Set the number of bytes to be transmitted with each write operation to DVD +or BD media. A number of 64 KB may improve throughput with bus systems which +show latency problems. The default depends on media type, on option +-stream_recording , and on compile time options. +@c man .TP +@item -stdio_sync "on"|"off"|number +@kindex -stdio_sync controls stdio buffer +@cindex Write, buffer syncing, -stdio_sync +Set the number of bytes after which to force output to stdio: pseudo drives. +This forcing keeps the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +@c man .TP +@item -dummy "on"|"off" +@kindex -dummy controls write simulation +@cindex Write, simulation, -dummy +If "on" then simulate burning or refuse with FAILURE event if +no simulation is possible, do neither blank nor format. +@c man .TP +@item -fs number["k"|"m"] +@kindex -fs sets size of fifo +@cindex Write, fifo size, -fs +Set the size of the fifo buffer which smoothens the data +stream from ISO image generation to media burning. Default +is 4 MiB, minimum 64 kiB, maximum 1 GiB. +The number may be followed by letter "k" or "m" +which means unit is kiB (= 1024) or MiB (= 1024 kiB). +@c man .TP +@item -close "on"|"off" +@kindex -close controls media closing +@cindex Write, close media, -close +If "on" then mark the written medium as not appendable +any more (if possible at all with the given type of target media). +@* +This is the contrary of cdrecord, wodim, cdrskin option -multi, +and is one aspect of growisofs option -dvd-compat. +@c man .TP +@item -padding number["k"|"m"]|"included"|"appended" +@kindex -padding sets amount or mode of image padding +@cindex Write, padding image, -padding +Append the given number of extra bytes to the image stream. +This is a traditional remedy for a traditional bug in block +device read drivers. Needed only for CD recordings in TAO mode. +Since one can hardly predict on what media an image might end up, +@command{xorriso} adds the traditional 300k of padding by default to +all images. +@* +For images which will never get to a CD it is safe to use -padding 0 . +@* +Normally padding is not written as part of the ISO image but appended +after the image end. This is -padding mode "appended". +@* +Emulation command -as "mkisofs" and command -jigdo cause padding to be +written as part of the image. +The same effect is achieved by -padding mode "included". +@end table +@c man .TP +@c man .B Bootable ISO images: +@node Bootable, Jigdo, SetWrite, Options +@section Bootable ISO images +@c man .PP +Contrary to published specifications many BIOSes will load an El Torito +record from the first session on media and not from the last one, which +gets mounted by default. This makes no problems with overwriteable media, +because they appear to inadverted readers as one single session. +@* +But with multi-session media CD-R[W], DVD-R[W], DVD+R, it implies that the +whole bootable system has to reside already in the first session and that +the last session still has to bear all files which the booted system expects +after mounting the ISO image. +@* +If a boot image from ISOLINUX or GRUB is known to be present on media then +it is advised to patch it +when a follow-up session gets written. But one should not rely on the +capability to influence the bootability of the existing sessions, unless one +can assume overwriteable media. +@* +There are booting mechanisms which do not use an El Torito record but rather +start at the first bytes of the image: PC-BIOS MBR for hard-disk-like devices, +MIPS Volume Header for old SGI computers, DEC Boot Block for old DECstation, +SUN Disk Label for SPARC machines. +@* +The boot firmware EFI may use programs which are located in a FAT filesystem +and announced by an MBR partition table entry. +@* +@table @asis +@sp 1 +@c man .TP +@item -boot_image "any"|"isolinux"|"grub" +@kindex -boot_image controls bootability +@cindex Write, bootability, -boot_image +@cindex Bootability, control, -boot_image +@* + "discard"|"keep"|"patch"|"show_status"|bootspec|"next" +@* +@sp 1 +Define the handling of a set of El Torito boot images which +has been read from an existing ISO image or define how to make a prepared +boot image file set bootable. Such file sets get produced by ISOLINUX or GRUB. +@* +Each -boot_image command has two arguments: type and setting. More than one +-boot_image command may be used to define the handling of one or more boot +images. Sequence matters. +@* +Types @strong{isolinux} and @strong{grub} care for known peculiarities. +Type @strong{any} makes +no assumptions about the origin of the boot images. +@* +@sp 1 + +El Torito boot images of any type can be newly inserted, or discarded, +or patched, or kept unaltered. +Whether to patch or to keep depends on whether +the boot images contain boot info tables. +@* +A boot info table needs to be patched when the boot image gets newly +introduced into the ISO image or if an existing image gets relocated. +This is automatically done if type "isolinux" or "grub" +is given, but not with "any". +@* +If patching is enabled, then boot images from previous sessions will +be checked whether they seem to bear a boot info table. If not, +then they stay unpatched. This check is not infallible. So if +you do know that the images need no patching, use "any" "keep". +"grub" "patch" will not patch EFI images (platform_id=0xef). +@* +Most safe is the default: -boot_image "any" "discard". +@* +Advised for GRUB : -boot_image "grub" "patch" +@* +For ISOLINUX : -boot_image "isolinux" "patch" +@* +@strong{show_status} will print what is known about the loaded boot images +and their designated fate. +@* +@sp 1 + +A @strong{bootspec} is a word of the form name=valuei. It is used to describe +the parameters of a boot image by an El Torito record or a MBR. +The names "dir", "bin_path", "efi_path" lead to El Torito bootable images. +Name "system_area" activates a given file as MBR. +@* +On all media types this is possible within the first session. In further +sessions an existing boot image can get replaced by a new one, but depending +on the media type this may have few effect at boot time. See above. +@* +The boot image and its supporting files have to be added to the ISO image by +normal means (image loading, -map, -add, ...). In case of ISOLINUX the files +should reside either in ISO image directory /isolinux or in /boot/isolinux . +In that case it suffices to use as bootspec the text "dir=/isolinux" or +"dir=/boot/isolinux". E.g.: +@* + -boot_image isolinux dir=/boot/isolinux +@* +which bundles these individual settings: +@* + -boot_image isolinux bin_path=/boot/isolinux/isolinux.bin +@* + -boot_image isolinux cat_path=/boot/isolinux/boot.cat +@* + -boot_image isolinux load_size=2048 +@* + -boot_image any boot_info_table=on +@* +An El Torito boot catalog file gets inserted into the ISO image with address +@strong{cat_path=} at -commit time. +It is subject to normal -overwrite and -reassure processing if there is already +a file with the same name. +The catalog lists the boot images and is read by the boot facility to choose +one of the boot images. But it is not necessary that it appears in the +directory tree at all. One may hide it in all trees by @strong{cat_hidden=on}. +Other possible values are "iso_rr", "joliet", and the default "off". +@* +@strong{bin_path=} depicts a boot image file, a binary program which is to be +started by the hardware boot facility (e.g. the BIOS) at boot time. +@* +@strong{efi_path=} depicts a boot image file that is ready for EFI booting. +Its load_size is determined automatically, no boot info table gets +written, no boot medium gets emulated, platform_id is 0xef. +@* +@strong{emul_type=} can be one of "no_emulation", "hard_disk", "diskette". +It controls the boot medium emulation code of a boot image. +The default "no_emulation" is suitable for ISOLINUX, GRUB, FreeBSD cdboot. +@* +@strong{load_size=} is a value which depends on the boot image. +Default 2048 should be overridden only if a better value is known. +@* +@strong{boot_info_table=on} may be used to apply patching to a boot image which +is given by "any" "bin_path=". "boot_info_table=off" disables patching. +@* +@strong{platform_id=} defines by two hex digits the Platform ID of the +boot image. "00" is 80x86 PC-BIOS, "01" is PowerPC, "02" is Mac, "ef" is EFI. +@* +@strong{id_string=}text|56_hexdigits defines the ID string of the boot catalog +section where the boot image will be listed. If the value consists of 56 +characters [0-9A-Fa-f] then it is converted into 28 bytes, else the first +28 characters become the ID string. +The ID string of the first boot image becomes the overall catalog ID. +It is limited to 24 characters. Other id_strings become section IDs. +@* +@strong{sel_crit=}hexdigits defines the Selection Criteria of the boot image. +Up to 20 bytes get read from the given characters [0-9A-Fa-f]. +They get attributed to the boot image entry in the catalog. +@* +@strong{next} ends the definition of a boot image and starts a new one. +Any following -bootimage bootspecs will affect the new image. +The first "next" discards loaded boot images and their catalog. +@* +@strong{discard} gives up an existing boot catalog and its boot images. +@* +@strong{keep} keeps or copies boot images unaltered and writes a new catalog. +@* +@strong{patch} applies patching to existing boot images +if they seem to bear a boot info table. +@* +@cindex System area, _definiton +@cindex MBR, set, -boot_image system_area= +@strong{system_area=}disk_path copies at most 32768 bytes from the given +disk file to the very start of the ISO image. +This System Area is reserved for system dependent boot software, e.g. an MBR +which can be used to boot from USB stick or hard disk. +@* +Other than a El Torito boot image, the file disk_path needs not to be added +to the ISO image. +@* +-boot_image isolinux system_area= implies "partition_table=on". +@* +@cindex Partition table, _definiton +@strong{partition_table=on} causes a simple partition table to be written +into bytes 446 to 511 of the System Area. +@* +With type "isolinux" it shows a partition that begins at byte 0 and it causes +the LBA of the first boot image to be written into the MBR. For the first +session this works only if also "system_area=" and "bin_path=" or "dir=" +is given. +@* +With types "any" and "grub" it shows a single +partiton which starts at byte 512 and ends where the ISO image ends. +This works with or without system_area= or boot image. +@* +In follow-up sessions the existing System Area is preserved by default. +If types "isolinux" or "grub" are set to "patch", then "partition_table=on" +is activated without new boot image. +In this case the existing System Area gets checked whether it bears addresses +and sizes as if it had been processed by "partition_table=on". If so, +then those parameters get updated when the new System Area is written. +@* +Special "system_area=/dev/zero" causes 32k of NUL-bytes. +Use this to discard an MBR which was loaded with the ISO image. +@* +@cindex Partition offset, _definiton +@strong{partition_offset=}2kb_block_adr causes a partition table with a single +partition that begins at the given block address. This is counted in 2048 byte +blocks, not in 512 byte blocks. If the block address is non-zero then it must +be at least 16. A non-zero partition offset causes two superblocks to be +generated and two sets of directory trees. The image is then mountable from its +absolute start as well as from the partition start. +@* +The offset value of an ISO image gets preserved when a new session is added. +So the value defined here is only in effect if a new ISO image gets written. +@* +@cindex Cylinder size, _definiton +@strong{partition_hd_cyl=}number gives the number of heads per cylinder for +the partition table. 0 chooses a default value. Maximum is 255. +@* +@strong{partition_sec_hd=}number gives the number of sectors per head for +the partition table. 0 chooses a default value. Maximum is 63. +@* +The product partition_sec_hd * partition_hd_cyl * 512 is the cylinder size. +It should be divisible by 2048 in order to allow exact alignment. +If it is too small to describe the image size by at most 1024 cylinders, +then appropriate values of partition_hd_cyl are chosen with +partition_sec_hd 32 or 63. If the image is larger than 8,422,686,720 bytes, +then the cylinder size constraints cannot be fulfilled. +@* +@cindex Cylinder alignment, _definiton +@strong{partition_cyl_align=}mode controls image size alignment to an integer +number of cylinders. It is prescribed by isohybrid specs and it seems to +please program fdisk. Cylinder size must be divisible by 2048. +Images larger than 8,323,596,288 bytes cannot be aligned. +@* +Mode "auto" is default. Alignment by padding happens only with +"isolinux" "partition_table=on". +@* +Mode "on" causes alignment by padding with "partition_table=on" for any type. +Mode "off" disables alignment for any type. +@* +@cindex MIPS boot file, activation +@strong{mips_path=}iso_rr_path declares a data file in the image to be a +MIPS Big Endian boot file and causes production of a MIPS Big Endian Volume +Header. This is mutually exclusive with production of other boot blocks +like MBR. +It will overwrite the first 512 bytes of any data provided by system_area=. +Up to 15 boot files can be declared by mips_path=. +@* +@strong{mipsel_path=}iso_rr_path declares a data file in the image to be the +MIPS Little Endian boot file. This is mutually exclusive with other boot +blocks. +It will overwrite the first 512 bytes of any data provided by system_area=. +Only a single boot file can be declared by mipsel_path=. +@* +@cindex SUN Disk Label, production +@strong{sparc_label=}text causes the production of a SUN Disk Label with the +given text as ASCII label. This boot block format allows to append images +for partitions 2 to 8. Partition 1 will always be the ISO image. +See option -append_partition. +The first 512 bytes of any data provided by system_area= will be overwritten. +@* +@strong{mips_discard} and @strong{sparc_discard} revoke any boot file +declarations made by mips_path= or mipsel_path=. They also disable production +of SUN Disk Label. +This removes the ban on production of other boot blocks. +@* +@end table +@* +@table @asis +@sp 1 +@c man .TP +@item -append_partition partition_number type_code disk_path +@kindex -append_partition adds arbitrary file after image end +@cindex Appended Filesystem Image, -append_partition +Cause a prepared filesystem image to be appended to the ISO image and to be +described by a partition table entry in a boot block at the start of the +emerging ISO image. The partition entry will bear the size of the submitted +file rounded up to the next multiple of 2048 bytes. +@* +Beware of subsequent multi-session runs. The appended partition will get +overwritten. +@* +Partitions may be appended with boot block type MBR and with SUN Disk Label. +@* +With MBR: +@* +partition_number may be 1 to 4. Number 1 will put the whole ISO image into +the unclaimed space before partition 1. So together with most @command{xorriso} +MBR features, number 2 would be the most natural choice. +@* +The type_code may be "FAT12", "FAT16", "Linux", +or a hexadecimal number between 0x00 and 0xff. Not all those numbers will +yield usable results. For a list of codes search the Internet for +"Partition Types" or run fdisk command "L". +@* +The disk_path must provide the necessary data bytes at commit time. +An empty disk_path disables this feature for the given partition number. +@* +@cindex SUN SPARC boot images, activation +With SUN Disk Label (selected by -boot_image any sparc_label=): +@* +partition_number may be 2 to 8. Number 1 will always be the ISO image. +Partition start addresses are aligned to 320 KiB. The type_code does not +matter. Submit 0x0. +@* +Partition image name "." causes the partition to become a copy of the next +lower valid one. +@end table +@c man .TP +@c man .B Jigdo Template Extraction: +@node Jigdo, Charset, Bootable, Options +@section Jigdo Template Extraction +@c man .PP +@cindex Jigdo Template Extraction, _definition +From man genisoimage: +"Jigdo is a tool to help in the distribution of large files like CD and +DVD images; see http://atterer.net/jigdo/ for more details. Debian CDs +and DVD ISO images are published on the web in jigdo format to allow +end users to download them more efficiently." +@* +@command{xorriso} can produce a .jigdo and a .template file together with a +single-session ISO image. +The .jigdo file contains checksums and symbolic file addresses. +The .template file contains the compressed ISO image with reference tags +instead of the content bytes of the listed files. +@* +Input for this process are the normal arguments for a @command{xorriso} session +on a blank -outdev, and a .md5 file which lists those data files which may be +listed in the .jigdo file and externally referenced in the .template file. +Each designated file is represented in the .md5 file by a single text line: +@* +MD5 as 32 hex digits, 2 blanks, size as 12 decimal digits or blanks, 2 blanks, +symbolic file address +@* +The file address in an .md5 line has to bear the same basename as the +disk_path of the file which it shall match. The directory path of +the file address is decisive for To=From mapping, not for file recognition. +After To=From mapping, the file address gets written into the .jigdo +file. Jigdo restore tools will convert these addresses into really +reachable data source addresses from which they can read. +@* +If the list of jigdo parameters is not empty, then @command{xorriso} will +refuse to +write to non-blank targets, it will disable multi-session emulation, and +padding will be counted as part of the ISO image. +@* +@table @asis +@sp 1 +@c man .TP +@item -jigdo parameter_name value +@kindex -jigdo clears JTE or or adds parameter to JTE +@cindex Jigdo Template Extraction, -jigdo +Clear Jigdo Template Extraction parameter list or add a parameter to that list. +The alias names are the corresponding genisoimage options. They are accepted +as parameter names as well. Especially they are recognized by the -as mkisofs +emulation command. +@* +Parameter @strong{clear} with any value empties the whole list. +No .jigdo and .template file will be produced. +@* +@strong{template_path} sets the disk_path for the .template file with the +holed and compressed ISO image copy. +@* +Alias: -jigdo-template +@* +@strong{jigdo_path} sets the disk_path for the .jigdo file with the checksums +and download addresses for filling the holes in .template. +@* +Alias: -jigdo-jigdo +@* +@strong{md5_path} sets the disk_path where to find the .md5 input file. +@* +Alias: -md5-list +@* +@strong{min_size} sets the minimum size for a data file to be listed +in the .jigdo file and being a hole in the .template file. +@* +Alias: -jigdo-min-file-size +@* +@strong{exclude} adds a regular expression pattern which will get compared +with the absolute disk_path of any data file. A match causes the file to +stay in .template in any case. +@* +Alias: -jigdo-exclude +@* +@strong{demand_md5} adds a regular expression pattern which will get compared +with the absolute disk_path of any data file that was not found in the .md5 +list. A match causes a MISHAP event. +@* +Alias: -jigdo-force-md5 +@* +@strong{mapping} adds a string pair of the form To=From to the parameter list. +If a data file gets listed in the .jigdo file, then it is referred by the +file address from its line in the .md5 file. This file address gets checked +whether it begins with the From string. If so, then this string will be +replaced by the To string and a ':' character, before it goes into the .jigdo +file. The From string should end by a '/' character. +@* +Alias: -jigdo-map +@* +@strong{compression} chooses one of "bzip2" or "gzip" for the compression of +the template file. The jigdo file is put out uncompressed. +@* +Alias: -jigdo-template-compress +@* +@strong{checksum_iso} chooses one or more of "md5", "sha1", "sha256", "sha512" +for the auxiliary "# Image Hex" checksums in the jigdo file. The value may e.g. +look like "md5,sha1,sha512". Value "all" chooses all available algorithms. +Note that MD5 stays always enabled. +@* +Alias: -checksum_algorithm_iso +@* +@strong{checksum_template} is like checksum_iso but for "# Template Hex". +@* +Alias: -checksum_algorithm_template +@end table +@c man .TP +@c man .B Character sets: +@node Charset, Exception, Jigdo, Options +@section Character sets +@c man .PP +@cindex Character Set, _definition +File names are strings of non-zero bytes with 8 bit each. Unfortunately +the same byte string may appear as different peculiar national characters +on differently nationalized terminals. +The meanings of byte codes are defined in @strong{character sets} which have +names. Shell command iconv -l lists them. +@* +Character sets should not matter as long as only english alphanumeric +characters are used for file names or as long as all writers and readers +of the media use the same character set. +Outside these constraints it may be necessary to let @command{xorriso} +convert byte codes. +@* +There is an input conversion from input character set to the local character +set which applies when an ISO image gets loaded. A conversion from local +character set to the output character set is performed when an +image tree gets written. The sets can be defined independently by options +-in_charset and -out_charset. Normally one will have both identical, if ever. +@* +If conversions are desired then @command{xorriso} needs to know the name of the +local character set. @command{xorriso} can inquire the same info as +shell command +"locale" with argument "charmap". This may be influenced by environment +variables LC_ALL, LC_CTYPE, or LANG and should match the expectations of +the terminal. +@* +The default output charset is the local character set of the terminal where +@command{xorriso} runs. So by default no conversion happens between local +filesystem +names and emerging names in the image. The situation stays ambigous and the +reader has to riddle what character set was used. +@* +By option -auto_charset it is possible to attribute the output charset name +to the image. This makes the situation unambigous. But if your terminal +character set does not match the character set of the local file names, +then this attribute can become plainly wrong and cause problems at read time. +To prevent this it is necessary to check whether the terminal properly +displays all intended filenames. Check especially the exotic national +characters. +@* +To enforce recording of a particular character set name without any conversion +at image generation time, set -charset and -local_charset to the desired name, +and enable -backslash_codes to avoid evil character display on your terminal. +@table @asis +@sp 1 +@c man .TP +@item -charset character_set_name +@kindex -charset sets input/output character set +@cindex Character Set, for input/output, -charset +Set the character set from which to convert file names when loading an +image and to which to convert when writing an image. +@c man .TP +@item -local_charset character_set_name +@kindex -local_charset sets terminal character set +@cindex Character Set, of terminal, -local_charset +Override the system assumption of the local character set name. +If this appears necessary, one should consider to set -backslash_codes to +"on" in order to avoid dangerous binary codes being sent to the terminal. +@end table +@c man .TP +@c man .B Exception processing: +@node Exception, DialogCtl, Charset, Options +@section Exception processing +@c man .PP +Since the tasks of @command{xorriso} are manifold and prone to external +influence, there +may arise the need for @command{xorriso} to report and handle problem events. +@* +Those events get classified when they are detected by one of the software +modules and forwarded to reporting and evaluation modules which decide about +reactions. Event classes are sorted by severity: +@* +"NEVER" The upper end of the severity spectrum. +@* +"ABORT" The program is being aborted and on its way to end. +@* +"FATAL" The main purpose of the run failed +or an important resource failed unexpectedly. +@* +"FAILURE" An important part of the job could not be performed. +@* +"MISHAP" A FAILURE which can be tolerated during ISO image generation. +@* +"SORRY" A less important part of the job could not be performed. +@* +"WARNING" A situation is suspicious of being not intended by the user. +@* +"HINT" A proposal to the user how to achieve better results. +@* +"NOTE" A harmless information about noteworthy circumstances. +@* +"UPDATE" A pacifier message during long running operations. +@* +"DEBUG" A message which would only interest the program developers. +@* +"ALL" The lower end of the severity spectrum. +@table @asis +@sp 1 +@c man .TP +@item -abort_on severity +@kindex -abort_on controls abort on error +@cindex Process, control abort on error, -abort_on +Set the severity threshold for events to abort the program. +@* +Useful: "NEVER", "ABORT", "FATAL", "FAILURE" , "MISHAP", "SORRY" +@* +It may become necessary to abort the program anyway, despite +the setting by this option. Expect not many "ABORT" events to +be ignorable. +@* +A special property of this option is that it works preemptive if given as +program start argument. I.e. the first -abort_on setting among the +start arguments is in effect already when the first operations of +@command{xorriso} begin. Only "-abort_on" with dash "-" is recognized that way. +@c man .TP +@item -return_with severity exit_value +@kindex -return_with controls exit value +@cindex Process, control exit value, -return_with +Set the threshold and exit_value to be returned at program end if no abort +has happened. This is to allow @command{xorriso} to go on after problems +but to get a failure indicating exit value from the program, nevertheless. +Useful is a value lower than the -abort_on threshold, down to "WARNING". +@* +exit_value may be either 0 (indicating success to the starter of the program) +or a number between 32 and 63. Some other exit_values are used by +@command{xorriso} if it decides to abort the program run: +@* +1=abort due to external signal +@* +2=no program arguments given +@* +3=creation of @command{xorriso} main object failed +@* +4=failure to start libburnia-project.org libraries +@* +5=program abort during argument processing +@* +6=program abort during dialog processing +@c man .TP +@item -report_about severity +@kindex -report_about controls verbosity +@cindex Process, control verbosity, -report_about +Set the threshold for events to be reported. +@* +Useful: "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL" +@* +Regardless what is set by -report_about, messages get always reported if they +reach the severity threshold of -abort_on . +@* +Event messages are sent to the info channel "I" which is usually stderr +but may be influenced by command -pkt_output. +Info messages which belong to no event get attributed severity "NOTE". +@* +A special property of this option is that the first -report_about setting +among the start arguments is in effect already when the first operations +of @command{xorriso} begin. Only "-report_about" with dash "-" is +recognized that way. +@c man .TP +@item -signal_handling mode +@kindex -signal_handling controls handling of system signals +@cindex Control, signal handling, -signal_handling +Control the installation of a signal handler which shall react on external +signals (e.g. from program "kill" or from keys Ctrl+C) or on signals +caused by severe program errors. +@* +Mode "on" is the default. It uses the signal handler of libburn which produces +ugly messages but puts much effort in releasing optical drives +before @command{xorriso} ends. +@* +Mode "off" as first -signal_handling among the start arguments prevents all +own signal precautions of @command{xorriso}. Inherited signal +handler settings stay as they are. +@* +It works like "sig_dfl" if given after other signal handling was already +established at program start. +@* +Mode "sig_dfl" uses the system provided default handling of signals, which is +normally a sudden abort of the program. To prevent stuck drives, the +libburn handler is used during burning, blanking, and formatting on MMC drives. +@* +Mode "sig_ign" tries to ignore as many signal types as possible. This imposes +the risk that @command{xorriso} refuses to end until externally kill -9 +if performed. +kill -9 then imposes the risk that the drive is left in unusable state and +needs poweroff to be reset. So during burning, blanking, and formatting +wait for at least their normal run time before killing externally. +@* +A special property of this option is that the first -signal_handling setting +among the start arguments is in effect already when the first operations +of @command{xorriso} begin. Only "-signal_handling" with dash "-" is +recognized that way. +@c man .TP +@item -error_behavior occasion behavior +@kindex -error_behavior controls error workarounds +@cindex Process, error workarounds, -error_behavior +Control the program behavior at problem event occasions. +For now this applies to occasions "image_loading" which is given while +an image tree is read from the input device, and to "file_extraction" which +is given with osirrox options like -extract. +@* +With "image_loading" there are three behaviors available: +@* +"best_effort" goes on with reading after events with severity below FAILURE +if the threshold of option -abort_on allows this. +@* +"failure" aborts image tree reading on first event of at least SORRY. +It issues an own FAILURE event. +This is the default. +@* +"fatal" acts like "failure" but issues the own event as FATAL. +@* +With occasion "file_extraction" there are three behaviors: +@* +"keep" maintains incompletely extracted files on disk. This is the default. +@* +"delete" removes files which encountered errors during content extraction. +@* +"best_effort" starts a revovery attempt by means of -extract_cut if the +file content stems from the loaded ISO image and is not filtered. +@end table +@c man .TP +@c man .B Dialog mode control: +@node DialogCtl, Inquiry, Exception, Options +@section Dialog mode control +@table @asis +@c man .TP +@item -dialog "on"|"off"|"single_line" +@kindex -dialog enables dialog mode +@cindex Dialog, enable dialog mode, -dialog +Enable or disable to enter dialog mode after all arguments are processed. +In dialog mode input lines get prompted via readline or from stdin. +@* +If no -abort_on severity was set when dialog starts, then "NEVER" is set +to avoid abort in most cases of wrong input or other problems. Before dialog +begins, the default is "FAILURE" which e.g. aborts on unknown commands. +@* +Mode "on" supports input of newline characters within quotation marks and +line continuation by trailing backslash outside quotation marks. +Mode "single_line" does not. +@c man .TP +@item -page length width +@kindex -page set terminal geometry +@cindex Dialog, terminal geometry, -page +Describe terminal to the text pager. See also above, paragraph Result pager. +@* +If parameter length is nonzero then the user gets prompted after that +number of terminal lines. Zero length disables paging. +@* +Parameter width is the number of characters per terminal line. It is used +to compute the number of terminal lines which get occupied by an output line. +A usual terminal width is 80. +@c man .TP +@item -use_readline "on"|"off" +@kindex -use_readline enables readline for dialog +@cindex Dialog, line editing, -use_readline +If "on" then use readline for dialog. Else use plain stdin. +@* +See also above, paragraph Dialog, Readline, Result pager. +@c man .TP +@item -reassure "on"|"tree"|"off" +@kindex -reassure enables confirmation question +@cindex Dialog, confirmation question, -reassure +If "on" then ask the user for "y" or "n": +@* +before deleting or overwriting any file in the ISO image, +@* +before overwriting any disk file during restore operations, +@* +before rolling back pending image changes, +@* +before committing image changes to media, +@* +before changing the input drive, +@* +before blanking or formatting media, +@* +before ending the program. +@* +With setting "tree" the reassuring prompt will appear for an eventual +directory only once and not for each file in its whole subtree. +@* +Setting "off" silently kills any kind of image file object resp. performs +above irrevocable actions. +@* +To really produce user prompts, option -dialog needs to be set to "on". +Note that the prompt does not appear in situations where file removal +is forbidden by option -overwrite. -reassure only imposes an additional +curb for removing existing file objects. +@* +Be aware that file objects get deleted from the ISO image immediately +after confirmation. They are gone even if the running command gets aborted +and its desired effect gets revoked. In case of severe mess-up, consider to +use -rollback to revoke the whole session. +@end table +@c man .TP +@c man .B Drive and media related inquiry actions: +@node Inquiry, Navigate, DialogCtl, Options +@section Drive and media related inquiry actions +@table @asis +@c man .TP +@item -devices +@kindex -devices gets list of drives +@cindex Drive, get drive list, -devices +Show list of available MMC drives with the addresses of +their libburn standard device files. +@* +This is only possible when no ISO image changes are pending. +After this option was executed, there is no drive current +and no image loaded. +@* +In order to be visible, a device has to offer rw-permissions +with its libburn standard device file. Thus it might be only the +@strong{superuser} +who is able to see all drives. +@* +Drives which are occupied by other processes get not shown. +@c man .TP +@item -device_links +@kindex -device_links gets list of drives +@cindex Drive, get drive list, -device_links +Like -devices, but presenting the drives with addresses of symbolic links +which point to the actual device files. +@* +Modern GNU/Linux systems may shuffle drive addresses from boot to boot. +The udev daemon is supposed to create links which always point to the +same drive, regardless of its system address. +The command -device_links shows the addresses of such links if they begin +by "/dev/dvd" or "/dev/cd". +Precedence is: "dvdrw", "cdrw", "dvd", "cdrom", "cd". +@c man .TP +@item -toc +@* +@kindex -toc shows list of sessions +@cindex Table-of-content, show, -toc +Show media specific table of content. This is the session history +of the medium, not the ISO image directory tree. +@* +In case of overwriteable media holding a valid ISO image, it may happen that +only a single session gets shown. But if the first session on the +overwriteable media was written by @command{xorriso} then a complete +session history can be emulated. +@* +A drive which is incapable of writing may show any media as CD-ROM or DVD-ROM +with only one or two sessions on it. The last of these sessions is supposed +to be the most recent real session then. +@* +Some read-only drives and media show no usable session history at all. +Option -rom_toc_scan might help. +@c man .TP +@item -mount_cmd drive entity id path +@kindex -mount_cmd composes mount command line +@cindex Session, mount command line, -mount_cmd +Emit an appropriate command line for mounting the ISO session +indicated by drive, entity and id. +The result will be different on GNU/Linux and on FreeBSD. +@* +drive can be "indev" or "outdev" to indicate already acquired drives, +or it can be the path of a not yet acquired drive. +Prefix "stdio:" for non-MMC drives is not mandatory. +@* +entity must be either "sbsector" with the superblock sector address as id, +or "track" with a track number as id, or "session" with a session number, +or "volid" with a search pattern for the volume id, or "auto" with any text +as id. +@* +path will be used as mount point and must already exist as a directory on disk. +@* +The command gets printed to the result channel. See option -mount +for direct execution of this command. +@c man .TP +@item -mount_opts option[:option...] +@kindex -mount_cmd controls mount command +@cindex Session, mount parameters, -mount_opts +Set options which influence -mount and -mount_cmd. Currently there is only +option "exclusive" which is default and its counterpart "shared". The latter +causes @command{xorriso} not to give up the affected drive with command -mount. +On GNU/Linux it adds mount option "loop" which may allow to mount several +sessions of the same block device at the same time. One should not write +to a mounted optical medium, of course. Take care to umount all sessions +before ejecting. +@c man .TP +@item -session_string drive entity id format +@kindex -session_string composes session info line +@cindex Session, info string, -session_string +Print to the result channel a text which gets composed according to +format and the parameters of the addressed session. +@* +Formats "linux:"path or "freebsd:"path produce the output of -mount_cmd +for the given operating systems. +@* +In other texts @command{xorriso} will substitute the following parameter names. +An optional prefix "string:" will be removed. +@* +"%device%" will be substituted by the mountable device path of the drive +address. +@* +"%sbsector%" will be substituted by the session start sector. +@* +"%track%", "%session%", "%volid%" will be substituted by track number, +session number, resp. volume id of the depicted session. +@c man .TP +@item -print_size +@kindex -print_size predicts image size +@cindex Write, predict image size, -print_size +Print the foreseeable consumption of 2048 byte blocks +by next -commit. This can last a while as a -commit gets +prepared and only in last moment is revoked by this option. +The result depends on several settings and also on the kind of output device. +If no -jidgo options are given and not command -as "mkisofs" was used, +then -padding (300 kB by default) is not counted as part of the image size. +@c man .TP +@item -tell_media_space +@kindex -tell_media_space reports free space +@cindex Write, free space, -tell_media_space +Print available space on the output medium and the free space after +subtracting already foreseeable consumption by next -commit. +@c man .TP +@item -pvd_info +@kindex -pvd_info shows image id strings +@cindex Image, show id strings, -pvd_info +Print various id strings which can be found in loaded ISO images. Some of +them may be changed by options like -volid or -publisher. For these +ids -pvd_info reports what would be written with the next -commit. +@end table +@c man .TP +@c man .B Navigation in ISO image and disk filesystem: +@node Navigate, Verify, Inquiry, Options +@section Navigation in ISO image and disk filesystem +@table @asis +@c man .TP +@item -cd iso_rr_path +@kindex -cd sets working directory in ISO +@cindex Navigate, set ISO working directory, -cd +Change the current working directory in the ISO image. +This is prepended to iso_rr_paths which do not begin with '/'. +@* +It is possible to set the working directory to a path which does not exist +yet in the ISO image. The necessary parent directories will be created when +the first file object is inserted into that virtual directory. +Use -mkdir if you want to enforce the existence of the directory already at +first insertion. +@c man .TP +@item -cdx disk_path +@kindex -cdx sets working directory on disk +@cindex Navigate, set disk working directory, -cdx +Change the current working directory in the local filesystem. +To be prepended to disk_paths which do not begin with '/'. +@c man .TP +@item -pwd +@* +@kindex -pwd tells working directory in ISO +@cindex Navigate, tell ISO working directory, -pwd +Tell the current working directory in the ISO image. +@c man .TP +@item -pwdx +@kindex -pwdx tells working directory on disk +@cindex Navigate, tell disk working directory, -pwdx +@* +Tell the current working directory in the local filesystem. +@c man .TP +@item -ls iso_rr_pattern [***] +@kindex -ls lists files in ISO image +@cindex Navigate, list ISO files, -ls +List files in the ISO image which match shell patterns +(i.e. with wildcards '*' '?' '[a-z]'). +If a pattern does not begin with '/' then it is compared with addresses +relative to -cd. +@* +Directories are listed by their content rather than as single file item. +@* +Pattern expansion may be disabled by command -iso_rr_pattern. +@c man .TP +@item -lsd iso_rr_pattern [***] +@kindex -lsd lists files in ISO image +@cindex Navigate, list ISO files, -lsd +Like -ls but listing directories as themselves and not by their content. +This resembles shell command ls -d. +@c man .TP +@item -lsl iso_rr_pattern [***] +@kindex -lsl lists files in ISO image +@cindex Navigate, list ISO files, -lsl +Like -ls but also list some of the file attributes. +The output format resembles shell command ls -ln. +@* +File type 'e' indicates the El Torito boot catalog. +@* +If the file has non-trivial ACL, then a '+' is appended to the permission info. +If the file is hidden, then 'I' for "iso_rr", 'J' for "joliet", resp. 'H' for +"on" gets appended. Together with ACL it is 'i', 'j', resp. 'h'. +@c man .TP +@item -lsdl iso_rr_pattern [***] +@kindex -lsdl lists files in ISO image +@cindex Navigate, list ISO files, -lsdl +Like -lsd but also list some of the file attributes. +The output format resembles shell command ls -dln. +@c man .TP +@item -lsx disk_pattern [***] +@kindex -lsx lists files on disk +@cindex Navigate, list disk files, -lsx +List files in the local filesystem which match shell patterns. Patterns which +do not begin with '/' are used relative to -cdx. +@* +Directories are listed by their content rather than as single file item. +@* +Pattern expansion may be disabled by command -disk_pattern. +@c man .TP +@item -lsdx disk_pattern [***] +@kindex -lsdx lists files on disk +@cindex Navigate, list disk files, -lsdx +Like -lsx but listing directories as themselves and not by their content. +This resembles shell command ls -d. +@c man .TP +@item -lslx disk_pattern [***] +@kindex -lslx lists files on disk +@cindex Navigate, list disk files, -lslx +Like -lsx but also listing some of the file attributes. +Output format resembles shell command ls -ln. +@c man .TP +@item -lsdlx disk_pattern [***] +@kindex -lsdlx lists files on disk +@cindex Navigate, list disk files, -lsdlx +Like -lsdx but also listing some of the file attributes. +Output format resembles shell command ls -dln. +@c man .TP +@item -getfacl iso_rr_pattern [***] +@kindex -getfacl shows ACL in ISO image +@cindex ACL, show in ISO image, -getfacl +Print the access permissions of the given files in the ISO image using the +format of shell command getfacl. If a file has no ACL then it gets fabricated +from the -chmod settings. A file may have a real ACL if it was introduced into +the ISO image while option -acl was set to "on". +@c man .TP +@item -getfacl_r iso_rr_pattern [***] +@kindex -getfacl_r shows ACL in ISO image +@cindex ACL, show in ISO image, -getfacl_r +Like -gefacl but listing recursively the whole file trees underneath eventual +directories. +@c man .TP +@item -getfattr iso_rr_pattern [***] +@kindex -getfattr shows xattr in ISO image +@cindex xattr, show in ISO image, -getfattr +Print the xattr of the given files in the ISO image. +If a file has no such xattr then noting is printed for it. +@c man .TP +@item -getfattr_r iso_rr_pattern [***] +@kindex -getfattr_r shows xattr in ISO image +@cindex xattr, show in ISO image, -getfattr_r +Like -gefattr but listing recursively the whole file trees underneath eventual +directories. +@c man .TP +@item -du iso_rr_pattern [***] +@kindex -du show directory size in ISO image +@cindex Navigate, directory size in ISO image, -du +Recursively list size of directories and files in the ISO image +which match one of the patterns. +similar to shell command du -k. +@c man .TP +@item -dus iso_rr_pattern [***] +@kindex -dus show directory size in ISO image +@cindex Navigate, directory size in ISO image, -dus +List size of directories and files in the ISO image +which match one of the patterns. +Similar to shell command du -sk. +@c man .TP +@item -dux disk_pattern [***] +@kindex -dux show directory size on disk +@cindex Navigate, directory size in on disk, -dux +Recursively list size of directories and files in the local filesystem +which match one of the patterns. Similar to shell command du -k. +@c man .TP +@item -dusx disk_pattern [***] +@kindex -dusx show directory size on disk +@cindex Navigate, directory size in on disk, -dusx +List size of directories and files in the local filesystem +which match one of the patterns. +Similar to shell command du -sk. +@c man .TP +@item -findx disk_path [-name pattern] [-type t] [-exec action [params]] @minus{}@minus{} +@kindex -findx traverses disk tree +@cindex Tree, disk, traverse, -findx +Like -find but operating on local filesystem and not on the ISO image. +This is subject to the settings of -follow. +@* +-findx accepts the same -type arguments as -find. Additionally it recognizes +type "mountpoint" (or "m") which matches subdirectories which reside on a +different device than their parent. It never matches the disk_path +given as start address for -findx. +@* +-findx accepts the -exec actions as does -find. But except the following few +actions it will always perform action "echo". +@* +@table @asis +@sp 1 +@item in_iso +reports the path if its counterpart exists in the ISO image. +For this the disk_path of the -findx command gets replaced +by the iso_rr_path given as parameter. +@* +E.g.: -findx /home/thomas -exec in_iso /thomas_on_cd @minus{}@minus{} +@* +@item not_in_iso +reports the path if its counterpart does +not exist in the ISO image. The report format is the same as with command +-compare. +@* +@item add_missing iso_rr_path_start +adds the counterpart if it does not yet +exist in the ISO image and marks it for "rm_merge" as non-removable. +@* +E.g.: -findx /home/thomas -exec add_missing /thomas_on_cd @minus{}@minus{} +@* +@item is_full_in_iso +reports if the counterpart in the ISO image +contains files. To be used with -type "m" to report mount points. +@* +@item empty_iso_dir +deletes all files from the counterpart +in the ISO image. To be used with -type "m" to truncate mount points. +@* +@item estimate_size +prints a lower and an upper estimation of the number of blocks which the +found files together will occupy in the emerging ISO image. +This does not account for the superblock, +for the directories in the -findx path, or for image padding. +@* +@item list_extattr mode +prints a script to the result channel, which would use FreeBSD command +setextattr to set the file's xattr name-value pairs of user namespace. +See -find for a description of parameter mode. +@* +E.g. -exec list_extattr e -- +@end table +@c man .TP +@item -compare disk_path iso_rr_path +@kindex -compare reports ISO/disk differences +@cindex Verify, compare ISO and disk file, -compare +Compare attributes and eventual data file content of a fileobject in the +local filesystem with a file object in the ISO image. The iso_rr_path may +well point to an image file object which is not yet committed, i.e. of which +the data content still resides in the local filesystem. Such data content is +prone to externally caused changes. +@* +If iso_rr_path is empty then disk_path is used as path in the ISO image too. +@* +Differing attributes are reported in detail, differing content is summarized. +Both to the result channel. In case of no differences no result lines are +emitted. +@c man .TP +@item -compare_r disk_path iso_rr_path +@kindex -compare_r reports ISO/disk differences +@cindex Verify, compare ISO and disk tree, -compare_r +Like -compare but working recursively. I.e. all file objects below both +addresses get compared whether they have counterparts below the other address +and whether both counterparts match. +@c man .TP +@item -compare_l disk_prefix iso_rr_prefix disk_path [***] +@kindex -compare_l reports ISO/disk differences +@cindex Verify, compare ISO and disk, -compare_l +Perform -compare_r with each of the disk_path arguments. iso_rr_path will be +composed from disk_path by replacing disk_prefix by iso_rr_prefix. +@c man .TP +@item -show_stream iso_rr_path [***] +@kindex -show_stream shows data source and filters +@cindex Filter, show chain, -show_stream +Display the content stream chain of data files in the ISO image. The chain +consists of the iso_rr_name and one or more streams, separated by " < " marks. +A stream description consists of one or more texts, separated by ":" +characters. +The first text tells the stream type, the following ones, if ever, describe its +individual properties. +Frequently used types are: +@* + disk:'disk_path' for local filesystem objects. +@* + image:'iso_rr_path' for ISO image file objects. +@* + cout:'disk_path offset count' for -cut_out files. +@* + extf:'filter_name' for external filters. +@* +Example: +@* + '/abc/xyz.gz' < extf:'gzip' < disk:'/home/me/x' +@c man .TP +@item -show_stream_r iso_rr_path [***] +@kindex -show_stream_r shows data source and filters +@cindex Filter, show chains of tree, -show_stream_r +Like -show_stream but working recursively. +@end table +@c man .TP +@c man .B Evaluation of readability and recovery: +@node Verify, Restore, Navigate, Options +@section Evaluation of readability and recovery +@c man .PP +It is not uncommon that optical media produce read errors. The reasons may be +various and get obscured by error correction which is performed by the drives +and based on extra data on the media. If a drive returns data then one can +quite trust that they are valid. But at some degree of read problems the +correction will fail and the drive is supposed to indicate error. +@* +@command{xorriso} can scan a medium for readable data blocks, classify them +according +to their read speed, save them to a file, and keep track of successfuly saved +blocks for further tries on the same medium. +@* +By option -md5 checksums may get recorded with data files and whole +sessions. These checksums are reachable only via indev and a loaded image. +They work independently of the media type and can detect transmission errors. +@table @asis +@sp 1 +@c man .TP +@item -check_media [option [option ...]] @minus{}@minus{} +@kindex -check_media reads media block by block +@cindex Verify, check blocks, -check_media +@cindex Recovery, retrieve blocks, -check_media +Try to read data blocks from the indev drive, optionally copy them to a +disk file, and finally report about the encountered quality. Several options +may be used to modify the default behavior. +@* +The options given with this command override the default settings which +may have been changed by option -check_media_defaults. See there for a +description of options. +@* +The result list tells intervals of 2 KiB blocks with start address, number +of blocks and quality. Qualities which begin with "+" are +supposed to be valid readable data. Qualities with "-" are unreadable or +corrupted data. +"0" indicates qualities which are not covered by the check run or are regularly +allowed to be unreadable (e.g. gaps between tracks). +@* +Alternatively it is possible to report damaged files rather than blocks. +@* +If -md5 is "on" then the default mode what=tracks looks out for libisofs +checksum tags for the ISO session data and checks them +against the checksums computed from the data stream. +@c man .TP +@item -check_media_defaults [option [option ...]] @minus{}@minus{} +@kindex -check_media_defaults sets -check_media options +@cindex Verify, preset -check_media, -check_media_defaults +Preset options for runs of -check_media, -extract_cut and best_effort +file extraction. Options given with -check_media will override the +preset options. -extract_cut will override some options automatically. +@* +An option consists of a keyword, a "=" character, and a value. Options +may override each other. So their sequence matters. +@* +The default setting at program start is: +@* +use=indev what=tracks min_lba=-1 max_lba=-1 retry=default +@* +time_limit=28800 item_limit=100000 data_to='' event=ALL +@* +abort_file=/var/opt/xorriso/do_abort_check_media +@* +sector_map='' map_with_volid=off patch_lba0=off report=blocks +@* +bad_limit=valid slow_limit=1.0 chunk_size=0s +@* +Option "reset=now" restores these startup defaults. +@* +Non-default options are: +@* +@table @asis +@sp 1 +@item report="files" +lists the files which use damaged blocks (not with use=outdev). +The format is like with find -exec report_damage. +Note that a MD5 session mismatch marks all files of the session as damaged. +If finer distinction is desired, perform -md5 off before -check_media. +@* +@item report="blocks_files" +first lists damaged blocks and then affected files. +@* +@item use="outdev" +reads from the output drive instead of the input drive. This +avoids loading the ISO image tree from media. +@* +@item use="sector_map" +does not read any media but loads the file given by option +sector_map= and processes this virtual outcome. +@* +@item what="disc" +scans the payload range of a medium without respecting track gaps. +@* +@item what="image" +similar to "disc", but restricts scanning to the range of the ISO 9660 image, +if present. +@* +@item min_lba=limit +omits all blocks with addresses lower than limit. +@* +@item max_lba=limit +switches to what=disc and omits all blocks above limit. +@* +@item retry="on" +forces read retries with single blocks when the normal read +chunk produces a read error. By default, retries are only enabled with CD +media. "retry=off" forbits retries for all media types. +@* +@item abort_file=disk_path +gives the path of the file which may abort a scan run. Abort +happens if the file exists and its mtime is not older than the start time +of the run. Use shell command "touch" to trigger this. +Other than an aborted program run, this will report the tested and untested +blocks and go on with running @command{xorriso}. +@* +@item time_limit=seconds +gives the number of seconds after which the scan shall be +aborted. This is useful for unattended scanning of media which may else +overwork the drive in its effort to squeeze out some readable blocks. +Abort may be delayed by the drive gnawing on the last single read operation. +Value -1 means unlimited time. +@* +@item item_limit=number +gives the number of report list items after which to abort. +Value -1 means unlimited item number. +@* +@item data_to=disk_path +copies the valid blocks to the given file. +@* +@item event=severity +sets the given severity for a problem event which shall be issued at +the end of a check run if data blocks were unreadable or failed to match +recorded MD5 checksums. Severity "ALL" disables this event. +@* +@item sector_map=disk_path +tries to read the file given by disk_path as +sector bitmap and to store such a map file after the scan run. +The bitmap tells which blocks have been read successfully in previous runs. +It allows to do several scans on the same medium, even with intermediate +eject, in order to collect readable blocks whenever the drive is lucky enough +to produce them. The stored file contains a human readable TOC of tracks +and their start block addresses, followed by binary bitmap data. +@* +@item map_with_volid="on" +examines tracks whether they are ISO images and +prints their volume ids into the human readable TOC of sector_map=. +@* +@item patch_lba0="on" +transfers within the data_to= file a copy of the currently +loaded session head to the start of that file and patches it to be valid +at that position. +This makes the loaded session the default session of the image file +when it gets mounted or loaded as stdio: drive. But it usually makes +the original session 1 inaccessible. +@* +@item patch_lba0="force" +performs patch_lba0="on" even if @command{xorriso} believes +that the copied data are not valid. +@* +patch_lba0= may also bear a number. If it is 32 or higher it is taken as +start address of the session to be copied. In this case it is not necessary to +have an -indev and a loaded image. ":force" may be appended after the number. +@* +@item bad_limit=threshold +sets the highest quality which shall be considered as damage. +Choose one of "good", "md5_match", "slow", "partial", "valid", "untested", +"invalid", "tao_end", "off_track", "md5_mismatch", "unreadable". +@* +@item slow_limit=threshold +sets the time threshold for a single read chunk to be considered +slow. This may be a fractional number like 0.1 or 1.5. +@* +@item chunk_size=size +sets the number of bytes to be read in one read operation. +This gets rounded down to full blocks of 2048 bytes. 0 means automatic size. +@end table +@c man .TP +@kindex -check_md5 verifies file checksum +@cindex Verify, file checksum, -check_md5 +@item -check_md5 severity iso_rr_path [***] +Compare the data content of the given files in the loaded image with their +recorded MD5 checksums, if there are any. In case of any mismatch an event of +the given severity is issued. It may then be handled by appropriate settings of +options -abort_on or -return_with which both can cause non-zero exit values +of the program run. Severity ALL suppresses that event. +@* +This option reports match and mismatch of data files to the result channel. +Non-data files cause NOTE events. There will also be UPDATE events from +data reading. +@* +If no iso_rr_path is given then the whole loaded session is compared with its +MD5 sum. Be aware that this covers only one session and not the whole image +if there are older sessions. +@c man .TP +@item -check_md5_r severity iso_rr_path [***] +@kindex -check_md5_r verifies file tree checksums +@cindex Verify, file tree checksums, -check_md5_r +Like -check_md5 but checking all data files underneath the given paths. +Only mismatching data files will be reported. +@end table +@c man .TP +@c man .B osirrox ISO-to-disk restore options: +@node Restore, Emulation, Verify, Options +@section osirrox ISO-to-disk restore options +@c man .PP +Normally @command{xorriso} only writes to disk files which were given as stdio: +pseudo-drives or as log files. +But its alter ego osirrox is able to extract file objects +from ISO images and to create, overwrite, or delete file objects on disk. +@* +Disk file exclusions by -not_mgt, -not_leaf, -not_paths apply. +If disk file objects already exist then the settings of -overwrite and +-reassure apply. But -overwrite "on" only triggers the behavior +of -overwrite "nondir". I.e. directories cannot be deleted. +@* +Access permissions of files in the ISO image do not restrict restoring. +The directory permissions on disk have to allow rwx. +@table @asis +@sp 1 +@c man .TP +@item -osirrox "on"|"device_files"|"off"|"banned"|[:option:...] +@kindex -osirrox enables ISO-to-disk copying +@cindex Restore, enable ISO-to-disk, -osirrox +Setting "off" disables disk filesystem manipulations. This is the default +unless the program was started with leafname "osirrox". Elsewise +the capability to restore files can be enabled explicitly by -osirrox "on". +It can be irrevocably disabled by -osirrox "banned". +@* +To enable restoring of special files by "device_files" is potentially +dangerous. +The meaning of the number st_rdev (see man 2 stat) depends much on the +operating system. Best is to restore device files only to the same system +from where they were copied. If not enabled, device files in the ISO image +are ignored during restore operations. +@* +Due to a bug of previous versions, device files from previous sessions might +have been altered to major=0, minor=1. So this combination does not get +restored. +@* +Option "concat_split_on" is default. It enables restoring of split file +directories as data files if the directory contains a complete collection +of -cut_out part files. With option "concat_split_off" such directories are +handled like any other ISO image directory. +@* +Option "auto_chmod_off" is default. If "auto_chmod_on" is set then access +restrictions for disk directories get circumvented if those directories +are owned by the effective user who runs @command{xorriso}. This happens +by temporarily granting rwx permission to the owner. +@* +Option "sort_lba_on" may improve read performance with optical drives. It +allows to restore large numbers of hard links without exhausting +-temp_mem_limit. It does not preserve directory mtime and it needs +-osirrox option auto_chmod_on in order to extract directories which offer no +write permission. Default is "sort_lba_off". +@* +Option "o_excl_on" is the default unless the program was started with leafname +"osirrox". On GNU/Linux it tries to avoid using drives which are mounted or in +use by other libburn programs. +Option "o_excl_off" allows on GNU/Linux to access such drives. Drives which +get acquired while "o_excl_off" will refuse to get blanked, formatted, +written, or ejected. But be aware that even harmless inquiries can spoil +ongoing burns of CD-R[W] and DVD-R[W]. +@* +Option "strict_acl_off" is default. It tolerates on FreeBSD the presence of +directory "default" ACLs in the ISO image. With "strict_acl_on" these +GNU/Linux ACLs cause on FreeBSD a FAILURE event during restore with -acl "on". +@c man .TP +@item -extract iso_rr_path disk_path +@kindex -extract copies file tree to disk +@cindex Restore, copy file tree to disk, -extract +Copy the file objects at and underneath iso_rr_path to their corresponding +addresses at and underneath disk_path. +This is the inverse of -map or -update_r. +@* +If iso_rr_path is a directory and disk_path is an existing directory then +both trees will be merged. Directory attributes get extracted only if the disk +directory is newly created by the copy operation. +Disk files get removed only if they are to be replaced +by file objects from the ISO image. +@* +As many attributes as possible are copied together with restored +file objects. +@c man .TP +@item -extract_single iso_rr_path disk_path +@kindex -extract_single copies file to disk +@cindex Restore, copy file to disk, -extract_single +Like -extract, but if iso_rr_path is a directory then its sub tree gets not +restored. +@c man .TP +@item -extract_l iso_rr_prefix disk_prefix iso_rr_path [***] +@kindex -extract_l copies files to disk +@cindex Restore, copy files to disk, -extract_l +Perform -extract with each of the iso_rr_path arguments. disk_path will be +composed from iso_rr_path by replacing iso_rr_prefix by disk_prefix. +@c man .TP +@item -extract_cut iso_rr_path byte_offset byte_count disk_path +@kindex -extract_cut copies file piece to disk +@cindex Restore, copy file piece to disk, -extract_cut +Copy a byte interval from a data file out of an ISO image into a newly created +disk file. +The main purpose for this is to allow handling of large files if they +are not supported by mount -t iso9660 and if the reading system is unable +to buffer them as a whole. +@* +If the data bytes of iso_rr_path are stored in the loaded ISO image, +and no filter is applied, +and byte_offset is a multiple of 2048, then a special run of -check_media +is performed. It may be quicker and more rugged than the general reading +method. +@c man .TP +@item -cpx iso_rr_path [***] disk_path +@kindex -cpx copies files to disk +@cindex Restore, copy files to disk, -cpx +Copy single leaf file objects from the ISO image to the address given by +disk_path. If more then one iso_rr_path is given then +disk_path must be a directory or non-existent. In the latter case it gets +created and the extracted files get installed in it with the same leafnames. +@* +Missing directory components in disk_path will get created, if possible. +@* +Directories are allowed as iso_rr_path only with -osirrox "concat_split_on" +and only if they actually represent a complete collection of -cut_out split +file parts. +@c man .TP +@item -cpax iso_rr_path [***] disk_path +@kindex -cpax copies files to disk +@cindex Restore, copy files to disk, -cpax +Like -cpx but restoring mtime, atime as in ISO image and trying to set +ownership and group as in ISO image. +@c man .TP +@item -cp_rx iso_rr_path [***] disk_path +@kindex -cp_rx copies file trees to disk +@cindex Restore, copy file trees to disk, -cp_rx +Like -cpx but also extracting whole directory trees from the ISO image. +@* +The resulting disk paths are determined as with shell command cp -r : +If disk_path is an existing directory then the trees will be inserted or merged +underneath this directory and will keep their leaf names. The ISO directory "/" +has no leaf name and thus gets mapped directly to disk_path. +@c man .TP +@item -cp_rax iso_rr_path [***] disk_path +@kindex -cp_rx copies file trees to disk +@cindex Restore, copy file trees to disk, -cp_rx +Like -cp_rx but restoring mtime, atime as in ISO image and trying to set +ownership and group as in ISO image. +@c man .TP +@item -paste_in iso_rr_path disk_path byte_offset byte_count +@kindex -paste_in copies file into disk file +@cindex Restore, copy file into disk file, -paste_in +Read the content of a ISO data file and write it into a data file on disk +beginning at the byte_offset. Write at most byte_count bytes. +This is the inverse of option -cut_out. +@c man .TP +@item -mount drive entity id path +@kindex -mount issues mount command for ISO session +@cindex Session, issue mount command, -mount +Produce the same line as -mount_cmd and then execute it as external program run +after giving up the depicted drive. See also -mount_opts. +This demands -osirrox to be enabled and normally will succeed only for the +superuser. For safety reasons the mount program is only executed if it is +reachable as /bin/mount or /sbin/mount. +@end table +@c man .TP +@c man .B Command compatibility emulations: +@node Emulation, Scripting, Restore, Options +@section Command compatibility emulations (cdrtools) +@c man .PP +Writing of ISO 9660 on CD is traditionally done by program mkisofs +as ISO 9660 image producer and cdrecord as burn program. +@command{xorriso} does not strive for their comprehensive emulation. +Nevertheless it is ready to perform some of its core tasks under control +of commands which in said programs trigger comparable actions. +@table @asis +@sp 1 +@c man .TP +@item -as personality option [options] @minus{}@minus{} +@kindex -as emulates mkisofs or cdrecord +@cindex Emulation, -as +@* +Perform the variable length option list as sparse emulation of the program +depicted by the personality word. +@* +@sp 1 + +@cindex Emulation, mkisofs, -as +@cindex mkisofs, Emulation +Personality "@strong{mkisofs}" accepts the options listed with: +@* + -as mkisofs -help @minus{}@minus{} +@* +Among them: -R (always on), -r, -J, -o, -M, -C, -dir-mode, -file-mode, +-path-list, -m, -exclude-list, +-f, -print-size, -pad, -no-pad, -V, -v, -version, -graft-points, -z, +-no-emul-boot, -b, -c, -boot-info-table, -boot-load-size, -input-charset, -G, +-output-charset, -U, -hide, -hide-joliet, -hide-list, -hide-joliet-list, +file paths and pathspecs. +A lot of options are not supported and lead to failure of the mkisofs +emulation. Some are ignored, but better do not rely on this tolerance. +@* +The supported options are documented in detail in xorrisofs.info +and in man xorrisofs. The description here is focused on the effect +of mkisofs emulation in the context of a @command{xorriso} run. +@* +Other than with the "cdrecord" personality there is no automatic -commit at +the end of a "mkisofs" option list. Verbosity settings -v (= "UPDATE") and +-quiet (= "SORRY") persist. The output file +persists until things happen like -commit, -rollback, -dev, or end of +@command{xorriso}. +-pacifier gets set to "mkisofs" if files are added to the image. +@* +-graft-points is equivalent to -pathspecs on. Note that pathspecs without "=" +are interpreted differently than with @command{xorriso} option -add. +Directories get +merged with the root directory of the ISO image, other filetypes get mapped +into that root directory. +@* +If pathspecs are given and if no output file was chosen before or during the +"mkisofs" option list, then standard output (-outdev "-") will get into effect. +If -o points to a regular file, then it will be truncated to 0 bytes +when finally writing begins. This truncation does not happen if the drive +is chosen by @command{xorriso} options before -as mkisofs or after its +list delimiter. Directories and symbolic links are no valid -o targets. +@* +Writing to stdout is possible only if -as "mkisofs" was among the start +arguments or if other start arguments pointed the output drive to +standard output. +@* +-print-size inhibits automatic image production at program end. This ban is +lifted only if the pending image changes get discarded. +@* +Padding is counted as part of the ISO image if not option --emul-toc +is given. +@* +If no -iso-level is given, then level 1 is chosen when the first file or +directory is added to the image. At the same occasion directory names get +allowed to violate the standard by -compliance option allow_dir_id_ext. +This may be avoided by option -disallow_dir_id_ext. +@* +Option -root is supported. Option -old-root is implemented by @command{xorriso} +commands -mkdir, -cp_clone, -find update_merge, and -find rm_merge. +-root and -old-root set command -disk_dev_ino to "ino_only" and -md5 to "on", +by default. +@minus{}disk_dev_ino can be set to "off" by @minus{}@minus{}old-root-no-ino +resp. to "on" by @minus{}@minus{}old-root-devno . +@minus{}md5 can be set to "off" by @minus{}@minus{}old-root-no-md5 . +@* +Not original mkisofs options are @minus{}@minus{}quoted_path_list , +@minus{}@minus{}hardlinks , @minus{}@minus{}acl , +@minus{}@minus{}xattr , @minus{}@minus{}md5 , @minus{}@minus{}stdio_sync . +They work like the @command{xorriso} options with the +same name and hardcoded argument "on", e.g. -acl "on". +Explicit arguments are expected by @minus{}@minus{}stdio_sync +and @minus{}@minus{}scdbackup_tag. +@* +The capability to preserve multi-session history on overwriteable media +gets disabled by default. It can be enabled by using @minus{}@minus{}emul-toc +with the first session. See -compliance no_emul_toc. +@* +@minus{}@minus{}sort-weight gets as arguments a number and an iso_rr_path. +The number becomes the LBA sorting weight of regular file iso_rr_path or +of all regular files underneath directory iso_rr_path. +(See -find -exec sort_weight). +@* +Adopted from grub-mkisofs are @minus{}@minus{}protective-msdos-label +(see -boot_image grub partition_table=on) and +@minus{}@minus{}modification-date=YYYYMMDDhhmmsscc +(see -volume_date uuid). For EFI bootable GRUB boot images use +@minus{}@minus{}efi-boot. +It performs @minus{}boot_image grub efi_path= surrounded by two +@minus{}boot_image "any" "next". +Alternative option @minus{}e from Fedora genisoimage sets bin_path and +platform_id for EFI, but performs no "next". +@* +For MBR bootable ISOLINUX images there is -isohybrid-mbr FILE, where +FILE is one of the Syslinux files mbr/isohdp[fp]x*.bin . Use this +instead of -G to apply the effect of -boot_image isolinux partition_table=on. +@* +@minus{}@minus{}boot-catalog-hide is -boot_image any cat_hidden=on. +@* +@minus{}mips-boot is the same as -boot_image any mips_path= . +@* +@minus{}mipsel-boot leads to mipsel_path= . +@* +@minus{}partition_offset number is +@minus{}boot_image any partition_offset=number. +@* +Option @minus{}append_partition is supported. +@* +@minus{}untranslated_name_len number is +@minus{}compliance untranslated_name_len=number. +@* +@minus{}@minus{}old-empty is -compliance old_empty. +@* +The options of genisoimage Jigdo Template Extraction are recognized and +performed via @command{xorriso} option -jigdo. See the "Alias:" names there +for the meaning of the genisoimage options. +@* +@sp 1 + +Personalities "@strong{xorrisofs}", "@strong{genisoimage}", +and "@strong{genisofs}" are aliases for "mkisofs". +@* +If @command{xorriso} is started with one of the leafnames "xorrisofs", +"genisofs", +"mkisofs", or "genisoimage", then it performs -read_mkisofsrc and prepends +-as "genisofs" to the command line arguments. +I.e. all arguments will be interpreted mkisofs style until "@minus{}@minus{}" +is encountered. +From then on, options are interpreted as @command{xorriso} options. +@* +@minus{}@minus{}no_rc as first argument of such a program start +prevents interpretation of startup files. See section FILES below. +@* +@sp 1 + +@cindex Emulation, cdrecord, -as +@cindex cdrecord, Emulation +Personality "@strong{cdrecord}" accepts the options listed with: +@* + -as cdrecord -help @minus{}@minus{} +@* +Among them: -v, dev=, speed=, blank=, fs=, -eject, -atip, padsize=, tsize=, +-isosize, -multi, -msinfo, @minus{}@minus{}grow_overwriteable_iso, +write_start_address=, +track source file path or "-" for standard input as track source. +@* +It ignores most other options of cdrecord and cdrskin but refuses on +-audio, -scanbus, and on blanking modes unknown to @command{xorriso}. +@* +The scope is only a single data track per session to be written +to blank, overwriteable, or appendable media. The medium gets closed if +closing is applicable and not option -multi is present. +@* +If an input drive was aquired, then it is given up. +This is only allowed if no image changes are pending. +@* +dev= must be given as @command{xorriso} device address. Addresses like 0,0,0 +or ATA:1,1,0 are not supported. +@* +If a track source is given, then an automatic -commit happens at the end of +the "cdrecord" option list. +@* +@minus{}@minus{}grow_overwriteable_iso +enables emulation of multi-session on overwriteable +media. To enable emulation of a TOC, the first session needs -C 0,32 with +-as mkisofs (but no -M) and @minus{}@minus{}grow_overwriteable_iso +write_start_address=32s with -as cdrecord. +@* +A much more elaborate libburn based cdrecord emulator is the program cdrskin. +@* +Personalites "@strong{xorrecord}", "@strong{wodim}", and "@strong{cdrskin}" +are aliases for "cdrecord". +@* +If @command{xorriso} is started with one of the leafnames "xorrecord", +"cdrskin", "cdrecord", or "wodim", then it automatically prepends -as "cdrskin" +to the command line arguments. I.e. all arguments will be interpreted cdrecord +style until "@minus{}@minus{}" is encountered. +From then on, options are interpreted as @command{xorriso} options. +@* +@minus{}@minus{}no_rc as first argument of such a program start +prevents interpretation of @command{xorriso} startup files. +See section FILES below. +@c man .TP +@item -read_mkisofsrc +@kindex -read_mkisofsrc searches and reads .mkisofsrc file +@cindex Emulation, .mkisofsrc, -read_mkisofsrc +Try one by one to open for reading: + ./.mkisofsrc , $MKISOFSRC , $HOME/.mkisofsrc , $(dirname $0)/.mkisofsrc +@* +On success interpret the file content as of man mkisofs CONFIGURATION, +and end this command. Do not try further files. +The last address is used only if start argument 0 has a non-trivial dirname. +@* +The reader currently interprets the following NAME=VALUE pairs: +APPI (-application_id) , PUBL (-publisher) , SYSI (-system_id) , +VOLI (-volid) , VOLS (-volset_id) +@* +Any other lines will be silently ignored. +@c man .TP +@item -pacifier behavior_code +@kindex -pacifier controls pacifier text form +@cindex Emulation, pacifier form, -pacifier +Control behavior of UPDATE pacifiers during write operations. +The following behavior codes are defined: +@* +"xorriso" is the default format: +@* +Writing: sector XXXXX of YYYYYY [fifo active, nn% fill] +@* +"cdrecord" looks like: +@* +X of Y MB written (fifo nn%) [buf mmm%] +@* +"mkisofs" +@* +nn% done, estimate finish Tue Jul 15 20:13:28 2008 +@c man .TP +@item -scdbackup_tag list_path record_name +@kindex -scdbackup_tag enables scdbackup checksum tag +@cindex Backup, scdbackup checksum tag, -scdbackup +Set the parameter "name" for a scdbackup checksum record. +It will be appended in an scdbackup checksum tag to the -md5 session tag if +the image starts at LBA 0. This is the case if it gets written as first +session onto a sequential medium, or piped into a program, named pipe or +character device. +@* +If list_path is not empty then the record will also be appended to the +data file given by this path. +@* +Program scdbackup_verify will recognize and verify tag resp. record. +@end table +@c man .TP +@c man .B Scripting, dialog and program control features: +@node Scripting, Frontend, Emulation, Options +@section Scripting, dialog and program control features +@table @asis +@c man .TP +@item -no_rc +@kindex -no_rc disables startup files +@cindex Process, disable startup files, -no_rc +@* +Only if used as first command line argument this option +prevents reading and interpretation of startup files. See section FILES below. +@c man .TP +@item -options_from_file fileaddress +@kindex -options_from_file reads commands from file +@cindex Process, read command file, -options_from_file +Read quoted input from fileaddress and execute it like dialog lines. +Empty lines and lines which begin by # are ignored. Normally one line +should hold one @command{xorriso} command and all its arguments. +Nevertheless lines may be concatenated by a trailing backslash. +@* +See also section "Command processing", paragraph "Quoted input". +@c man .TP +@item -help +@kindex -help prints help text +@cindex Program, print help text, -help +@* +Print helptext. +@c man .TP +@item -version +@kindex -version prints help text +@cindex Program, print version, -version +Print program name and version, component versions, license. +@c man .TP +@item -list_extras code +@kindex -list_extras lists compile time extra features +@cindex Program, list extra features, -list_extras +Tell whether certain extra features were enabled at compile time. +Code "all" lists all features and a headline. +Other codes pick a single feature. +Code "codes" lists them. They share names with related commands +(see also there): +@* +"acl" tells whether xorriso has an adapter for local filesystems ACLs. +@* +"xattr" tells whether xorriso has an adapter for local filesystems EA. +@* +"jigdo" tells whether production of Jigdo files is possible. +@* +"zisofs" tells whether zisofs and built-in gzip filters are enabled. +@* +"external_filter" tells whether external filter processes are allowed +and whether they are allowed if real user id and effective user id differ. +@* +"dvd_obs" tells whether 64 kB output to DVD media is default. +@* +"use_readline" tells whether readline may be enabled in dialog mode. +@* +@c man .TP +@item -history textline +@kindex -history brings text into readline history +@cindex Dialog, bring text into history, -history +Copy textline into libreadline history. +@c man .TP +@item -status mode|filter +@kindex -status shows current settings +@cindex Program, show current settings, -status +Print the current settings of @command{xorriso}. +Modes: +@* + short... print only important or altered settings +@* + long ... print all settings including defaults +@* + long_history like long plus history lines +@* +Filters begin with '-' and are compared literally against the +output lines of -status:long_history. A line is put out only +if its start matches the filter text. No wildcards. +@c man .TP +@item -status_history_max number +@kindex -status_history_max curbs -status history +@cindex Program, status history, -status_history_max +Set maximum number of history lines to be reported with -status "long_history". +@c man .TP +@item -list_delimiter word +@kindex -list_delimiter replaces '@minus{}@minus{}' +@cindex Program, replace @minus{}@minus{}, -list_delimiter +Set the list delimiter to be used instead of "@minus{}@minus{}". +It has to be a single word, +must not be empty, not longer than 80 characters, and must not contain +quotation marks. +@* +For brevity the list delimiter is referred as "@minus{}@minus{}" +throughout this text. +@c man .TP +@item -backslash_codes "on"|"off"|mode[:mode] +@kindex -backslash_codes enables backslash conversion +@cindex Program, backslash conversion, -backslash_codes +Enable or disable the interpretation of symbolic representations of special +characters with quoted input, or with program arguments, or with program +text output. If enabled the following translations apply: +@* + \a=bell(007) \b=backspace(010) \e=Escape(033) \f=formfeed(014) +@* + \n=linefeed(012) \r=carriage_return(015) \t=tab(011) +@* + \v=vtab(013) \\=backslash(134) \[0-7][0-7][0-7]=octal_code +@* + \x[0-9a-f][0-9a-f]=hex_code \cC=control-C +@* +Translations can occur with quoted input in 3 modes: +@* + "in_double_quotes" translates only inside " quotation. +@* + "in_quotes" translates inside " and ' quotation. +@* + "with_quoted_input" translates inside and outside quotes. +@* +With the start program arguments there is mode: +@* + "with_program_arguments" translates all program arguments. +@* +@* +Mode "encode_output" encodes output characters. It combines "encode_results" +with "encode_infos". Inside single or double quotation marks encoding applies +to ASCII characters octal 001 to 037 , 177 to 377 and to backslash(134). +Outside quotation marks some harmless control characters stay unencoded: +bell(007), backspace(010), tab(011), linefeed(012), formfeed(014), +carriage_return(015). +@* +Mode "off" is default and disables any translation. +Mode "on" is +"with_quoted_input:with_program_arguments:encode_output". +@c man .TP +@item -temp_mem_limit number["k"|"m"] +@kindex -temp_mem_limit curbs memory consumption +@cindex Program, curb memory, -temp_mem_limit +Set the maximum size of temporary memory to be used for image dependent +buffering. Currently this applies to pattern expansion, LBA sorting, +restoring of hard links. +@* +Default is 16m = 16 MiB, minimum 64k = 64 kiB, maximum 1024m = 1 GiB. +@c man .TP +@item -print text +@kindex -print prints result text line +@cindex Program, print result text line, -print +Print a text line to the result channel which is by default stdout. +@c man .TP +@item -print_info text +@kindex -print_info prints message text line +@cindex Program, print message text line, -print_info +Print a text line to the info channel which is by default stderr. +@c man .TP +@item -print_mark text +@kindex -print_mark prints synchronizing text line +@cindex Program, print synchronizing text line, -print_mark +Print a text line to the mark channel which is by default directed to both, +result and info channel. An empty text will cause no output at all. +@c man .TP +@item -prompt text +@kindex -prompt prompts for enter key +@cindex Program, prompt for enter key, -prompt +Show text at beginning of output line and +wait for the user to hit the Enter key +resp. to send a line via stdin. +@c man .TP +@item -sleep seconds +@kindex -sleep waits for a given time span +@cindex Program, wait a time span, -sleep +Wait for the given number of seconds before perfoming the next command. +Expect coarse granularity no better than 1/100 seconds. +@c man .TP +@item -errfile_log mode path|channel +@kindex -errfile_log logs problematic disk files +@cindex Write, log problematic disk files, -errfile_log +@* +If problem events are related to input files from the filesystem, then their +disk_paths can be logged to a file or to output channels R or I. +@* +Mode can either be "plain" or "marked". The latter causes marker lines which +give the time of log start, burn session start, burn session end, log end +or program end. In mode "plain", only the file paths are logged. +@* +If path is "-" or "-R" then the log is directed to the result channel. +Path "-I" directs it to the info message channel. Any text that does not +begin with "-" is used as path for a file to append the log lines. +@* +Problematic files can be recorded multiple times during one program run. +If the program run aborts then the list might not be complete because +some input file arguments might not have been processed at all. +@* +The errfile paths are transported as messages of very low severity "ERRFILE". +This transport becomes visible with -report_about "ALL". +@c man .TP +@item -session_log path +@kindex -session_log logs written sessions +@cindex Write, log written sessions, -session_log +@cindex Session, log when written, -session_log +If path is not empty it gives the address of a plain text file where +a log record gets appended after each session. This log can be used to +determine the start_lba of a session for mount options -o sbsector= +resp. -s from date or volume id. +@* +Record format is: timestamp start_lba size volume-id +@* +The first three items are single words, the rest of the line is the volume id. +@c man .TP +@item -scsi_log "on"|"off" +@kindex -scsi_log reports SCSI commands +@cindex Drive, report SCSI commands, -scsi_log +Mode "on" enables very verbous logging of SCSI commands and drive replies. +Logging messages get printed to stderr, not to any of the @command{xorriso} +output channels. +@* +A special property of this option is that the first -scsi_log setting +among the start arguments is in effect already when the first operations +of @command{xorriso} begin. +Only "-scsi_log" with dash "-" is recognized that way. +@c man .TP +@item -end +@kindex -end writes pending session and ends program +@cindex Process, end program and write, -end +@cindex Program, end and write, -end +@* +End program after writing pending changes. +@c man .TP +@item -rollback_end +@kindex -rollback_end ends program without writing +@cindex Program, end without writing, -rollback_end +@cindex Process, end program, no writing, -rollback_end +Discard pending changes. End program immediately. +@c man .TP +@item # any text +@kindex # starts a comment line +@cindex Comment, # +Only in dialog or file execution mode, and only as first +non-whitespace in line: +Do not execute the line but store it in readline history. +@end table +@c man .TP +@c man .B Support for frontend programs via stdin and stdout: +@node Frontend, ExDevices, Scripting, Options +@section Support for frontend programs via stdin and stdout +@table @asis +@c man .TP +@item -pkt_output "on"|"off" +@kindex -pkt_output consolidates text output +@cindex Process, consolidate text output, -pkt_output +Consolidate text output on stdout and classify each +line by a channel indicator: +@* + 'R:' for result lines, +@* + 'I:' for notes and error messages, +@* + 'M:' for -mark texts. +@* +Next is a decimal number of which only bit 0 has a meaning for now. +0 means no newline at end of payload, 1 means that the newline character at +the end of the output line belongs to the payload. After another colon and +a blank follows the payload text. +@* +Example: +@* + I:1: enter option and arguments : +@c man .TP +@item -logfile channel fileaddress +@kindex -logfile logs output channels to file +@cindex Process, log output channels to file, -logfile +Copy output of a channel to the given file. Channel may be one of: "." for all +channels, "I" for info messages, "R" for result lines, "M" for -mark texts. +@c man .TP +@item -mark text +@kindex -mark sets synchronizing message +@cindex Process, set synchronizing message, -mark +If text is not empty it will get put out on "M" channel each time +@command{xorriso} is ready for the next dialog line or before +@command{xorriso} performs a command that was entered to the pager prompt. +@c man .TP +@item -prog text +@kindex -prog sets program name +@cindex Program, set name, -prog +Use text as name of this program in subsequent messages +@c man .TP +@item -prog_help text +@kindex -prog_help prints help text +@cindex Program, print help text, -prog_help +Use text as name of this program and perform -help. +@end table +@c man .br +@node Examples, Files, Options, Top +@chapter Examples +@c man .SH EXAMPLES +@c man .SS +@c man .B Overview of examples: +@c man As superuser learn about available drives +@c man .br +@c man Blank medium and compose a new ISO image as batch run +@c man .br +@c man A dialog session doing about the same +@c man .br +@c man Manipulate an existing ISO image on the same medium +@c man .br +@c man Copy modified ISO image from one medium to another +@c man .br +@c man Bring a prepared ISOLINUX tree onto medium and make it bootable +@c man .br +@c man Change existing file name tree from ISO-8859-1 to UTF-8 +@c man .br +@c man Operate on storage facilities other than optical drives +@c man .br +@c man Burn an existing ISO image file to medium +@c man .br +@c man Perform multi-session runs as of cdrtools traditions +@c man .br +@c man Let xorriso work underneath growisofs +@c man .br +@c man Adjust thresholds for verbosity, exit value and program abort +@c man .br +@c man Examples of input timestrings +@c man .br +@c man Incremental backup of a few directory trees +@c man .br +@c man Restore directory trees from a particular ISO session to disk +@c man .br +@c man Try to retrieve blocks from a damaged medium +@cindex Examples +@menu +* ExDevices:: As superuser learn about available drives +* ExCreate:: Blank medium and compose a new ISO image as batch run +* ExDialog:: A dialog session doing about the same +* ExGrowing:: Manipulate an existing ISO image on the same medium +* ExModifying:: Copy modified ISO image from one medium to another +* ExBootable:: Bring a prepared ISOLINUX tree onto medium and make it bootable +* ExCharset:: Change existing file name tree from ISO-8859-1 to UTF-8 +* ExPseudo:: Operate on storage facilities other than optical drives +* ExCdrecord:: Burn an existing ISO image file to medium +* ExMkisofs:: Perform multi-session runs as of cdrtools traditions +* ExGrowisofs:: Let @command{xorriso} work underneath growisofs +* ExException:: Adjust thresholds for verbosity, exit value and program abort +* ExTime:: Examples of input timestrings +* ExIncBackup:: Incremental backup of a few directory trees +* ExRestore:: Restore directory trees from a particular ISO session to disk +* ExRecovery:: Try to retrieve blocks from a damaged medium +@end menu +@c man .SS +@c man .B As superuser learn about available drives +@node ExDevices, ExCreate, Frontend, Examples +@section As superuser learn about available drives +On Linux or FreeBSD consider to give rw-permissions to those users or groups +which shall be able to use the drives with @command{xorriso}. +On Solaris use pfexec. Consider to restrict privileges of @command{xorriso} to +"base,sys_devices" and to give r-permission to user or group. +@* +@sp 1 +$ xorriso -device_links +@* +1 -dev '/dev/cdrom1' rwrw@minus{}@minus{} : 'TSSTcorp' 'DVD-ROM SH-D162C +@* +1 -dev '/dev/cdrw' rwrw@minus{}@minus{} : 'TSSTcorp' 'CDDVDW SH-S223B' +@* +2 -dev '/dev/cdrw3' rwrw@minus{}@minus{} : 'HL-DT-ST' 'BDDVDRW_GGC-H20L' +@c man .SS +@c man .B Blank medium and compose a new ISO image as batch run +@node ExCreate, ExDialog, ExDevices, Examples +@section Blank medium and compose a new ISO image as batch run +Aquire drive /dev/sr2, make medium ready for writing a new image, +fill the image with the files from hard disk directories /home/me/sounds +and /home/me/pictures. +@* +Because no -dialog "on" is given, the program will then end by writing the +session to the medium. +@* +@sp 1 +$ xorriso -outdev /dev/sr2 \ +@* + -blank as_needed \ +@* + -map /home/me/sounds /sounds \ +@* + -map /home/me/pictures /pictures +@* +@sp 1 + +@* +The ISO image may be shaped in a more elaborate way like the following: +Omit some unwanted stuff by removing it from the image directory tree. +Reintroduce some wanted stuff. +@* +@sp 1 +$ cd /home/me +@* +$ xorriso -outdev /dev/sr2 \ +@* + -blank as_needed \ +@* + -map /home/me/sounds /sounds \ +@* + -map /home/me/pictures /pictures \ +@* + -rm_r \ +@* + /sounds/indecent \ +@* + '/pictures/*private*' \ +@* + /pictures/confidential \ +@* + @minus{}@minus{} \ +@* + -cd / \ +@* + -add pictures/confidential/work* @minus{}@minus{} +@* +@sp 1 +Note that '/pictures/*private*' is a pattern for iso_rr_paths +while pictures/confidential/work* gets expanded by the shell +with addresses from the hard disk. Options -add and -map have different +argument rules but finally the same effect: they put files into the image. +@c man .SS +@c man .B A dialog session doing about the same +@c man .br +@node ExDialog, ExGrowing, ExCreate, Examples +@section A dialog session doing about the same as the previous example +Some settings are already given as start argument. The other activities +are done as dialog input. The pager gets set to 20 lines of 80 characters. +@* +The drive is acquired by option -dev rather than -outdev in order to see +the message about its current content. By option -blank this content is +made ready for being overwritten and the loaded ISO image is made empty. +@* +In order to be able to eject the medium, the session needs to be committed +explicitly. +@* +@c man .B $ xorriso -dialog on -page 20 80 -disk_pattern on +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-dev /dev/sr2 +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-blank as_needed +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-map /home/me/sounds /sounds -map /home/me/pictures /pictures +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-rm_r /sounds/indecent /pictures/*private* /pictures/confidential +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-cdx /home/me/pictures -cd /pictures +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-add confidential/office confidential/factory +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-du / +@c man .br +@c man enter option and arguments : +@c man .br +@c man .B \-commit_eject all -end +@c man .br +@sp 1 +@c man-ignore-lines begin +$ xorriso -dialog on -page 20 80 -disk_pattern on +@sp 1 +enter option and arguments : +@* +-dev /dev/sr2 +@sp 1 +enter option and arguments : +@* +-blank as_needed +@sp 1 +enter option and arguments : +@* +-map /home/me/sounds /sounds -map /home/me/pictures /pictures +@sp 1 +enter option and arguments : +@* +-rm_r /sounds/indecent /pictures/*private* /pictures/confidential +@sp 1 +enter option and arguments : +@* +-cdx /home/me/pictures -cd /pictures +@sp 1 +enter option and arguments : +@* +-add confidential/office confidential/factory +@sp 1 +enter option and arguments : +@* +-du / +@sp 1 +enter option and arguments : +@* +-commit_eject all -end +@c man-ignore-lines end +@c man .SS +@c man .B Manipulate an existing ISO image on the same medium +@node ExGrowing, ExModifying, ExDialog, Examples +@section Manipulate an existing ISO image on the same medium +Load image from drive. +Remove (i.e. hide) directory /sounds and its subordinates. +Rename directory /pictures/confidential to /pictures/restricted. +Change access permissions of directory /pictures/restricted. +Add new directory trees /sounds and /movies. +Burn to the same medium, check whether the tree can be loaded, and eject. +@* +@sp 1 +$ xorriso -dev /dev/sr2 \ +@* + -rm_r /sounds @minus{}@minus{} \ +@* + -mv \ +@* + /pictures/confidential \ +@* + /pictures/restricted \ +@* + @minus{}@minus{} \ +@* + -chmod go-rwx /pictures/restricted @minus{}@minus{} \ +@* + -map /home/me/prepared_for_dvd/sounds_dummy /sounds \ +@* + -map /home/me/prepared_for_dvd/movies /movies \ +@* + -commit -eject all +@c man .SS +@c man .B Copy modified ISO image from one medium to another +@node ExModifying, ExBootable, ExGrowing, Examples +@section Copy modified ISO image from one medium to another +Load image from input drive. Do the same manipulations as in the previous +example. Aquire output drive and blank it. Burn the modified image as +first and only session to the output drive. +@* +@sp 1 +$ xorriso -indev /dev/sr2 \ +@* + -rm_r /sounds @minus{}@minus{} \ +@* + ... +@* + -outdev /dev/sr0 -blank as_needed \ +@* + -commit -eject all +@c man .SS +@c man .B Bring a prepared ISOLINUX tree onto medium and make it bootable +@node ExBootable, ExCharset, ExModifying, Examples +@section Bring a prepared ISOLINUX tree onto medium and make it bootable +The user has already created a suitable file tree on disk and copied the +ISOLINUX files into subdirectory ./boot/isolinux of that tree. +Now @command{xorriso} can burn an El Torito bootable medium: +@* +@sp 1 +$ xorriso -outdev /dev/sr0 -blank as_needed \ +@* + -map /home/me/ISOLINUX_prepared_tree / \ +@* + -boot_image isolinux dir=/boot/isolinux +@c man .SS +@c man .B Change existing file name tree from ISO-8859-1 to UTF-8 +@node ExCharset, ExPseudo, ExBootable, Examples +@section Change existing file name tree from ISO-8859-1 to UTF-8 +This example assumes that the existing ISO image was written with character +set ISO-8859-1 but that the readers expected UTF-8. Now a new session with +the same files gets added with converted file names. +In order to avoid any weaknesses of the local character set, this command +pretends that it uses already the final target set UTF-8. +Therefore strange file names may appear in messages, which +will be made terminal-safe by option -backslash_codes. +@* +@sp 1 +$ xorriso -in_charset ISO-8859-1 -local_charset UTF-8 \ +@* + -out_charset UTF-8 -backslash_codes on -dev /dev/sr0 \ +@* + -alter_date m +0 / @minus{}@minus{} -commit -eject all +@c man .SS +@c man .B Operate on storage facilities other than optical drives +@node ExPseudo, ExCdrecord, ExCharset, Examples +@section Operate on storage facilities other than optical drives +Full read-write operation is possible with regular files and block devices: +@* +@sp 1 +$ xorriso -dev /tmp/regular_file ... +@* +@sp 1 +Paths underneath /dev normally need prefix "stdio:" +@* +@sp 1 +$ xorriso -dev stdio:/dev/sdb ... +@* +@sp 1 +If /dev/sdb is to be used frequently and /dev/sda is the system disk, +then consider to place the following lines in a @command{xorriso} Startup File. +They allow to use /dev/sdb without prefix and protect disk /dev/sda +from @command{xorriso}: +@* +@sp 1 + -drive_class banned /dev/sda* +@* + -drive_class harmless /dev/sdb +@* +@sp 1 +Other writeable file types are supported write-only: +@* +@sp 1 +$ xorriso -outdev /tmp/named_pipe ... +@* +@sp 1 +Among the write-only drives is standard output: +@* +@sp 1 +$ xorriso -outdev - \ +@* + ... +@* + | gzip >image.iso.gz +@c man .SS +@c man .B Burn an existing ISO image file to medium +@node ExCdrecord, ExMkisofs, ExPseudo, Examples +@section Burn an existing ISO image file to medium +Actually this works with any kind of data, not only ISO images: +@* +@sp 1 +$ xorriso -as cdrecord -v dev=/dev/sr0 blank=as_needed image.iso +@c man .SS +@c man .B Perform multi-session runs as of cdrtools traditions +@node ExMkisofs, ExGrowisofs, ExCdrecord, Examples +@section Perform multi-session runs as of cdrtools traditions +Between both processes there can be performed arbitrary transportation +or filtering. +@* +The first session is written like this: +@* +@sp 1 +$ xorriso -as mkisofs prepared_for_iso/tree1 | \ +@* + xorriso -as cdrecord -v dev=/dev/sr0 blank=fast -multi -eject - +@* +@sp 1 +Follow-up sessions are written like this: +@* +@sp 1 +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +@* +$ m=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +@* +$ xorriso -as mkisofs -M /dev/sr0 -C $m prepared_for_iso/tree2 | \ +@* + xorriso -as cdrecord -v dev=/dev/sr0 -waiti -multi -eject - +@* +@sp 1 +Always eject the drive tray between sessions. The old sessions +get read via /dev/sr0. Its device driver might not be aware +of the changed content before it loads the medium again. +In this case the previous session would not be loaded and the +new session would contain only the newly added files. +@* +For the same reason do not let @command{xorriso} -as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +@* +@sp 1 +This example works for multi-session media only. +Add cdrskin option @minus{}@minus{}grow_overwriteable_iso +to all -as cdrecord runs +in order to enable multi-session emulation on overwriteable media. +@c man .SS +@c man .B Let xorriso work underneath growisofs +@node ExGrowisofs, ExException, ExMkisofs, Examples +@section Let @command{xorriso} work underneath growisofs +growisofs expects an ISO formatter program which understands options -C and +-M. If @command{xorriso} gets started by name "xorrisofs" then it is suitable +for that. +@* +@sp 1 +$ export MKISOFS="xorrisofs" +@* +$ growisofs -Z /dev/dvd /some/files +@* +$ growisofs -M /dev/dvd /more/files +@* +@sp 1 +If no "xorrisofs" is available on your system, then you will have to create +a link pointing to the @command{xorriso} binary and tell growisofs to use it. +E.g. by: +@* +@sp 1 +$ ln -s $(which xorriso) "$HOME/xorrisofs" +@* +$ export MKISOFS="$HOME/xorrisofs" +@* +@sp 1 +One may quit mkisofs emulation by argument "@minus{}@minus{}" and make +use of all @command{xorriso} commands. growisofs dislikes options which +start with "-o" but -outdev must be set to "-". +So use "outdev" instead: +@* +@sp 1 +$ growisofs -Z /dev/dvd @minus{}@minus{} outdev - -update_r /my/files /files +@* +$ growisofs -M /dev/dvd @minus{}@minus{} outdev - -update_r /my/files /files +@* +@sp 1 +growisofs has excellent burn capabilities with DVD and BD. +It does not emulate session history on overwriteable media, though. +@c man .SS +@c man .B Adjust thresholds for verbosity, exit value and program abort +@node ExException, ExTime, ExGrowisofs, Examples +@section Adjust thresholds for verbosity, exit value and program abort +Be quite verbous, exit 32 if severity "FAILURE" was encountered, +do not abort prematurely but forcibly go on until the end of commands. +@* +@sp 1 +$ xorriso ... \ +@* + -report_about UPDATE \ +@* + -return_with FAILURE 32 \ +@* + -abort_on NEVER \ +@* + ... +@c man .SS +@c man .B Examples of input timestrings +@node ExTime, ExIncBackup, ExException, Examples +@section Examples of input timestrings +@c man .br +@c man As printed by program date: +@c man .B 'Thu Nov 8 14:51:13 CET 2007' +@c man .br +@c man The same without ignored parts: +@c man .B 'Nov 8 14:51:13 2007' +@c man .br +@c man The same as expected by date: +@c man .B 110814512007.13 +@c man .br +@c man Four weeks in the future: +@c man .B +4w +@c man .br +@c man The current time: +@c man .B +0 +@c man .br +@c man Three hours ago: +@c man .B \-3h +@c man .br +@c man Seconds since Jan 1 1970: +@c man .B =1194531416 +@c man-ignore-lines begin +As printed by program date: +@* +'Thu Nov 8 14:51:13 CET 2007' +@sp 1 +The same without ignored parts: +@* +'Nov 8 14:51:13 2007' +@sp 1 +The same as expected by date: +@* +110814512007.13 +@sp 1 +Four weeks in the future: +@* ++4w +@sp 1 +The current time: +@* ++0 +@sp 1 +Three hours ago: +@* +-3h +@sp 1 +Seconds since Jan 1 1970: +@* +=1194531416 +@c man-ignore-lines end +@c man .SS +@c man .B Incremental backup of a few directory trees +@node ExIncBackup, ExRestore, ExTime, Examples +@section Incremental backup of a few directory trees +This changes the directory trees /open_source_project and /personal_mail +in the ISO image so that they become exact copies of their disk counterparts. +ISO file objects get created, deleted or get their attributes adjusted +accordingly. +@* +ACL, xattr, hard links and MD5 checksums will be recorded. +Accelerated comparison is enabled at the expense of potentially larger backup +size. Only media with the expected volume id or blank media are accepted. +Files with names matching *.o or *.swp get excluded explicitly. +@* +When done with writing the new session gets checked by its recorded MD5. +@* +@sp 1 +$ xorriso \ +@* + -abort_on FATAL \ +@* + -for_backup -disk_dev_ino on \ +@* + -assert_volid 'PROJECTS_MAIL_*' FATAL \ +@* + -dev /dev/sr0 \ +@* + -volid PROJECTS_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \ +@* + -not_leaf '*.o' -not_leaf '*.swp' \ +@* + -update_r /home/thomas/projects /projects \ +@* + -update_r /home/thomas/personal_mail /personal_mail \ +@* + -commit -toc -check_md5 FAILURE @minus{}@minus{} -eject all +@* +@sp 1 +To be used several times on the same medium, whenever an update of +the two disk trees to the medium is desired. Begin with a blank medium and +update it until he run fails gracefully due to lack of remaining space on +the old one. +@* +This makes sense if the full backup leaves substantial remaining capacity +on media and if the expected changes are much smaller than the full backup. +To apply zisofs compression to those data files which get newly copied from +the local filesystem, insert these options immediately before -commit : +@* +@sp 1 + -hardlinks perform_update \ +@* + -find / -type f -pending_data -exec set_filter @minus{}@minus{}zisofs @minus{}@minus{} \ +@* +@sp 1 +Options -disk_dev_ino and -for_backup depend on stable device and inode numbers +on disk. Without them, an update run may use -md5 "on" to match recorded MD5 +sums against the current file content on hard disk. This is usually much faster +than the default which compares both contents directly. +@* +With @strong{mount} option @strong{-o "sbsector="} on GNU/Linux +resp. @strong{-s} on FreeBSD +it is possible to access the session trees which represent the older backup +versions. With CD media, GNU/Linux mount accepts session numbers directly by +its option "session=". +@* +Multi-session media and most overwriteable media written by @command{xorriso} +can tell the sbsectors of their sessions by @command{xorriso} option -toc. +Used after -commit the following option prints the matching mount command for +the newly written session (here for mount point /mnt): +@* +@sp 1 + -mount_cmd "indev" "auto" "auto" /mnt +@* +@sp 1 +Options -mount_cmd and -mount are also able to produce the mount commands for +older sessions in the table-of-content. E.g. as superuser: +@* +@sp 1 + # osirrox -mount /dev/sr0 "volid" '*2008_12_05*' /mnt +@* +@sp 1 +@c man .sp 1 +Above example produces a result similar to -root / -old-root / with mkisofs. +For getting the session trees accumulated in the new sessions, let all -update +commands use a common parent directory and clone it after updating is done: +@* + -update_r /home/thomas/projects /current/projects \ +@* + -update_r /home/thomas/personal_mail /current/personal_mail \ +@* + -clone /current /"$(date '+%Y_%m_%d_%H%M%S')" \ +@* +The cloned tree will have a name like /2011_02_12_155700. +@* +@sp 1 +@c man .sp 1 +Sessions on multi-session media are separated by several MB of unused blocks. +So with small sessions the payload capacity can become substantially lower +than the overall media capacity. If the remaining space on a medium does not +suffice for the next gap, the drive is supposed to close the medium +automatically. +@* +@sp 1 +@c man .sp 1 +@strong{Better do not use your youngest backup for -update_r}. +Have at least two media which you use alternatingly. So only older backups +get endangered by the new write operation, while the newest backup is +stored safely on a different medium. +@* +Always have a blank medium ready to perform a full backup in case the update +attempt fails due to insufficient remaining capacity. This failure will +not spoil the old medium, of course. +@c man .SS +@c man .B Restore directory trees from a particular ISO session to disk +@node ExRestore, ExRecovery, ExIncBackup, Examples +@section Restore directory trees from a particular ISO session to disk +This is an alternative to mounting the medium and using normal file operations. +@* +First check which backup sessions are on the medium: +@* +@sp 1 +$ xorriso -outdev /dev/sr0 -toc +@* +@sp 1 +Then load the desired session and copy the file trees to disk. +Enable restoring of ACL, xattr and hard links. +Avoid to create /home/thomas/restored without rwx-permission. +@* +@sp 1 +$ xorriso -for_backup \ +@* + -load volid 'PROJECTS_MAIL_2008_06_19*' \ +@* + -indev /dev/sr0 \ +@* + -osirrox on:auto_chmod_on \ +@* + -chmod u+rwx / @minus{}@minus{} \ +@* + -extract /open_source_projects \ +@* + /home/thomas/restored/open_source_projects \ +@* + -extract /personal_mail /home/thomas/restored/personal_mail \ +@* + -rollback_end +@* +@sp 1 +The final command -rollback_end prevents an error message about the altered +image being discarded. +@c man .SS +@c man .B Try to retrieve blocks from a damaged medium +@node ExRecovery,, ExRestore, Examples +@section Try to retrieve blocks from a damaged medium +@* +@sp 1 +$ xorriso -abort_on NEVER -indev /dev/sr0 \ +@* + -check_media time_limit=1800 report=blocks_files \ +@* + data_to="$HOME"/dvd_copy sector_map="$HOME"/dvd_copy.map @minus{}@minus{} +@* +@sp 1 +This can be repeated several times, if necessary with -eject or with other +-indev drives. See the human readable part of "$HOME"/dvd_copy.map for +addresses which can be used on "$HOME"/dvd_copy with mount option -o sbsector= +resp. -s. +@c man .SH FILES +@node Files, Seealso, Examples, Top +@chapter Files +@c man .SS +@c man .B Program alias names: +@* +@section Program Alias Names +Normal installation of @command{xorriso} creates three links or copies which by their +program name pre-select certain settings: +@* +@sp 1 +@strong{xorrisofs} starts @command{xorriso} with -as mkisofs emulation. +@* +@strong{xorrecord} starts @command{xorriso} with -as cdrecord emulation. +@* +@strong{osirrox} starts with -osirrox "on:o_excl_off" which allows +to copy files from ISO image to disk and to apply option -mount to +one or more of the existing ISO sessions. +@c man .SS +@c man .B Startup files: +@section Startup Files +@* +If not -no_rc is given as the first argument then @command{xorriso} attempts on startup +to read and execute lines from the following files: +@* +@sp 1 + /etc/default/xorriso +@* + /etc/opt/xorriso/rc +@* + /etc/xorriso/xorriso.conf +@* + $HOME/.xorrisorc +@* +@sp 1 +The files are read in the sequence given above, but none of them is required +to exist. The line format is described with command -options_from_file. +@* +If mkisofs emulation was enabled by program name "xorrisofs", "mkisofs", +"genisoimage", or "genisofs", then afterwards -read_mkisofsrc is performed, +which reads .mkisofsrc files. See there. +@c man .SS +@c man .B Runtime control files: +@section Runtime control files +@* +The default setting of -check_media abort_file= is: +@* +@sp 1 + /var/opt/xorriso/do_abort_check_media +@* +@c man .SH SEE ALSO +@c man .TP +@c man For the mkisofs emulation of xorriso +@c man .BR xorrisofs(1) +@c man .TP +@c man For the cdrecord emulation of xorriso +@c man .BR xorrecord(1) +@c man .TP +@c man For mounting xorriso generated ISO 9660 images (-t iso9660) +@c man .BR mount(8) +@c man .TP +@c man Libreadline, a comfortable input line facility +@c man .BR readline(3) +@c man .TP +@c man Other programs which produce ISO 9660 images +@c man .BR mkisofs(8), +@c man .BR genisoimage(8) +@c man .TP +@c man Other programs which burn sessions to optical media +@c man .BR growisofs(1), +@c man .BR cdrecord(1), +@c man .BR wodim(1), +@c man .BR cdrskin(1) +@c man .TP +@c man ACL and xattr +@c man .BR getfacl(1), +@c man .BR setfacl(1), +@c man .BR getfattr(1), +@c man .BR setfattr(1) +@c man .TP +@c man MD5 checksums +@c man .BR md5sum(1) +@c man .TP +@c man On FreeBSD the commands for xattr and MD5 differ +@c man .BR getextattr(8), +@c man .BR setextattr(8), +@c man .BR md5(1) +@c man-ignore-lines begin +@node Seealso, Bugreport, Files, Top +@chapter See also +@table @asis +@item For the mkisofs emulation of @command{xorriso} +xorrisofs(1) +@item For the cdrecord emulation of @command{xorriso} +xorrecord(1) +@item For mounting @command{xorriso} generated ISO 9660 images (-t iso9660) +mount(8) +@item Libreadline, a comfortable input line facility +readline(3) +@item Other programs which produce ISO 9660 images +mkisofs(8), +genisoimage(8) +@item Other programs which burn sessions to optical media +growisofs(1), +cdrecord(1), +wodim(1), +cdrskin(1) +@item ACL and xattr +getfacl(1), +setfacl(1), +getfattr(1), +setfattr(1) +@item MD5 checksums +md5sum(1) +@item On FreeBSD some commands differ: +getextattr(8), +setextattr(8), +md5(1) +@end table +@c man-ignore-lines end +@c man .SH BUGS +@node Bugreport, Legal, Seealso, Top +@chapter Reporting bugs +@cindex Bugs, reporting +@cindex Problems, reporting +To report bugs, request help, or suggest enhancements for @command{xorriso}, +please send electronic mail to the public list @email{bug-xorriso@@gnu.org}. +If more privacy is desired, mail to @email{scdbackup@@gmx.net}. +@* +@sp 1 +Please describe what you expect @command{xorriso} to do, +the program arguments resp. commands by which you tried to achieve it, +the messages of @command{xorriso}, and the undesirable outcome of your +program run. +@* +@sp 1 +Expect to get asked more questions before solutions can be proposed. +@c man .SH AUTHOR +@node Legal, CommandIdx, Bugreport, Top +@chapter Author, Copyright, Credits +@section Author +Thomas Schmitt <scdbackup@@gmx.net> +@* +for libburnia-project.org +@c man .SH COPYRIGHT +@section Copyright +Copyright (c) 2007 - 2011 Thomas Schmitt +@* +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of @command{xorriso}. +If you make use of the license to derive modified versions of +@command{xorriso} then you are entitled to modify this text under that +same license. +@c man .SH CREDITS +@section Credits +@command{xorriso} is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Thanks to Andy Polyakov who invented emulated growing, +to Derek Foreman and Ben Jansens who once founded libburn. +@* +Compliments towards Joerg Schilling whose cdrtools served me for ten years. +@c man-ignore-lines begin + +@node CommandIdx, ConceptIdx, Legal, Top +@chapter Alphabetic Command List +@printindex ky + +@node ConceptIdx,, CommandIdx, top +@chapter Alphabetic List of Concepts and Objects +@printindex cp + +@c man-ignore-lines end +@bye diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_bootstrap.txt b/libisoburn/branches/1.1.8/xorriso/xorriso_bootstrap.txt new file mode 100755 index 00000000..39c94684 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_bootstrap.txt @@ -0,0 +1,10 @@ +#!/bin/sh -x + +aclocal -I . +libtoolize --copy --force +autoconf + +autoheader + +automake --foreign --add-missing --copy --include-deps + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_buildstamp.h b/libisoburn/branches/1.1.8/xorriso/xorriso_buildstamp.h new file mode 100644 index 00000000..f2d17a20 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_buildstamp.h @@ -0,0 +1,3 @@ +#ifndef Xorriso_build_timestamP +#define Xorriso_build_timestamP "-none-given-" +#endif diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_buildstamp_none.h b/libisoburn/branches/1.1.8/xorriso/xorriso_buildstamp_none.h new file mode 100644 index 00000000..f2d17a20 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_buildstamp_none.h @@ -0,0 +1,3 @@ +#ifndef Xorriso_build_timestamP +#define Xorriso_build_timestamP "-none-given-" +#endif diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_eng.html b/libisoburn/branches/1.1.8/xorriso/xorriso_eng.html new file mode 100644 index 00000000..d8acdd7b --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_eng.html @@ -0,0 +1,741 @@ +<HTML> + +<HEAD> +<META NAME="description" CONTENT="GNU xorriso, creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions"> +<META NAME="keywords" CONTENT="xorriso, libburn, libburnia, burn, CD, DVD, BD, ISO, ISO 9660, RockRidge, Rock Ridge, GNU/Linux, Linux, FreeBSD, Solaris, recording, burning, CD-R, CD-RW, DVD-R, DVD-RW, DVD+RW, DVD+R, DVD+R DL, BD-RE, BD-R, scdbackup"> +<META NAME="robots" CONTENT="follow"> +<TITLE>GNU xorriso - GNU Project - Free Software Foundation + + + + + + +
+

+

GNU xorriso

+ +

ISO 9660 Rock Ridge Filesystem Manipulator
+for GNU/Linux, FreeBSD, Solaris

+

+
+ +

+

Purpose:

+xorriso copies file objects from POSIX compliant filesystems +into Rock Ridge enhanced ISO 9660 filesystems and allows +session-wise manipulation of such filesystems. It can load the management +information of existing ISO images and it writes the session results to +optical media or to filesystem objects. +
+Vice versa xorriso is able to copy file objects out of ISO 9660 filesystems. +

+

+ +


+ +Direct hop to download links -> + +

+

Hardware requirements:

+About any CD, DVD, or BD recorder produced in the recent ten years. +
+libburn +supports recorders which are compliant to standards MMC-1 for CD and +MMC-5 for DVD or BD. +
+GNU/Linux, FreeBSD, and Solaris allow to access drives connected +via SCSI, PATA (aka IDE, ATA), USB, or SATA. +
+xorriso also operates on ISO images in data files or block devices. +Images or add-on sessions may be written to about any kind of file object. +

+ +

+

Software requirements :

+
+
GNU/Linux with kernel 2.4 or higher, libc, libpthread :
+
With kernel 2.4 a PATA/IDE drive has to be under ide-scsi emulation.
+
With kernel 2.6 ide-scsi is not needed.
+
or FreeBSD, libc, libpthread :
+
PATA/IDE drives need atapicam running.
+
SATA drives need atapicam running or need to be driven by ahci.
+
libcam has to be installed.
+
libiconv has to be installed.
+
or Solaris, libc, libpthread :
+
Tested on kernel 5.11, hopefully suitable for older ones too.
+
or some other X/Open system, libc, libpthread :
+
+There will be no direct operation of optical drives, but only POSIX i/o +with objects of the local filesystem. +
+
+Might work with DVD-RAM, DVD+RW, BD-RE +but rather not with CD, DVD-R, DVD+R, BD-R. +
+
+ +

Optional supporting software:

+
+
libreadline and libreadline-dev
+
make dialog more convenient.
+
libacl and libacl-devel
+
allow on GNU/Linux to get and set ACLs.
+
zlib and zlib-devel
+
allow zisofs, gzip compression, and Jigdo file production.
+
libbz2 and libbz2-devel
+
allow bzip2 compression of Jigdo template files.
+
+

+ +

+This program has been tested on GNU/Linux, FreeBSD, and Solaris systems.
+For ports to other usable systems contact us. +

+ +
+ +

+

Special features:

+
    +
  • +ISO 9660 formatter and burner for CD, DVD, BD are fixely integrated. +
  • +
  • +Operates on an existing ISO image or creates a new one. +
  • +
  • +Copies files from filesystem into the ISO image and vice versa. +
  • +
  • +Changes file properties, renames or deletes file objects in the ISO image. +
  • +
  • +Updates ISO subtrees incrementally to match given disk subtrees. +
  • +
  • +Can record and restore hard link relations, ACL, and xattr. +
  • +
  • +Can attach MD5 checksums to each data file and the whole session. +
  • +
  • +File content may get zisofs or gzip compressed or filtered by external +processes. +
  • +
  • +Can activate ISOLINUX and GRUB boot images by El Torito boot record and MBR. +
  • +
  • +Writes result as completely new image or as add-on session +to optical media or filesystem objects. +
  • +
  • +Can perform multi-session tasks as emulation of mkisofs and cdrecord. +
  • +
  • +Can issue commands to mount older sessions on GNU/Linux or FreeBSD. +
  • +
  • +Can check media for damages and copy readable blocks to disk. +
  • +
  • +Scans for optical drives, blanks re-useable optical media, formats media. +
  • +
  • +Suitable for: +CD-R, CD-RW, DVD-R, DVD-R DL, DVD-RW, DVD+R, DVD+R DL, DVD+RW, DVD-RAM, +BD-R, BD-RE. +
  • +
  • +Reads its instructions from command line arguments, dialog, and batch files. +
  • +
  • +Provides navigation commands for interactive ISO image manipulation. +
  • + +
+

+ +

+

Command Examples:

+
+ +
Get an overview of drives and their addresses
+
# xorriso -devices
+
...
+
0 -dev '/dev/sr0' rwrw-- : 'TSSTcorp' 'CDDVDW SH-S203B'
+
1 -dev '/dev/scd1' rwrw-- : 'PHILIPS ' 'SPD3300L'
+
2 -dev '/dev/hda' rwrw-- : 'HL-DT-ST' 'DVD-ROM GDR8162B'
+
...
+
Being superuser avoids permission problems with /dev/srN resp. /dev/hdX . +
+
Ordinary users should then get granted rw access to the /dev files +as listed by option -devices.
+
 
+ +
Options are either performed as program arguments or as dialog input. +Some options have a parameter list of variable length. This list has to +be terminated by word '--' or by the end of the input line. Option -add +may accept pathspecs of form target=source as known from program mkisofs.
+ +
+ +
Get info about a particular drive and loaded media:
+
$ xorriso -indev /dev/sr0 -du / -- -toc 2>&1 | less
+ +
Make re-usable media writable again, delete any ISO 9660 image, +prepare yet unused BD-RE:
+
$ xorriso -outdev /dev/sr0 -blank as_needed -eject all
+ +
+
+
+ +
Write some directories into a new or existing ISO 9660 image:
+
$ xorriso -dev /dev/sr0 -add /home/me/sounds /home/me/pictures +
+ +
Have a look at the result:
+
$ xorriso -indev /dev/sr0 -du / -- -toc 2>&1 | less
+ +
+
+
+ +
Create new ISO-9660 filesystem image, compose content, +adjust permissions to make it publicly read-only, +write it to media and immediately eject media without +previously reloading the written image. +
+
$ cd /home/me
+
$ xorriso -outdev /dev/sr0 -blank as_needed \
+
  -map /home/me/sounds /sounds \
+
  -map /home/me/pictures /pictures \
+
  -rm_r /sounds/indecent '/pictures/*private*' -- \
+
  -cd / \
+
  -add pictures/private/horses* -- \
+
  -chmod_r a+r,a-w / -- \
+
  -find / -type d -exec chmod a+x -- \
+
  -volid SOUNDS_PICS_2008_01_16 \
+
  -commit_eject all
+
+
+
+ +
Load the previous session from media, +remove (i.e. hide) directory /sounds, +rename /pictures/private/horses, +add new directory trees /sounds and /movies, +disallow any access for group and others. +Finally write as additional session to media and eject:
+
$ xorriso -dev /dev/sr0 \
+
  -rm_r /sounds -- \
+
  -mv /pictures/private/horses /horse_show -- \
+
  -map /home/me/prepared_for_dvd/sounds_dummy /sounds \
+
  -map /home/me/prepared_for_dvd/movies /movies \
+
  -chmod_r go-rwx / -- \
+
  -volid SOUNDS_PICS_2008_01_17 \
+
  -commit_eject all
+
+
+
+ +
Merge the various sessions from old readable media into a single session +on new writeable media, +cleaning out all invalidated files and session overhead. +Touch / in order to mark the image as worth to be written. +
+Important: -indev and -outdev have to be different drives. +
+
$ xorriso -indev /dev/dvd \
+
  -alter_date a +0 / -- \
+
  -outdev /dev/sr0 -blank fast \
+
  -commit_eject all
+ +
+
+
+ +
Dialog mode accepts one or more options per line. An option and all its +arguments have to be given in one single line. Backslash may be used to mark +a line as incomplete so it gets continued by the next input line. +
+Command -end stops the program run. It will write pending changes +to media, if that has not already been done by a previous -commit.
+
$ xorriso -dialog on
+
enter option and arguments :
+
-dev /dev/sr0
+
enter option and arguments :
+
-map /home/me/prepared_for_dvd/sounds_dummy /sounds
+
enter option and arguments :
+
-map /home/me/prepared_for_dvd/movies \
+
Trailing backslash : Enter rest of line (or @@@ to clear it) : +
+
/movies
+
Available navigation commands: -cd, -ls, -du, -find
+
enter option and arguments :
+
-commit
+
... perform further commands and finally do:
+
enter option and arguments :
+
-end
+ +
+
+
+ +
The following command performs incremental backup. +It can be run on blank media to create a copy of the mentioned disk +directory trees, and it can be run on appendable media to perform a +minimal set of change operations which update the old ISO copies +to match the new disk trees. +Older states can be retrieved by help of mount options like "sbsector=" +or by help of xorriso option -mount. +
+Eventual ACL, xattr and hardlink relations will be recorded. MD5 checksums +will be computed and recorded. Data comparison will be avoided by accelerator +option -disk_dev_ino. After writing, the new session will be checked +by its recorded MD5. +
+Only blank media or media with volume id "PROJECTS_MAIL_..." will be accepted. +Files with names ending by ".o" or ".swp" are excluded by options -not_leaf. +
+
$ xorriso -for_backup -disk_dev_ino on \
+
   -assert_volid 'PROJECTS_MAIL_*' FATAL \
+
   -dev /dev/sr0 \
+
   -volid PROJECTS_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \
+
   -not_leaf '*.o' -not_leaf '*.swp' \
+
   -update_r /home/thomas/projects /projects \
+
   -update_r /home/thomas/personal_mail /personal_mail \
+
   -commit -toc -check_md5 FAILURE -- -eject all
+ +
+To apply zisofs compression to those data files which get newly copied from +the local filesystem, perform immediately before -commit : +
   -hardlinks perform_update \
+
+   -find / -type f -pending_data -exec set_filter --zisofs -- \
+ + + +
+
+
+ +
+Operating systems usually mount the most recent session on media. +xorriso can issue the appropriate mount commands for older sessions. +First get an overview of the sessions on the media: +
+
$ xorriso -outdev /dev/sr0 -toc
+
+TOC layout   : Idx ,  sbsector ,       Size , Volume Id
+ISO session  :   1 ,         0 ,    104719s , PROJECTS_MAIL_2008_08_10_231435
+ISO session  :   2 ,    106928 ,      6785s , PROJECTS_MAIL_2008_08_14_184548
+...
+ISO session  :  76 ,    820384 ,     11035s , PROJECTS_MAIL_2009_01_04_191150
+
+ +
+Then become superuser and let xorriso mount the session of August 14, 2008 +to directory /mnt: +
+
# + xorriso -osirrox on -mount /dev/sr0 volid '*_2008_08_14_*' /mnt +
+
+To be later unmounted by: umount /mnt +
+ +
+
+
+ +
+After the user has already created a suitable file tree on disk +and copied the ISOLINUX files into subdirectory ./boot/isolinux of +that tree, xorriso can burn an El Torito bootable media: +
+
$ xorriso -outdev /dev/sr0 -blank as_needed \
+
   -map /home/me/ISOLINUX_prepared_tree / \
+
   -boot_image isolinux dir=/boot/isolinux
+
+An additional MBR is generated if the file isolinux.bin is modern enough +(syslinux version 3.72) and ready for "isohybrid". An MBR enables booting +from hard disk or USB stick. +
+
+ +
ISO images may not only be stored on optical media but also in +regular disk files or block devices for full multi-session operation. +
+
$ xorriso -dev /tmp/regular_file ...other.options...
+
+A default setting for safety reasons requires that files below /dev/ +need prefix "stdio:" if they do not lead to MMC burner devices. +Be cautious not to overwrite your hard disk instead of your USB stick: +
+
$ xorriso -dev stdio:/dev/sdb ...other.options...
+ +
Other file types are suitable only for writing but not for reading:
+
$ xorriso -outdev /tmp/named_pipe ...other.options...
+ +
In batch mode it is possible to operate xorriso in a pipeline +with an external consumer of the generated ISO image. Any message +output will be redirected to stderr in this case. +Examples for consumers are cdrecord or growisofs on operating systems +where xorriso cannot operate the burner drive directly, +or a ssh pipe to another system which has the desired drive +and a suitable burn program.
+
$ xorriso -outdev - ...other.options... | consumer
+ + +
+
+
+ +
+Let xorriso serve underneath growisofs via its alias name "xorrisofs" +which enables mkisofs emulation: +
+
$ export MKISOFS="xorrisofs"
+
$ growisofs -Z /dev/dvd /some/files
+
$ growisofs -M /dev/dvd /more/files
+
+One may switch from mkisofs emulation to xorriso's own command mode: +
+
$ growisofs -M /dev/dvd -- outdev - -update_r /my/files /files +
+ +
+
+
+ +
If for any reason the reading operating system mishandles the ISO image +or some files in it, one may enable reverse operation of xorriso and copy +files or trees to disk: +
$ xorriso -acl on -xattr on \
+
   -indev /dev/sr0 \
+
   -osirrox on \
+
   -cpx '/pictures/private/horses*/*buttercup*' \
+
       /home/her/buttercup_dir -- \ +
   -extract /sounds /home/her/sounds_from_me
+ +
Each copy command processes its files sorted by block address +in the ISO image in order to reduce head moves with optical media. +This can bring effective read performance near to the raw media reading speed. +
+
Consider to enter dialog mode and use commands like +-cd , -du , -lsl , -find. +
+
+
+ + +
Get overview of the options:
+
$ xorriso -help
+ +
Read the detailed manual page:
+
$ man xorriso
+
+ +

+ +
+ +

+

+

Download as source code (see README):

+
xorriso-1.1.6.tar.gz +(1945 KB). +
+
(Released 27 Sep 2011)
+
xorriso-1.1.6.tar.gz.sig
+
+(detached GPG signature for verification by +gpg --verify xorriso-1.1.6.tar.gz.sig xorriso-1.1.6.tar.gz +
+after gpg --keyserver keys.gnupg.net --recv-keys ABC0A854). +
+
+Also on +mirrors of ftp://ftp.gnu.org/gnu/ +as xorriso/xorriso-1.1.6.tar.gz +
+
+ + +
Documentation:
+
README about installation and drive setup
+
xorriso -help gives an overview of options
+
xorriso -as mkisofs -help + supported options of mkisofs emulation +
+
xorriso -as cdrecord -help + supported options of cdrecord emulation
+
man xorriso is the manual page
+
man xorrisofs +describes the mkisofs emulation
+
man xorrecord +describes the cdrecord emulation
+
+ +
Contact:
+
GNU xorriso support mailing list, +bug-xorriso@gnu.org
+
libburnia development mailing list, +libburn-hackers@pykix.org
+
Thomas Schmitt, scdbackup@gmx.net
+
+
License:
+
GPL version 3 or later. +
+
 
+
+

+ +
+ +

+Bug fixes towards xorriso-1.1.4: +

    +
  • -extract_single extracted directory content
  • +
  • -extract was not immediately aborted if -abort_on was triggered
  • +
  • xorriso did not write to files in filesystems with >= 4 TB free space
  • +
  • ACL entries of groups and of user id 0 were not properly recorded +and cannot be restored.
  • +
  • No ACLs were recorded on FreeBSD
  • + +
+

+ + + +

+Enhancements towards previous stable version xorriso-1.1.4: +

    +
  • Enabled recording and restoring of extattr on FreeBSD
  • +
  • New option -list_extras
  • +
  • New -osirrox option strict_acl
  • +
  • New -find and -findx action list_extattr
  • +
  • Worked around a collision with Linux udev which lets device links vanish +
  • + +
+

+ +
+ +

+

+Software copies included in GNU xorriso: +

+
+
+GNU xorriso is feature-wise equivalent to the dynamic compilation of + libburnia +libraries, libjte, and libburnia program xorriso. +It restricts itself to a technical form where the legal commitments of the +libburnia project and the legal intentions of + FSF match completely. +
+
 
+
libburn-1.1.6
+
reads and writes data from and to CD, DVD, BD.
+
(founded by Derek Foreman and Ben Jansens, +developed and maintained since August 2006 by +Thomas Schmitt from team of libburnia-project.org)
+
libisofs-1.1.6
+
operates on ISO 9660 filesystem images.
+
(By Vreixo Formoso, Mario Danic and Thomas Schmitt +from team of libburnia-project.org)
+
libisoburn-1.1.6
+
coordinates libburn and libisofs, emulates multi-session where needed, +and hosts the original source code of program xorriso.
+
It provides the complete functionality of xorriso via +a C language API.
+
(By Vreixo Formoso and Thomas Schmitt +from team of libburnia-project.org)
+
libjte-1.0.0
+
produces jigdo and template file together with the emerging ISO image.
+
(By Free Software Foundation, Steve McIntyre, George Danchev, +Thomas Schmitt)
+
 
+
The source code of this software is independent of +cdrecord and mkisofs.
+
+

+ +
+ +

+

+

Development snapshot, version 1.1.7 :

+
Bug fixes towards xorriso-1.1.6: +
    +
  • libburn misinterpreted mode page 2A if block descriptors are present
  • + +
+
+
Enhancements towards stable version 1.1.6: +
    +
  • New option -sleep
  • +
  • Info document and man page for xorrecord
  • + +
+ +
+ + +
 
+
README 1.1.7 +
xorriso-1.1.7 -help
+
xorriso-1.1.7 -as mkisofs -help
+
xorriso-1.1.7 -as cdrecord -help
+
man xorriso (as of 1.1.7)
+
man xorrisofs (as of 1.1.7)
+
man xorrecord (as of 1.1.7)
+
 
+
If you want to distribute development versions of xorriso, then use +this tarball which produces static linking between xorriso and the +libburnia libraries. +
+
Source (./bootstrap is already applied, build tested, +installation see README) +
+
+xorriso-1.1.7.tar.gz +(1990 KB). +
+
A dynamically linked development version of xorriso can be obtained +from repositories of + libburnia-project.org. +xorriso is part of libisoburn/trunk and will get built by its "make". +
+ +
Be warned that the libraries in SVN and bzr are development versions with +possibly unstable API/ABI enhancements. Do not distribute development +versions for dynamic linking. Only release versions are safe for that. +
+
Download: svn co http://svn.libburnia-project.org/libburn/trunk libburn +
+
Install: cd libburn ; ./bootstrap ; ./configure --prefix /usr ; make ; make install +
+
Download: +bzr branch lp:~libburnia-team/libisofs/scdbackup +
+
Install: cd libisofs ; ./bootstrap ; ./configure --prefix /usr ; make ; make install +
+
Download: svn co http://svn.libburnia-project.org/libisoburn/trunk libisoburn +
+
Install: cd libisoburn ; ./bootstrap ; ./configure --prefix /usr ; make ; make install +
+
Build of SVN versions needs of at least version 1.7 installed. +But after the run of ./bootstrap, only +vanilla tools like make and gcc are needed. +
+
GNU xorriso contains a copy of libjte-1.0.0 from package jigit +which produces jigdo and template file together with the emerging ISO image. +(By Free Software Foundation, Steve McIntyre, George Danchev, +Thomas Schmitt) +
+
Important: If desired, libjte has to be already installed when libisofs +and libisoburn get built.
+
Download: wget http://www.einval.com/~steve/software/JTE/download/jigit_1.17.orig.tar.gz +
+
Install: tar xzf jigit_1.17.orig.tar.gz ; cd jigit-1.17 ; make ; make install +
+ +
 
+
+

+ +
+ +

+Many thanks to Derek Foreman and Ben Jansens for starting libburn. +
+Very special thanks to Andy Polyakov whose +dvd+rw-tools +provide the libburnia project with invaluable examples on how to deal +with DVD media and how to emulate multi-session on overwriteable media. +

+
+ + + + +

+

+ +Dedicated to the GNU Operating System
+ +Enjoying free hosting by
+www.webframe.org
+sourceforge.net
+ + + +
+

+ +
+
+
Links to related free software projects of Thomas Schmitt:
+
+cdrskin, a cdrecord emulator
+
+scdbackup, multi volume CD/DVD/BD backup
+
+(a second source of above)
+
+ + + +
+Legal statement: This website does not serve any commercial purpose. +

+Copyright © 2008 - 2011 Thomas Schmitt. +
+This text is freely distributable. It shall only be modified in sync with +the factual properties of xorriso and its public storage locations. +If you make use of the license to derive modified versions of xorriso +then you are entitled to modify this text under that same license. +
+
Contact for issues of this web page or the described program:
+
Thomas Schmitt, scdbackup@gmx.net
+
GNU xorriso support mailing list, +bug-xorriso@gnu.org
+
libburnia development mailing list, +libburn-hackers@pykix.org
+
+
+ + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_main.c b/libisoburn/branches/1.1.8/xorriso/xorriso_main.c new file mode 100644 index 00000000..929a29f9 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_main.c @@ -0,0 +1,300 @@ + +/* xorriso - Command line oriented batch and dialog tool which creates, loads, + manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Initial code of this program was derived from program src/askme.c out + of scdbackup-0.8.8, Copyright 2007 Thomas Schmitt, BSD-License. + + Provided under GPL version 2 or later, with the announcement that this + might get changed in future. I would prefer BSD or LGPL as soon as the + license situation of the library code allows that. + (This announcement affects only future releases of xorriso and it will + always be possible to derive a GPLv2+ from the future license.) + + There is a derived package "GNU xorriso" under GPLv3+ which combines the + libburnia libraries and program xorriso to a statically linked binary. + + + Overview of xorriso architecture: + + libburn provides the ability to read and write data. + + libisofs interprets and manipulates ISO 9660 directory trees. It generates + the output stream which is handed over to libburn. + + libisoburn by its lower level API encapsulates the connectivity issues + between libburn and libisofs. This API also enables multi-session emulation + on overwritable media and random access file objects. + + xorriso is the higher level API of libisoburn which allows to operate all + three libraries by a unified set of commands. + exposes the public functions. + Among these functions are direct equivalents of the xorriso interpreter + commands. There are also functions for fundamental management and for + handling event messages. + + This file xorriso_main.c runs the xorriso API as batch and dialog program. + + One should not mix the use of the xorriso API with the use of the lower + level APIs of libburn, libisofs, libisoburn. + + -------------------------------------------------------------------------- + The following overview is relevant for development but not for usage of + xorriso. An application programmer should read xorriso.h and man xorriso + resp. info xorriso, rather than diving into its source code. + For examples see the functions main() and check_compatibility() below. + -------------------------------------------------------------------------- + + The xorriso source is divided in two groups: + + A set of source modules interacts with the lower level library APIs: + + base_obj.[ch] fundamental operations of the XorrisO object + lib_mgt.[ch] manages the relation between xorriso and the libraries + drive_mgt.[ch] operates on drives and media + iso_img.[ch] operates on ISO images and their global properties + iso_tree.[ch] access nodes of the libisofs tree model + iso_manip.[ch] manipulates the libisofs tree model + sort_cmp.[ch] sorts and compare tree nodes + write_run.[ch] functions to write sessions + read_run.[ch] functions to read data from ISO image + filters.[ch] operates on data filter objects + xorrisoburn.h declarations needed by the non-library modules + + Another set is independent of the lower level APIs: + + parse_exec.c deals with parsing and interpretation of command input + sfile.c functions around files and strings + aux_objects.c various helper classes + misc_funct.c miscellaneous helper functions + findjob.c performs tree searches in libisofs or in POSIX filesystem + check_media.c perform verifying runs on media resp. images + text_io.c text i/o functions + match.c functions for pattern matching + emulators.c emulators for mkisofs and cdrecord + disk_ops.c actions on onjects of disk filesystems + cmp_update.c compare or update files between disk filesystem and + ISO filesystem + opts_a_c.c options -a* to -c* + opts_d_h.c options -d* to -h* + opts_i_o.c options -i* to -o* + opts_p_z.c options -p* to -z* + + xorriso_private.h contains the definition of struct Xorriso and for + convenience includes the .h files of the non-library group. + +*/ + +#ifdef HAVE_CONFIG_H +#include "../config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include + + +/* xorriso_main.c includes the internal copy of the API definition */ +/* The official xorriso options API is defined in */ +#include "xorriso.h" + + +/* The minimum version of libisoburn xorriso API to be used with this + version of xorriso. +*/ +#define Xorriso_req_majoR 1 +#define Xorriso_req_minoR 1 +#define Xorriso_req_micrO 7 + + +static void yell_xorriso() +{ + fprintf(stderr, + "%sxorriso %d.%d.%d%s : RockRidge filesystem manipulator, libburnia project.\n\n", +#ifdef Xorriso_GNU_xorrisO + "GNU ", +#else + "", +#endif + Xorriso_header_version_majoR, Xorriso_header_version_minoR, + Xorriso_header_version_micrO, Xorriso_program_patch_leveL); +} + + +/* Check whether build configuration and runtime linking are consistent. +*/ +static void check_compatibility() +{ + int lib_major, lib_minor, lib_micro; + +/* First an ugly compile time check for header version compatibility. + If everthing matches, then no C code is produced. In case of mismatch, + intentionally faulty C code will be inserted. +*/ +/* The minimum requirement of xorriso towards the libisoburn header + at compile time is defined above + Xorriso_req_majoR + Xorriso_req_minoR + Xorriso_req_micrO + It gets compared against the version macros in xorriso.h : + Xorriso_header_version_majoR + Xorriso_header_version_minoR + Xorriso_header_version_micrO + If the header is too old then the following code shall cause failure of + cdrskin compilation rather than to allow production of a program with + unpredictable bugs or memory corruption. + The compiler messages supposed to appear in this case are: + error: 'XORRISO_MISCONFIGURATION' undeclared (first use in this function) + error: 'INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_xorriso_dot_h_TOO_OLD__SEE_xorriso_main_dot_c' undeclared (first use in this function) + error: 'XORRISO_MISCONFIGURATION_' undeclared (first use in this function) +*/ +/* The indendation is an advise of man gcc to help old compilers ignoring */ + #if Xorriso_req_majoR > Xorriso_header_version_majoR + #define Xorriso_dot_h_too_olD 1 + #endif + #if Xorriso_req_majoR == Xorriso_header_version_majoR && Xorriso_req_minoR > Xorriso_header_version_minoR + #define Xorriso_dot_h_too_olD 1 + #endif + #if Xorriso_req_minoR == Xorriso_header_version_minoR && Xorriso_req_micrO > Xorriso_header_version_micrO + #define Xorriso_dot_h_too_olD 1 + #endif + +#ifdef Xorriso_dot_h_too_olD +XORRISO_MISCONFIGURATION = 0; +INTENTIONAL_ABORT_OF_COMPILATION__HEADERFILE_xorriso_dot_h_TOO_OLD__SEE_xorriso_main_dot_c = 0; +XORRISO_MISCONFIGURATION_ = 0; +#endif + +/* End of ugly compile time test (scroll up for explanation) */ + + + /* Needed are at least 44 bits in signed type off_t . + This is a popular mistake in configuration or compilation. + */ + if(sizeof(off_t) < 6) { + yell_xorriso(); + fprintf(stderr, + "xorriso : FATAL : Compile time misconfiguration. sizeof(off_t) too small.\n\n"); + exit(4); + } + + /* Check whether the linked xorriso code is young enough. + */ + if(! Xorriso__is_compatible(Xorriso_header_version_majoR, + Xorriso_header_version_minoR, + Xorriso_header_version_micrO, 0)) { + yell_xorriso(); + Xorriso__version(&lib_major, &lib_minor, &lib_micro); + fprintf(stderr, + "xorriso : FATAL : libisoburn/xorriso runtime version mismatch. Found %d.%d.%d, need %d.%d.%d\n\n", + lib_major, lib_minor, lib_micro, + Xorriso_header_version_majoR, Xorriso_header_version_minoR, + Xorriso_header_version_micrO); + exit(4); + } + +} + + +int main(int argc, char **argv) +{ + int ret, i; + struct XorrisO *xorriso= NULL; + char **orig_argv= NULL; + + check_compatibility(); /* might exit() */ + + if(argc < 2) { + yell_xorriso(); + fprintf(stderr,"usage : %s [options]\n", argv[0]); + fprintf(stderr, " More is told by option -help\n"); + exit(2); + } + setlocale(LC_CTYPE, ""); + ret= Xorriso_new(&xorriso, argv[0], 0); + if(ret <= 0) { + fprintf(stderr,"Creation of XorrisO object failed. (not enough memory ?)\n"); + exit(3); + } + + /* The prescan of arguments performs actions which have to happen before + the normal processing of startup files and arguments. + Among them are -help and -prog_help which end the program without + yelling its name and version. + */ + ret= Xorriso_prescan_args(xorriso,argc,argv,0); + if(ret == 0) + goto end_successfully; + /* Put out program name and version to stderr only if not done already now */ + yell_xorriso(); + if(ret < 0) + exit(5); + /* After having yelled xorriso, prescan again for unknown arguments */ + ret= Xorriso_prescan_args(xorriso, argc, argv, 2); + if(ret < 0) + exit(5); + + /* The following command interpreters are allowed only after this + initialization. + */ + ret= Xorriso_startup_libraries(xorriso, 0); + if(ret <= 0) + {ret= 4; goto emergency_exit;} + Xorriso_process_msg_queues(xorriso, 0); + + /* Interpret startup files */ + ret= Xorriso_read_rc(xorriso, 0); + if(ret == 3) + goto end_successfully; + if(ret <= 0) + {ret= 5; goto emergency_exit;} + + /* Interpret program arguments */ + orig_argv= argv; + ret= Xorriso_program_arg_bsl(xorriso, argc, &argv, 0); + if(ret <= 0) + {ret= 5; goto emergency_exit;} + i= 1; + ret= Xorriso_interpreter(xorriso, argc, argv, &i, 2); + if(ret == 3) + goto end_successfully; + if(ret <= 0) + {ret= 5; goto emergency_exit;} + + /* Enter dialog mode if it has been activated meanwhile */ + ret= Xorriso_dialog(xorriso, 0); + if(ret <= 0) + {ret= 6; goto emergency_exit;} + +end_successfully:; /* normal shutdown, including eventual -commit */ + Xorriso_process_msg_queues(xorriso, 0); + if(Xorriso_change_is_pending(xorriso, 1)) + Xorriso_option_end(xorriso, 2); + Xorriso_process_msg_queues(xorriso, 0); + ret= Xorriso_make_return_value(xorriso, 0); + Xorriso_process_errfile(xorriso, 0, "xorriso end", 0, 1); + Xorriso_destroy(&xorriso, 1); + if(orig_argv != argv && orig_argv != NULL) { + for(i= 0; i < argc; i++) + if(argv[i] != NULL) + free(argv[i]); + free(argv); + } + exit(ret); + +emergency_exit:; + if(xorriso != NULL) { /* minimal shutdown */ + Xorriso_process_msg_queues(xorriso, 0); + Xorriso_destroy(&xorriso, 1); + } + exit(ret); +} + + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_makefile_am.txt b/libisoburn/branches/1.1.8/xorriso/xorriso_makefile_am.txt new file mode 100644 index 00000000..8b97027c --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_makefile_am.txt @@ -0,0 +1,335 @@ + +# Copyright (c) 2007 - 2010 Thomas Schmitt +# Provided under GPL version 2 or later. + +# ts A90315 : LIBBURNIA_PKGCONFDIR is defined OS specific in acinclude.m4 +# was: pkgconfigdir=$(libdir)/pkgconfig +pkgconfigdir=$(LIBBURNIA_PKGCONFDIR) + +libincludedir= + +lib_LTLIBRARIES = +ACLOCAL_AMFLAGS = -I ./ + +## ========================================================================= ## + +libinclude_HEADERS = + +## ========================================================================= ## + +bin_PROGRAMS = \ + xorriso/xorriso + +xorriso_xorriso_CPPFLAGS = -I./libburn -I./libisofs -I./libisoburn -I./xorriso + +# ts B00518 : The configuration macros are now transmitted via config.h +# xorriso_xorriso_CFLAGS = -DXorriso_standalonE \ +# $(READLINE_DEF) $(LIBACL_DEF) $(XATTR_DEF) \ +# $(EXTF_DEF) $(EXTF_SUID_DEF) $(ZLIB_DEF) \ +# $(LIBCDIO_DEF) \ +# $(XORRISO_DVD_OBS_64K) $(LIBBURN_O_DIRECT_DEF) +xorriso_xorriso_CFLAGS = + +xorriso_xorriso_LDADD = $(THREAD_LIBS) $(LIBBURN_ARCH_LIBS) + + +xorriso_xorriso_SOURCES = \ + \ + xorriso/xorriso.h \ + xorriso/xorriso_private.h \ + xorriso/xorriso_main.c \ + xorriso/sfile.h \ + xorriso/sfile.c \ + xorriso/aux_objects.h \ + xorriso/aux_objects.c \ + xorriso/findjob.h \ + xorriso/findjob.c \ + xorriso/check_media.h \ + xorriso/check_media.c \ + xorriso/misc_funct.h \ + xorriso/misc_funct.c \ + xorriso/text_io.h \ + xorriso/text_io.c \ + xorriso/match.h \ + xorriso/match.c \ + xorriso/emulators.h \ + xorriso/emulators.c \ + xorriso/disk_ops.h \ + xorriso/disk_ops.c \ + xorriso/cmp_update.h \ + xorriso/cmp_update.c \ + xorriso/parse_exec.h \ + xorriso/parse_exec.c \ + xorriso/opts_a_c.c \ + xorriso/opts_d_h.c \ + xorriso/opts_i_o.c \ + xorriso/opts_p_z.c \ + \ + xorriso/xorrisoburn.h \ + xorriso/base_obj.h \ + xorriso/base_obj.c \ + xorriso/lib_mgt.h \ + xorriso/lib_mgt.c \ + xorriso/sort_cmp.h \ + xorriso/sort_cmp.c \ + xorriso/drive_mgt.h \ + xorriso/drive_mgt.c \ + xorriso/iso_img.h \ + xorriso/iso_img.c \ + xorriso/iso_tree.h \ + xorriso/iso_tree.c \ + xorriso/iso_manip.h \ + xorriso/iso_manip.c \ + xorriso/write_run.h \ + xorriso/write_run.c \ + xorriso/read_run.h \ + xorriso/read_run.c \ + xorriso/filters.h \ + xorriso/filters.c \ + \ + xorriso/xorriso_timestamp.h \ + xorriso/xorriso_buildstamp.h \ + \ + libisoburn/libisoburn.h \ + libisoburn/isoburn.h \ + libisoburn/isoburn.c \ + libisoburn/isofs_wrap.c \ + libisoburn/burn_wrap.c \ + libisoburn/data_source.c \ + \ + libisofs/libisofs.h \ + libisofs/builder.h \ + libisofs/builder.c \ + libisofs/node.h \ + libisofs/node.c \ + libisofs/tree.h \ + libisofs/tree.c \ + libisofs/image.h \ + libisofs/image.c \ + libisofs/iso1999.h \ + libisofs/iso1999.c \ + libisofs/fsource.h \ + libisofs/fsource.c \ + libisofs/fs_local.c \ + libisofs/fs_image.c \ + libisofs/messages.h \ + libisofs/messages.c \ + libisofs/libiso_msgs.h \ + libisofs/libiso_msgs.c \ + libisofs/stream.h \ + libisofs/stream.c \ + libisofs/util.h \ + libisofs/util.c \ + libisofs/util_rbtree.c \ + libisofs/util_htable.c \ + libisofs/filesrc.h \ + libisofs/filesrc.c \ + libisofs/ecma119.h \ + libisofs/ecma119.c \ + libisofs/ecma119_tree.h \ + libisofs/ecma119_tree.c \ + libisofs/writer.h \ + libisofs/buffer.h \ + libisofs/buffer.c \ + libisofs/rockridge.h \ + libisofs/rockridge.c \ + libisofs/rockridge_read.c \ + libisofs/joliet.h \ + libisofs/joliet.c \ + libisofs/eltorito.h \ + libisofs/eltorito.c \ + libisofs/data_source.c \ + libisofs/find.c \ + libisofs/filter.h \ + libisofs/filter.c \ + libisofs/filters/external.c \ + libisofs/filters/zisofs.c \ + libisofs/filters/gzip.c \ + libisofs/system_area.h \ + libisofs/system_area.c \ + libisofs/make_isohybrid_mbr.c \ + libisofs/aaip_0_2.h \ + libisofs/aaip_0_2.c \ + libisofs/md5.h \ + libisofs/md5.c \ + \ + libjte/libjte.h \ + libjte/libjte_private.h \ + libjte/libjte.c \ + libjte/jte.h \ + libjte/jte.c \ + libjte/checksum.h \ + libjte/checksum.c \ + libjte/endian.c \ + libjte/endianconv.h \ + libjte/md5.h \ + libjte/md5.c \ + libjte/rsync.h \ + libjte/rsync.c \ + libjte/sha1.h \ + libjte/sha1.c \ + libjte/sha256.h \ + libjte/sha256.c \ + libjte/sha512.h \ + libjte/sha512.c \ + \ + libburn/async.c \ + libburn/async.h \ + libburn/back_hacks.h \ + libburn/cleanup.c \ + libburn/cleanup.h \ + libburn/crc.h \ + libburn/debug.c \ + libburn/debug.h \ + libburn/drive.c \ + libburn/drive.h \ + libburn/ecma130ab.c \ + libburn/ecma130ab.h \ + libburn/error.h \ + libburn/file.c \ + libburn/file.h \ + libburn/init.c \ + libburn/init.h \ + libburn/libburn.h \ + libburn/libdax_audioxtr.h \ + libburn/libdax_audioxtr.c \ + libburn/libdax_msgs.h \ + libburn/libdax_msgs.c \ + libburn/mmc.c \ + libburn/mmc.h \ + libburn/null.c \ + libburn/null.h \ + libburn/options.c \ + libburn/options.h \ + libburn/os.h \ + libburn/read.c \ + libburn/read.h \ + libburn/sbc.c \ + libburn/sbc.h \ + libburn/sector.c \ + libburn/sector.h \ + libburn/sg.c \ + libburn/sg.h \ + libburn/source.h \ + libburn/source.c \ + libburn/spc.c \ + libburn/spc.h \ + libburn/structure.c \ + libburn/structure.h \ + libburn/toc.c \ + libburn/toc.h \ + libburn/transport.h \ + libburn/util.c \ + libburn/util.h \ + libburn/write.c \ + libburn/write.h \ + \ + version.h + +# Disabled because unneeded and of unclear ancestry +# libburn/crc.c + +noinst_PROGRAMS = \ + test/compare_file \ + xorriso/make_xorriso_1 + +# A program to compare two trees of files in mounted filesystems +# To compare tree /media/dvd and /original/dir : +# find /media/dvd -exec test/compare_file '{}' /media/dvd /original/dir ';' +# +test_compare_file_CPPFLAGS = +test_compare_file_CFLAGS = +test_compare_file_LDADD = +test_compare_file_SOURCES = test/compare_file.c + +# Specialized converter from xorriso/xorriso.texi to xorriso/xorriso.1 +# +xorriso_make_xorriso_1_CPPFLAGS = +xorriso_make_xorriso_1_CFLAGS = +xorriso_make_xorriso_1_LDADD = +xorriso_make_xorriso_1_SOURCES = xorriso/make_xorriso_1.c + + +# Install symbolic links to the xorriso binary +# +install-exec-hook: + if test -e "$(DESTDIR)$(bindir)"/xorrisofs ; then rm "$(DESTDIR)$(bindir)"/xorrisofs ; else echo ; fi + ln -s xorriso "$(DESTDIR)$(bindir)"/xorrisofs + if test -e "$(DESTDIR)$(bindir)"/osirrox ; then rm "$(DESTDIR)$(bindir)"/osirrox ; else echo ; fi + ln -s xorriso "$(DESTDIR)$(bindir)"/osirrox + if test -e "$(DESTDIR)$(bindir)"/xorrecord ; then rm "$(DESTDIR)$(bindir)"/xorrecord ; else echo ; fi + ln -s xorriso "$(DESTDIR)$(bindir)"/xorrecord + + + +# Trying to create a build timestamp file semi-manually: make buildstamped +# +buildstamp: + date -u '+#define Xorriso_build_timestamP "%Y.%m.%d.%H%M%S"' >xorriso/xorriso_buildstamp.h + cat xorriso/xorriso_buildstamp.h + +# For now make buildstamped has to be performed manually. +buildstamped: buildstamp + make + + +## ========================================================================= ## + +# Indent source files +indent_files = + + +indent: $(indent_files) + indent -bad -bap -nbbb -nbbo -nbc -bli0 -br -bls \ + -cdw -ce -cli0 -ncs -nbfda -i8 -l79 -lc79 \ + -lp -saf -sai -nprs -npsl -saw -sob -ss -ut \ + -sbi0 -nsc -ts8 -npcs -ncdb -fca \ + $^ + +.PHONY: indent + +## ========================================================================= ## + +# Extra things + +man_MANS = \ + xorriso/xorriso.1 \ + xorriso/xorrisofs.1 \ + xorriso/xorrecord.1 + +info_TEXINFOS = \ + xorriso/xorriso.texi \ + xorriso/xorrisofs.texi \ + xorriso/xorrecord.texi + +EXTRA_DIST = \ + xorriso.pc.in \ + version.h.in \ + README \ + AUTHORS \ + CONTRIBUTORS \ + COPYRIGHT \ + COPYING \ + INSTALL \ + xorriso/changelog.txt \ + xorriso/xorriso_buildstamp_none.h \ + xorriso/make_docs.sh \ + $(man_MANS) \ + doc/susp_aaip_2_0.txt \ + doc/susp_aaip_isofs_names.txt \ + doc/zisofs_format.txt \ + doc/startup_file.txt \ + libisofs/aaip-os-dummy.c \ + libisofs/aaip-os-linux.c \ + libisofs/aaip-os-freebsd.c \ + libburn/os-dummy.h \ + libburn/os-freebsd.h \ + libburn/os-libcdio.h \ + libburn/os-linux.h \ + libburn/os-solaris.h \ + libburn/sg-dummy.c \ + libburn/sg-freebsd.c \ + libburn/sg-libcdio.c \ + libburn/sg-linux.c \ + libburn/sg-solaris.c + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_pc_in.txt b/libisoburn/branches/1.1.8/xorriso/xorriso_pc_in.txt new file mode 100644 index 00000000..5e35e873 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_pc_in.txt @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: xorriso +Description: ISO 9660 filesystem image manipulator +Version: @VERSION@ +Requires: +Libs: -L${libdir} -lpthread +Cflags: + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_private.h b/libisoburn/branches/1.1.8/xorriso/xorriso_private.h new file mode 100644 index 00000000..08413bfa --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_private.h @@ -0,0 +1,646 @@ + +/* Command line oriented batch and dialog tool which creates, loads, + manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains inner declarations of xorriso. + The public interface is in xorriso.h +*/ + + +/* For now, #ifdef Xorriso_is_xorriso_selF has no meaning. + But it is already now to be set only by the xorriso.c module. +*/ + +#ifndef Xorriso_private_includeD +#define Xorriso_private_includeD yes + + +/* for uint32_t */ +#ifdef HAVE_STDINT_H +#include +#else +#ifdef HAVE_INTTYPES_H +#include +#endif +#endif + + +/** The source code release timestamp */ +#include "xorriso_timestamp.h" +#ifndef Xorriso_timestamP +#define Xorriso_timestamP "-none-given-" +#endif + +/** The binary build timestamp is to be set externally by the compiler + or by a macro definition in xorriso_buildstamp.h. +*/ +#include "xorriso_buildstamp.h" +#ifndef Xorriso_build_timestamP +#define Xorriso_build_timestamP "-none-given-" +#endif + + +#include "sfile.h" +#include "misc_funct.h" + + +struct ExclusionS; /* List of -not_* conditions */ +struct PermiteM; /* Stack of temporarily altered access permissions */ +struct CheckmediajoB; /* Parameters for Xorriso_check_media() */ +struct SectorbitmaP; /* Distiniction between valid and invalid sectors */ +struct FindjoB; /* Program and status of a find run */ + + +/* maximum number of history lines to be reported with -status:long_history */ +#define Xorriso_status_history_maX 100 + + +/** The list of startup file names */ +#define Xorriso_rc_nuM 4 + + +/* Default setting for the size limit of single data files: + 100 extents with 4 GB - 2 kB each = 400 GB - 200 kB +*/ +#define Xorriso_default_file_size_limiT \ + (((off_t) 400) * ((off_t) 1024*1024*1024) - (off_t) 204800) + + +/* Maximum number of appended partitions. Effectively usable number depends + on system area type. +*/ +#define Xorriso_max_appended_partitionS 8 + + +/* + Maximum length of a disc label text plus 1. +*/ +#define Xorriso_disc_label_sizE 129 + + +struct XorrisO { /* the global context of xorriso */ + + int libs_are_started; + + /* source */ + char progname[SfileadrL]; + char initial_wdx[SfileadrL]; + int no_rc; + + /* Command line argument emulations: + 0=xorriso mode + 1=mkisofs mode + 2=cdrecord mode + */ + int argument_emulation; + + /** List of startupfiles */ + char rc_filenames[Xorriso_rc_nuM][SfileadrL]; + int rc_filename_count; + + /* Whether .mkisofsrc has already been read */ + int mkisofsrc_done; + + char wdi[SfileadrL]; + char wdx[SfileadrL]; + int did_something_useful; + + int add_plainly; + off_t split_size; + + char list_delimiter[81]; + + /* >>> put libisofs aspects here <<< */ + + int ino_behavior; /* bit0= at image load time: + Do not load PX inode numbers but generate new + unique ones for all loaded IsoNode. + bit1= at image generation time: + Do not consolidate suitable nodes to hardlinks. + bit2= at restore-to-disk time: + Do not consolidate suitable nodes to hardlinks. + bit3= with update: + Do not try to detect hardlink splits and joinings. + bit4= with extract: + Do not create or use hln arrays if sort_lba_on + */ + + int iso_level; + int do_joliet; + int do_iso1999; + + int do_aaip; /* bit0= ACL in + bit1= ACL out + bit2= EA in + bit3= EA out + bit4= record dev,inode per node, isofs_st_out in root + bit5= check dev,inode,isofs_st_in + bit6= omit content check if bit5 check is conclusive + bit7= omit dev check with bit5 + bit8= store output charset in xattr "isofs.cs" + bit9= allow to set input charset from xattr "isofs.cs" + */ + + int do_md5; /* bit0= read MD5 array + bit1= write session MD5 + bit2= write MD5 for each data file + bit3= make file content stability check by double reading + bit4= use recorded MD5 as proxy of ISO file + bit5= with bit0: do not check tags of superblock,tree,session + */ + + int no_emul_toc; /* bit0= On overwriteables: + write first session to LBA 0 rather than 32. + */ + + int do_old_empty; /* See -compliance old_empty + own data content: range [0,31]. The new way is to have + a dedicated block to which all such files will point. + */ + + char scdbackup_tag_name[81]; + char scdbackup_tag_time[19]; + char scdbackup_tag_written[512]; + char scdbackup_tag_listname[SfileadrL]; + + int relax_compliance; /* opaque bitfield to be set by xorrisoburn */ + int untranslated_name_len; + int do_follow_pattern; + int do_follow_param; + int do_follow_links; + int follow_link_limit; + int do_follow_mount; + int do_global_uid; + uid_t global_uid; + int do_global_gid; + gid_t global_gid; + int do_global_mode; + mode_t global_dir_mode; + mode_t global_file_mode; + + struct Xorriso_lsT *filters; + int filter_list_closed; + + int zlib_level; + int zlib_level_default; + int zisofs_block_size; + int zisofs_block_size_default; + int zisofs_by_magic; + + int do_overwrite; /* 0=off, 1=on, 2=nondir */ + int do_reassure; /* 0=off, 1=on, 2=tree */ + + char volid[33]; + int volid_default; + char loaded_volid[33]; + char assert_volid[SfileadrL]; + char assert_volid_sev[80]; + + char preparer_id[129]; + + char publisher[129]; + char application_id[129]; + char system_id[33]; + char volset_id[129]; + + char copyright_file[38]; + char biblio_file[38]; + char abstract_file[38]; + + char session_logfile[SfileadrL]; + int session_lba; + int session_blocks; + + /* >>> put libburn/isoburn aspects here */ + + struct Xorriso_lsT *drive_blacklist; + struct Xorriso_lsT *drive_greylist; + struct Xorriso_lsT *drive_whitelist; + + int toc_emulation_flag; /* bit0= bit3 for isoburn_drive_aquire() + scan -ROM profiles for ISO sessions + bit1= bit4 for isoburn_drive_aquire() + do not emulate TOC on overwriteable media + bit2= bit7 for isoburn_drive_aquire() + pretend any media to be -ROM + */ + + int image_start_mode; /* From what address to load the ISO image + bit0-15= addressing mode + 0= automatic lba as deduced from media + 1= value is session number + 2= value is track number + 3= value is lba + bit16= with mode 3 : value is possibly 16 too high. + Let isoburn_set_msc1() adjust it. + bit30= interference with normal msc1 processing + is enabled. Without this bit, + isoburn_set_msc1() will not be called. + bit31= image loading has happened, + setting is kept for rollback only. + Always apply as 0=auto. + */ + char image_start_value[81]; /* value according image_start_mode */ + + uint32_t displacement; + int displacement_sign; + + int drives_exclusive; /* burn_preset_device_open() param exclusive */ + + int early_stdio_test; /* For burn_allow_drive_role_4(): + bit1= Test whether a stdio drive can be opened for + read-write resp. read-only resp. write only. + bit2= Classify files which cannot be opened at all + as role 0 : useless dummy. + bit3= Classify non-empty role 5 drives as + BURN_DISC_APPENDABLE with NWA after the + end of the file. It is nevertheless + possible to change this address by call + burn_write_opts_set_start_byte(). + */ + + int do_calm_drive; /* bit0= calm down drive after aquiring it */ + + char indev[SfileadrL]; + void *in_drive_handle; /* interpreted only by libburnia oriented modules */ + void *in_volset_handle; /* interpreted only by libburnia oriented modules */ + char *in_charset; /* The charset to interpret the filename bytes */ + int indev_is_exclusive; + char indev_off_adr[SfileadrL]; /* Result of burn_drive_convert_fs_adr(indev) + when indev gets aquired. */ + + time_t isofs_st_out; /* A time point at least 1 second before image + composition began. To be stored with image as + xattr "isofs.st". */ + time_t isofs_st_in; /* That time point as read from "isofs.st" of the + loaded image. */ + + int volset_change_pending; /* whether -commit would make sense + 0= no change pending , 1= change pending + 2= change pending, but -as misofs -print-size + was performed on the changed image model + */ + int no_volset_present; /* set to 1 on first failure */ + + struct CheckmediajoB *check_media_default; + int check_media_bad_limit; /* values defined as Xorriso_read_quality_* */ + struct SectorbitmaP *in_sector_map; /* eventual sector validity bitmap */ + + + char outdev[SfileadrL]; + void *out_drive_handle; /* interpreted only by xorrisoburn.c */ + char *out_charset; /* The charset to produce the filename bytes for */ + int dev_fd_1; /* The fd which substitutes for /dev/fd/1 and is + connected to externaly perveived stdout. + */ + int outdev_is_exclusive; + char outdev_off_adr[SfileadrL]; /* Result of burn_drive_convert_fs_adr(outdev) + when outdev gets aquired. */ + + int grow_blindly_msc2; /* if >= 0 this causes growing from drive to drive. + The value is used as block address offset for + image generation. Like in: mkisofs -C msc1,msc2 + */ + + int ban_stdio_write; + int do_dummy; + int do_close; + int speed; /* in libburn units : 1000 bytes/second , 0 = Max, -1 = Min */ + int fs; /* fifo size in 2048 byte chunks : at most 1 GB */ + int padding; /* number of bytes to add after ISO 9660 image */ + int do_padding_by_libisofs; /* 0= by libburn , 1= by libisofs */ + + int alignment; /* if > 0 : output size alignment in 2048 byte blocks. + This is always done by libburn, i.e. attached + outside the image. Eventual inner alignment of + the image end happens first. + */ + + int do_stream_recording; /* 0=no, 1=yes, 2=for data, not for dir + >=16 means yes with number as start LBA */ + + int dvd_obs; /* DVD write chunk size: 0, 32k or 64k */ + int stdio_sync; /* stdio fsync interval: -1, 0, >=32 */ + + int keep_boot_image; + char boot_image_cat_path[SfileadrL]; + int boot_image_cat_hidden; /* bit0= hidden in ISO/RR , bit1= in Joliet */ + int boot_count; /* number of already attached boot images */ + + char boot_image_bin_path[SfileadrL]; + char boot_image_bin_form[16]; + int boot_platform_id; + int patch_isolinux_image; /* bit0= boot-info-table , bit1= not with EFI */ + int boot_image_emul; /* 0=no emulation + 1=emulation as hard disk + 2=emulation as floppy + */ + off_t boot_image_load_size; + unsigned char boot_id_string[29]; + unsigned char boot_selection_crit[21]; + + int boot_image_isohybrid; /* 0=off , deprecated: 1=auto , 2=on , 3=force */ + + int boot_efi_default; /* 0= no effect , + 1= appy --efi-boot parameters when attaching to img */ + + char system_area_disk_path[SfileadrL]; + int system_area_options; /* bit0= "GRUB protective msdos label" + (a simple partition table) + bit1= isohybrid boot image pointer + and partition table + bit2-7= System area type + 0= with bit0 or bit1: MBR + else: unspecified type + 1= MIPS Big Endian Volume Header + 2= MIPS Little Endian Boot Block + 3= SUN Disk Label for SUN SPARC + bit8-9= Only with System area type 0 + Cylinder alignment mode + 0 = auto (align if bit1) + 1 = always align + 2 = never align + */ + int patch_system_area; /* Bits as of system_area_options. + to be applied to the loaded system + area of the image, if no + system_area_disk_path is set. + */ + + /* The number of unclaimed 2K blocks before start of partition 1 as of + the MBR in system area. + If not 0 this will cause double volume descriptor sets and double tree. + */ + uint32_t partition_offset; + /* Partition table parameter: 1 to 63, 0= disabled/default */ + int partition_secs_per_head; + /* 1 to 255, 0= disabled/default */ + int partition_heads_per_cyl; + + /* Path and type of image files to be appended as MBR partitions */ + char *appended_partitions[Xorriso_max_appended_partitionS]; + uint8_t appended_part_types[Xorriso_max_appended_partitionS]; + + /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label. + */ + char ascii_disc_label[Xorriso_disc_label_sizE]; + + /* User settable PVD time stamps */ + time_t vol_creation_time; + time_t vol_modification_time; + time_t vol_expiration_time; + time_t vol_effective_time; + /* To eventually override vol_modification_time by unconverted string + and timezone 0 */ + char vol_uuid[17]; + +#ifdef Xorriso_with_libjtE + /* Parameters and state of Jigdo Template Export environment */ + struct libjte_env *libjte_handle; +#endif + + /* List of -jigdo parameters since the most recent -jigdo clear */ + struct Xorriso_lsT *jigdo_params; + struct Xorriso_lsT *jigdo_values; + int libjte_params_given; /* bits: 0= outfile , 1= verbosity , 2= template_path + 3= jigdo_path , 4= md5_path , 5= min_size + 6= checksum_iso , 7= checksum_template + 8= compression , 9= exclude , 10= demand_md5 + 11= mapping + */ + + /* LBA of boot image after image loading */ + int loaded_boot_bin_lba; + /* Path of the catalog node after image loading */ + char loaded_boot_cat_path[SfileadrL]; + + /* XORRISO options */ + int allow_graft_points; + + int allow_restore; /* -1=permanently disallowed + 0=disallowed, 1=allowed, 2=device files allowed */ + int do_concat_split; /* 1= restore complete split file directories as + regular files + */ + int do_auto_chmod; /* 1= eventually temporarily open access permissions + of self-owned directories during restore + */ + int do_restore_sort_lba; /* 1= restore via node_array rather than via + tree traversal. Better read performance, + no directory mtime restore, needs do_auto_chmod + */ + int do_strict_acl; /* bit0= do not tolerate inappropriate presence or + absence of directory "default" ACL + */ + + int mount_opts_flag; /* bit0= "shared" = not "exclusive" + Try to emit non-exclusive mount command. + Do not give up drives. + Linux: use loop device even on block devices + in order to circumvent the ban to mount a + device twice (with different sbsector=) + FreeBSD: ? + */ + + int dialog; /* 0=off , 1=single-line , 2=multi-line */ + + int bsl_interpretation; + /* whether to run input through Sfile_bsl_interpreter(): + bit0-1= dialog and quoted file reading + 0= no interpretation, leave unchanged + 1= only inside double quotes + 2= outside single quotes + 3= everywhere + bit2-3= reserved as future expansion of bit0-1 + bit4= interpretation within program start arguments + bit5= perform backslash encoding with results + bit6= perform backslash encoding with info texts + */ + + /* Pattern matching facility. It still carries legacy from scdbackup/askme.c + but is fully functional for xorriso. + */ + int search_mode; + /* 0= start text + 1= fgrep , + 2= regular expression + 3= (eventually structured) shell parser expression + 4= shell parser expression for leaf name + */ + + int structured_search; + /* 0= flat text search + 1= '/' is a significant separator that cannot be matched by wildcards + ( 2= like 1 : but report only occurence in tree, no payload, no location ) + ( 3= like 2 : but report first content level of matching directories ) + 4= actually not structured but unique find mode (with search_mode 4) + */ + + int do_iso_rr_pattern; /* 0=off, 1=on, 2=ls */ + int do_disk_pattern; /* 0=off, 1=on, 2=ls */ + + int temp_mem_limit; + + off_t file_size_limit; + + struct ExclusionS *disk_exclusions; + int disk_excl_mode; /* bit0= on (else off) + bit1= parameter too (else rekursion only) + bit2= whole subtree banned (else only exact path) + bit3= when comparing ignore excluded files rather + than to treat them as truely missing on disk + */ + + struct ExclusionS *iso_rr_hidings; + struct ExclusionS *joliet_hidings; + + int use_stdin; /* use raw stdin even if readline support is compiled */ + int result_page_length; + int result_page_width; + char mark_text[SfileadrL]; /* ( stdout+stderr, M: ) */ + int packet_output; + char logfile[4][SfileadrL]; + FILE *logfile_fp[4]; + FILE *pktlog_fp; + struct Xorriso_lsT *result_msglists[Xorriso_max_outlist_stacK]; + struct Xorriso_lsT *info_msglists[Xorriso_max_outlist_stacK]; + int msglist_flags[Xorriso_max_outlist_stacK]; /* bit0= result is redirected + bit1= info is redirected + */ + int msglist_stackfill; + + int status_history_max; /* for -status long_history */ + + /* 0= no logging of SCSI commands, 1= to stderr */ + int scsi_log; + + char report_about_text[20]; + int report_about_severity; + int library_msg_direct_print; + char abort_on_text[20]; + int abort_on_severity; /* A severity rank number as threshold */ + int abort_on_is_default; /* will be set to 0 by first -abort_on */ + int problem_status; /* Severity rank number. 0= no abort condition present */ + char problem_status_text[20]; + + char errfile_log[SfileadrL]; /* for -errfile_log */ + int errfile_mode; /* bit0= marked */ + FILE *errfile_fp; + + int img_read_error_mode; /* 0=best_effort , 1=failure , 2=fatal */ + int extract_error_mode; /* 0=best_effort , 1=keep , 2=delete */ + + char return_with_text[20]; + int return_with_severity; + int return_with_value; + int eternal_problem_status; + char eternal_problem_status_text[20]; + + /* temporary search facilities */ + regex_t *re; + regmatch_t match[1]; + char **re_constants; + int re_count; + int re_fill; + char reg_expr[2*SfileadrL]; + + /* run state */ + int run_state; /* 0=preparing , 1=writing image */ + int is_dialog; + int bar_is_fresh; + char pending_option[SfileadrL]; /* eventual option entered at page prompt */ + int request_to_abort; /* abort a single operation like -ls, not the program */ + int request_not_to_ask; /* suppress reassure and pager */ + double idle_time; + int re_failed_at; /* mismatch position with structured_search */ + int prepended_wd; + double insert_count; + double insert_bytes; + double error_count; /* double will not roll over */ + + /* pacifiers */ + int pacifier_style; /* 0= xorriso, 1=mkisofs 2=cdrecord */ + double pacifier_interval; + double start_time; + double last_update_time; + /* optional global counters for brain reduced callback functions */ + off_t pacifier_count; + off_t pacifier_total; + off_t pacifier_byte_count; /* auxiliary counter for data bytes */ + + void *pacifier_fifo; + + int find_compare_result; /* 1=everything matches , 0=mismatch , -1=error */ + int find_check_md5_result; /* bit0= seen mismatch + bit1= seen error + bit2= seen data file without MD5 + bit3= seen match + */ + + double last_abort_file_time; /* most recent check for aborting -check_md5 */ + + /* Tree node collection and LBA sorting facility */ + int node_counter; + int node_array_size; + void **node_array; + struct Xorriso_lsT *node_disk_prefixes; + struct Xorriso_lsT *node_img_prefixes; + + /* Hardlink matching at restore time memorizes hardlink target paths. + Array of nodes sorted by LBA. */ + int hln_count; + void **hln_array; + void **hln_targets; + int hln_change_pending; /* whether a change was made since hln creation */ + + /* >>> this should count all temp_mem and thus change its name */ + off_t node_targets_availmem; + + /* Hardlink matching at update time: + Array of all nodes in the tree, sorted by disk dev,ino. + Bitmap of nodes which possibly got new hardlink siblings. + List of involved disk-iso path pairs. */ + int di_count; + void **di_array; + char *di_do_widen; + struct Xorriso_lsT *di_disk_paths; + struct Xorriso_lsT *di_iso_paths; + + struct PermiteM *perm_stack; /* Temporarily altered dir access permissions */ + + /* bit0= update_merge active: mark all newly added nodes as visited+found + */ + int update_flags; + + /* result (stdout, R: ) */ + char result_line[10*SfileadrL]; + int result_line_counter; + int result_page_counter; + int result_open_line_len; + + + /* info (stderr, I:) */ + char info_text[10*SfileadrL]; + +}; + + +#include "base_obj.h" +#include "aux_objects.h" +#include "findjob.h" +#include "check_media.h" +#include "misc_funct.h" +#include "text_io.h" +#include "match.h" +#include "emulators.h" +#include "disk_ops.h" +#include "cmp_update.h" +#include "parse_exec.h" + + +#endif /* Xorriso_private_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/xorriso_timestamp.h b/libisoburn/branches/1.1.8/xorriso/xorriso_timestamp.h new file mode 100644 index 00000000..94b376f0 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorriso_timestamp.h @@ -0,0 +1 @@ +#define Xorriso_timestamP "2011.11.09.145155" diff --git a/libisoburn/branches/1.1.8/xorriso/xorrisoburn.h b/libisoburn/branches/1.1.8/xorriso/xorrisoburn.h new file mode 100644 index 00000000..d090bfa1 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrisoburn.h @@ -0,0 +1,599 @@ + + +/* Adapter to libisoburn, libisofs and libburn for xorriso, + a command line oriented batch and dialog tool which creates, loads, + manipulates and burns ISO 9660 filesystem images. + + Copyright 2007-2011 Thomas Schmitt, + + Provided under GPL version 2 or later. + + This file contains the inner isofs- and burn-library interface of xorriso. +*/ + +#ifndef Xorrisoburn_includeD +#define Xorrisoburn_includeD yes + + +/* The minimum version of libisoburn to be used with this version of xorriso +*/ +#define xorriso_libisoburn_req_major 1 +#define xorriso_libisoburn_req_minor 1 +#define xorriso_libisoburn_req_micro 7 + + +struct SpotlisT; /* List of intervals with different read qualities */ +struct CheckmediajoB; /* Parameters for Xorriso_check_media() */ + + +int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= global shutdown of libraries */ +int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag); + +int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag); + +/* @param flag bit0=aquire as isoburn input drive + bit1=aquire as libburn output drive (as isoburn drive if bit0) + @return <=0 failure , 1=success , 2=neither readable or writeable +*/ +int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr, + int flag); + +int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag); + +int Xorriso_write_session(struct XorrisO *xorriso, int flag); + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= mkdir: graft in as empty directory, not as copy from disk + bit1= do not report added files + @return <=0 = error , 1 = added simple node , 2 = added directory +*/ +int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, + char *disk_path, char *img_path, + off_t offset, off_t cut_size, int flag); + +int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag); + +int Xorriso__sev_to_text(int severity, char **severity_name, int flag); + +/* @param flag bit0=report about output drive + bit1=short report form + bit2=do not try to read ISO heads + bit3=report to info channel (else to result channel) +*/ +int Xorriso_toc(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= no output if no boot record was found + bit3= report to info channel (else to result channel) +*/ +int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag); + +int Xorriso_show_devices(struct XorrisO *xorriso, int flag); + +int Xorriso_tell_media_space(struct XorrisO *xorriso, + int *media_space, int *free_space, int flag); + +/* @param flag bit0=fast , bit1=deformat + @return 0=failure, did not touch medium , -1=failure, altered medium + 1=success, altered medium , 2=success, did not touch medium +*/ +int Xorriso_blank_media(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= try to achieve faster formatting + bit1= use parameter size (else use default size) + bit2= do not re-aquire drive + bit7= by_index mode: + bit8 to bit15 contain the index of the format to use. + @return 0=failure, did not touch medium , -1=failure, altered medium + 1=success, altered medium , 2=success, did not touch medium +*/ +int Xorriso_format_media(struct XorrisO *xorriso, off_t size, int flag); + +/* @return <=0 error, 1 success +*/ +int Xorriso_list_formats(struct XorrisO *xorriso, int flag); + +/* @return <=0 error, 1 success +*/ +int Xorriso_list_speeds(struct XorrisO *xorriso, int flag); + +/* @param flag bit1= obtain outdrive, else indrive + @return <=0 error, 1 success +*/ +int Xorriso_list_profiles(struct XorrisO *xorriso, int flag); + +/* @param flag bit2= formatting rather than blanking + @return 0=failure, did not touch medium , -1=failure, altered medium + 1=success, altered medium , 2=success, did not touch medium +*/ +int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag); + + +/* @param boss_iter Opaque internal handle. Use NULL outside xorrisoburn.c : + If not NULL then this is an iterator suitable for + iso_dir_iter_remove() which is then to be used instead + of iso_node_remove(). + @param flag bit0= remove whole sub tree: rm -r + bit1= remove empty directory: rmdir + bit2= recursion: do not reassure in mode 2 "tree" + bit3= this is for overwriting and not for plain removal + bit4= count deleted files in xorriso->pacifier_count + bit5= with bit0 only remove directory content, not the directory + bit6= do not delete eventually existing node from di_array + @return <=0 = error + 1 = removed simple node + 2 = removed directory or tree + 3 = did not remove on user revocation +*/ +int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem, + char *path, int flag); + + +/* @param flag bit0= long format + bit1= do not print count of nodes + bit2= du format + bit3= print directories as themselves (ls -d) +*/ +int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd, + int filec, char **filev, off_t boss_mem, int flag); + +/* This function needs less buffer memory than Xorriso_ls_filev() but cannot + perform structured pattern matching. + @param flag bit0= long format + bit1= only check for directory existence + bit2= do not apply search pattern but accept any file + bit3= just count nodes and return number +*/ +int Xorriso_ls(struct XorrisO *xorriso, int flag); + +/* @param wd Path to prepend in case img_path is not absolute + @param img_path Absolute or relative path to be normalized + @param eff_path returns resulting effective path. + Must provide at least SfileadrL bytes of storage. + @param flag bit0= do not produce problem events (unless faulty path format) + bit1= work purely literally, do not use libisofs + bit2= (with bit1) this is an address in the disk world + @return -1 = faulty path format, 0 = not found , + 1 = found simple node , 2 = found directory +*/ +int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd, + char *img_path, char eff_path[], int flag); + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter, + char *origin, char *dest, int flag); + +/* @param flag bit0= do not produce info message on success + @return 1=success, 0=was already directory, -1=was other type, -2=bad path +*/ +int Xorriso_mkdir(struct XorrisO *xorriso, char *img_path, int flag); + +/* @param flag bit0= a match count !=1 is a SORRY event */ +int Xorriso_expand_pattern(struct XorrisO *xorriso, + int num_patterns, char **patterns, int extra_filec, + int *filec, char ***filev, off_t *mem, int flag); + +int Xorriso_set_st_mode(struct XorrisO *xorriso, char *path, + mode_t mode_and, mode_t mode_or, int flag); + +int Xorriso_set_uid(struct XorrisO *xorriso, char *in_path, uid_t uid, + int flag); + +int Xorriso_set_gid(struct XorrisO *xorriso, char *in_path, gid_t gid, + int flag); + +/* @parm flag bit0= atime, bit1= ctime, bit2= mtime, bit8=no auto ctime */ +int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t, + int flag); + +/* @param flag bit0= recursion + bit1= do not count deleted files with rm and rm_r +*/ +int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, + void *boss_iter, off_t boss_mem, + void *dir_node_generic, char *dir_path, + struct stat *dir_stbuf, int depth, int flag); + +/* @param flag bit0= do not dive into trees + bit1= do not perform job->action on resulting node array +*/ +int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job, + off_t boss_mem, int filec, char **filev, int flag); + +/* @param flag bit0= do not mark image as changed */ +int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag); + +int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag); + +int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag); + +int Xorriso_report_lib_versions(struct XorrisO *xorriso, int flag); + +/* @return 0= stbuf content is valid , + -1 = path not found , -2 = severe error occured +*/ +int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf, + int flag); + +/* @param flag bit0= -inq + bit1= -checkdrive +*/ +int Xorriso_atip(struct XorrisO *xorriso, int flag); + +/* @param write_start_address is valid if >=0 + @param tsize is valid if >0 + @param flag bit0= grow_overwriteable_iso + bit1= do_isosize +*/ +int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, + char *track_source, off_t tsize, int flag); + +/* @param flag bit1= outdev rather than indev + @return <=0 = failure , 1= ok , 2= ok, is CD profile +*/ +int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number, + char profile_name[80], int flag); + +/* @param flag bit0= node_pt is a valid ISO object handle, ignore pathname + bit1= dig out the most original stream for reading +*/ +int Xorriso_iso_file_open(struct XorrisO *xorriso, char *pathname, + void *node_pt, void **stream, int flag); + +int Xorriso_iso_file_read(struct XorrisO *xorriso, void *stream, char *buf, + int count, int flag); + +int Xorriso_iso_file_close(struct XorrisO *xorriso, void **stream, int flag); + +/* @param bit0= copy link target properties rather than link properties +*/ +int Xorriso_copy_properties(struct XorrisO *xorriso, + char *disk_path, char *img_path, int flag); + +int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path, + off_t startbyte, off_t bytecount, char *iso_rr_path, int flag); + +int Xorriso_paste_in(struct XorrisO *xorriso, char *disk_path, + off_t startbyte, off_t bytecount, char *iso_rr_path, int flag); + +struct SplitparT; + +/* @param flag bit0= in_node is valid, do not resolve iso_adr +*/ +int Xorriso_identify_split(struct XorrisO *xorriso, char *iso_adr, + void *in_node, + struct SplitparT **parts, int *count, + struct stat *total_stbuf, int flag); + +/* @param flag bit0= node is valid, do not resolve path + bit1= insist in complete collection of part files +*/ +int Xorriso_is_split(struct XorrisO *xorriso, char *path, void *node, + int flag); + + +/* @param flag + >>> bit0= mkdir: graft in as empty directory, not as copy from iso + bit1= do not report copied files + bit2= -follow, -not_*: this is not a command parameter + bit3= use offset and cut_size for -paste_in + bit4= return 3 on rejection by exclusion or user + bit5= if directory then do not add sub tree + bit6= this is a copy action: do not fake times and ownership + @return <=0 = error , 1 = added leaf file object , 2 = added directory , + 3 = rejected +*/ +int Xorriso_restore(struct XorrisO *xorriso, + char *img_path, char *disk_path, + off_t offset, off_t cut_size, int flag); + + +/* @param flag bit0= in_node is valid, do not resolve img_path +*/ +int Xorriso_restore_is_identical(struct XorrisO *xorriso, void *in_node, + char *img_path, char *disk_path, + char type_text[5], int flag); + + +/* Return the official libburn address of an address string. This may fail + if the string does not constitute a valid drive address. + @param official_adr must offer SfileadrL bytes of reply buffer + @return 1 = success , 0 = failure , -1 = severe error +*/ +int Xorriso_libburn_adr(struct XorrisO *xorriso, char *address_string, + char official_adr[], int flag); + + +/* @param flag bit1= obtain info from outdev +*/ +int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag); + +/* + @param flag bit0= obtain iso_lba from indev + bit1= head_buffer already contains a valid head + bit2= issue message about success + bit3= check whether source blocks are banned by in_sector_map +*/ +int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize, + char *head_buffer, struct CheckmediajoB *job, + int flag); + +int Xorriso_get_local_charset(struct XorrisO *xorriso, char **name, int flag); + +int Xorriso_set_local_charset(struct XorrisO *xorriso, char *name, int flag); + +int Xorriso_destroy_node_array(struct XorrisO *xorriso, int flag); + +int Xorriso_destroy_hln_array(struct XorrisO *xorriso, int flag); + +int Xorriso_destroy_di_array(struct XorrisO *xorriso, int flag); + +int Xorriso_new_node_array(struct XorrisO *xorriso, off_t mem_limit, + int addon_nodes, int flag); + +int Xorriso_sort_node_array(struct XorrisO *xorriso, int flag); + +int Xorriso_new_hln_array(struct XorrisO *xorriso, off_t mem_limit, int flag); + +/* @param flag bit0= allocate xorriso->node_targets too +*/ +int Xorriso_restore_node_array(struct XorrisO *xorriso, int flag); + +int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path, + int flag); + +int Xorriso_check_session_md5(struct XorrisO *xorriso, char *severity, + int flag); + +int Xorriso_image_has_md5(struct XorrisO *xorriso, int flag); + + +int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist, + struct CheckmediajoB *job, int flag); + +int Xorriso_extract_cut(struct XorrisO *xorriso, + char *img_path, char *disk_path, + off_t img_offset, off_t bytes, int flag); + + +int Xorriso_relax_compliance(struct XorrisO *xorriso, char *mode, + int flag); + +/* @return 1=ok 2=ok, is default setting */ +int Xorriso_get_relax_text(struct XorrisO *xorriso, char mode[1024], + int flag); + + +/** + @param flag bit0= print mount command to result channel rather than + performing it +*/ +int Xorriso_mount(struct XorrisO *xorriso, char *dev, int adr_mode, + char *adr_value, char *cmd, int flag); + + + +int Xorriso_auto_driveadr(struct XorrisO *xorriso, char *adr, char *result, + int flag); + + +/* @param node Opaque handle to IsoNode which is to be inquired instead of + path if it is not NULL. + @param path is used as address if node is NULL. + @param acl_text if acl_text is not NULL, then *acl_text will be set to the + ACL text (without comments) of the file object. In this + case it finally has to be freed by the caller. + @param flag bit0= do not report to result but only retrieve ACL text + bit1= just check for existence of ACL, do not allocate and + set acl_text but return 1 or 2 + @return 2 ok, no ACL available, eventual *acl_text will be NULL + 1 ok, ACL available, eventual *acl_text stems from malloc() + <=0 error +*/ +int Xorriso_getfacl(struct XorrisO *xorriso, void *node, + char *path, char **acl_text, int flag); + +int Xorriso_getfattr(struct XorrisO *xorriso, void *in_node, char *path, + char **attr_text, int flag); + +int Xorriso_list_extattr(struct XorrisO *xorriso, void *in_node, char *path, + char *show_path, char *mode, int flag); + +int Xorriso_append_extattr_comp(struct XorrisO *xorriso, + char *comp, size_t comp_len, + char *mode, int flag); + + +/* Calls iso_image_set_ignore_aclea() according to xorriso->do_aaip */ +int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag); + + +/* @param node Opaque handle to IsoNode which is to be manipulated + instead of path if it is not NULL. + @param path is used as address if node is NULL. + @param access_text "access" ACL in long text form + @param default_text "default" ACL in long text form + @param flag Unused yet, submit 0 + @return >0 success , <=0 failure +*/ +int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path, + char *access_text, char *default_text, int flag); + +int Xorriso_get_attrs(struct XorrisO *xorriso, void *in_node, char *path, + size_t *num_attrs, char ***names, + size_t **value_lengths, char ***values, int flag); + +int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path, + size_t num_attrs, char **names, + size_t *value_lengths, char **values, int flag); + +int Xorriso_perform_attr_from_list(struct XorrisO *xorriso, char *path, + struct Xorriso_lsT *lst_start, int flag); + +int Xorriso_path_setfattr(struct XorrisO *xorriso, void *in_node, char *path, + char *name, size_t value_length, char *value, int flag); + +int Xorriso_perform_acl_from_list(struct XorrisO *xorriso, char *file_path, + char *uid, char *gid, char *acl, int flag); + +int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path, + dev_t dev, ino_t ino, + void *in_node, char *iso_path, int flag); + +int Xorriso_local_getfacl(struct XorrisO *xorriso, char *disk_path, + char **text, int flag); + +int Xorriso_set_filter(struct XorrisO *xorriso, void *in_node, + char *path, char *filter_name, int flag); + +/* @param flag bit0= delete filter with the given name +*/ +int Xorriso_external_filter(struct XorrisO *xorriso, + char *name, char *options, char *path, + int argc, char **argv, int flag); + +int Xorriso_status_extf(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag); + +int Xorriso_destroy_all_extf(struct XorrisO *xorriso, int flag); + +int Xorriso_show_stream(struct XorrisO *xorriso, void *in_node, + char *path, int flag); + +int Xorriso_set_zisofs_params(struct XorrisO *xorriso, int flag); + +int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag); + +/* @param flag bit0= overwrite existing di_array (else return 2) +*/ +int Xorriso_make_di_array(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= overwrite existing hln_array (else return 2) +*/ +int Xorriso_make_hln_array(struct XorrisO *xorriso, int flag); + +/* + @param flag bit2= -follow: this is not a command parameter + @return -1= severe error + 0= not applicable for hard links + 1= go on with processing + 2= iso_rr_path is fully updated +*/ +int Xorriso_hardlink_update(struct XorrisO *xorriso, int *compare_result, + char *disk_path, char *iso_rr_path, int flag); + +int Xorriso_finish_hl_update(struct XorrisO *xorriso, int flag); + +int Xorriso_get_md5(struct XorrisO *xorriso, void *in_node, char *path, + char md5[16], int flag); + +int Xorriso_make_md5(struct XorrisO *xorriso, void *in_node, char *path, + int flag); + +int Xorriso_md5_start(struct XorrisO *xorriso, void **ctx, int flag); + +int Xorriso_md5_compute(struct XorrisO *xorriso, void *ctx, + char *data, int datalen, int flag); + +int Xorriso_md5_end(struct XorrisO *xorriso, void **ctx, char md5[16], + int flag); + +/* @param flag bit0=input drive + bit1=output drive +*/ +int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag); + +int Xorriso_is_plain_image_file(struct XorrisO *xorriso, void *in_node, + char *path, int flag); + +int Xorriso_pvd_info(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= do not set hln_change_pending */ +int Xorriso_set_change_pending(struct XorrisO *xorriso, int flag); + +/* @param flag bit0= enable SCSI command logging to stderr */ +int Xorriso_scsi_log(struct XorrisO *xorriso, int flag); + +/* flag bit0= do not increment boot_count and do not reset boot parameters + bit1= dispose attached boot images +*/ +int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag); + +/* + bit0= do only report non-default settings + bit1= do only report to fp +*/ +int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp, + int flag); + +int Xorriso_add_mips_boot_file(struct XorrisO *xorriso, char *path, int flag); + +int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type, + int options, char *cmd, int flag); + + + + +/* A pseudo file type for El-Torito bootsectors as in man 2 stat : + For now take the highest possible value. +*/ +#define Xorriso_IFBOOT S_IFMT + + + +int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest, + void *node_pt, char *name, char *path, + struct stat *boss_stbuf, struct stat *stbuf, int flag); + + +int Xorriso_toc_to_string(struct XorrisO *xorriso, char **toc_text, int flag); + + +int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag); + +int Xorriso_set_system_area_path(struct XorrisO *xorriso, char *path, + int flag); + +int Xorriso_set_hidden(struct XorrisO *xorriso, void *in_node, char *path, + int hide_state, int flag); + + +/* @param flag bit0= avoid library calls + */ +int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129], + int flag); + +int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg, + int flag); + + +int Xorriso_estimate_file_size(struct XorrisO *xorriso, struct FindjoB *job, + char *basename, mode_t st_mode, off_t st_size, int flag); + + +int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter, + char *origin, char *dest, int flag); + +int Xorriso_clone_under(struct XorrisO *xorriso, char *origin, char *dest, + int flag); + +int Xorriso_mark_update_merge(struct XorrisO *xorriso, char *path, + void *node, int flag); + +/* @param flag bit0= asynchronous handling (else catch thread, wait, and exit) +*/ +int Xorriso_set_signal_handling(struct XorrisO *xorriso, int flag); + +/* @param flag bit0=force burn_disc_close_damaged() +*/ +int Xorriso_close_damaged(struct XorrisO *xorriso, int flag); + +int Xorriso_list_extras(struct XorrisO *xorriso, char *mode, int flag); + +#endif /* Xorrisoburn_includeD */ + diff --git a/libisoburn/branches/1.1.8/xorriso/xorrisofs.1 b/libisoburn/branches/1.1.8/xorriso/xorrisofs.1 new file mode 100644 index 00000000..6abb16a7 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrisofs.1 @@ -0,0 +1,1535 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" +.\" IMPORTANT NOTE: +.\" +.\" The original of this file is kept in xorriso/xorrisofs.texi +.\" This here was generated by program xorriso/make_xorriso_1 +.\" +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH XORRISOFS 1 "Version 1.1.7, Oct 24, 2011" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.nh +.SH NAME +xorrisofs \- Emulation of ISO 9660 program mkisofs by program xorriso +.SH SYNOPSIS +.B xorrisofs +[ options ] [-o filename ] pathspec [pathspecs ...] +.br +.SH DESCRIPTION +.PP +\fBxorrisofs\fR +produces Rock Ridge enhanced ISO 9660 filesystems and add\-on sessions to +such filesystems. Optionally it can produce Joliet directory trees too. +.br +.PP +\fBxorrisofs\fR understands options of program mkisofs from cdrtools by +Joerg Schilling. +Its implementation is part of program xorriso which shares no source +code with cdrtools. +.SS +\fBISO 9660, Rock Ridge, Joliet:\fR +.br +\fBISO 9660\fR +(aka \fBECMA\-119\fR) is a read\-only filesystem that is mainly used for +optical media CD, DVD, BD, but may also reside on other storage devices like +disk files, USB sticks or disk partitions. It is widely readable by many +operating systems and by boot facilities of personal computers. +.br +ISO 9660 describes directories and data files by +very restricted filenames with no distinction of upper case and lower case. +Its metadata do not comply to fundamental POSIX specifications. +.br +\fBRock Ridge\fR +is the name of a set of additional information which enhance +an ISO 9660 filesystem so that it can represent a POSIX compliant filesystem +with ownership, access permissions, symbolic links, and other attributes. +Rock Ridge allows filenames of up to 255 bytes and paths of up to +1024 bytes. +.br +Rock Ridge information is produced unconditionally with any \fBxorrisofs\fR +image. +.br +\fBJoliet\fR +is the name of an additional directory tree which provides +filenames up to 64 characters encoded as UTF\-16. +A Joliet tree is mainly interesting for reading the ISO image by +operating systems of Microsoft Corporation. +Production of this directory tree may be enabled by option \-J. +.br +\fBISO 9660:1999\fR +is the name of an additional directory tree which provides longer +filenames. It allows single file names to have up to 207 characters. +It might be of use with some older computer system boot +facilities which read neither Rock Ridge nor Joliet but +need longer filenames nevertheless. +Production of this directory tree may be enabled by option \-iso\-level 4. +.SS +.B Inserting files into the ISO image: +.PP +\fBxorrisofs\fR deals with two kinds of file addresses: +.br +\fBdisk_path\fR +is a path to an object in the local filesystem tree. +.br +\fBiso_rr_path\fR +is the Rock Ridge address of a file object in the ISO image. (Do not +confuse with the lowlevel ISO 9660 names visible if Rock Ridge gets ignored.) +.br +.PP +A program argument is handled as a \fBpathspec\fR, if it is not +recognized as original mkisofs option or additional \fBxorrisofs\fR option. +A pathspec depicts an input file object by a disk_path. +If option \-graft\-points is not present, then the behavior depends on the +file type of disk_path. Directories get merged with the /\-directory of the +ISO image. Files of other types get copied into the /\-directory. +.br +If \-graft\-points is present then each pathspec gets split at the first +occurence of the =\-character. +The part before the = is taken as \fBtarget\fR, i.e. the iso_rr_path for +the file object in the ISO image. The part after the first = is taken +as \fBsource\fR, i.e. the disk_path of the input object. +.br +It is possible to make =\-characters part of the iso_rr_path by preceding +them with a \\\-character. The same must be done for \\\-characters which +shall be part of the iso_rr_path. +.br +.PP +If the source part of the pathspec leads to a directory, then all files +underneath this directory get inserted into the image, too. +It is possible to exclude particular files from being inserted +by help of option \-m. +.br +In case that target already exists, the following rules apply: +Directories and other files may overwrite existing non\-directories. +Directories get merged with existing directories. +Non\-directories may not overwrite existing directories. +.SS +\fBRelation to program xorriso:\fR +.br +\fBxorrisofs\fR is actually a command mode of program \fBxorriso\fR, +which gets entered either by xorriso command "\-as mkisofs" or by +starting the program by one of the names "xorrisofs", "mkisofs", +"genisoimage", or "genisofs". +.br +This command mode can be left by argument "\-\-" which leads +to generic xorriso command mode. See \fBman xorriso\fR for its description. +.br +.PP +xorriso performs image reading and writing by help of libburn, which is +mainly intended for optical drives, but also operates on all POSIX +file types except directories. +.br +The program messages call any image file a "drive". File types which are not +supported for reading are reported as "blank". The reported free media +space may be quite fictional. +.br +Nevertheless \fBxorrisofs\fR does not operate directly on optical drives, +but rather forces libburn to regard them as general device files. +So for writing of sequential optical media (CD, DVD\-R, DVD+R, BD\-R) +one will have to use a burn program. E.g the cdrecord emulation of xorriso. +See EXAMPLES. +.SS +.br +.SH OPTIONS +.br +.PP +.TP +.B Image loading: +.PP +The following options control loading of an existing ISO image for the purpose +of preparing a suitable add\-on session. +If they are missing then a new image is composed from scratch. +.TP +\fB\-M\fR disk_path +Set the path from which to load the existing ISO image directory tree +on which to base the upcomming directory tree as add\-on session. +The path must lead to a random\-access readable file object. +On GNU/Linux: regular data files or block device files. +.br +A special kind of pseudo disk_path has the form "/dev/fd/"number. +It depicts the open file descriptor with the given number, regardless whether +the operating system supports this feature by file nodes in /dev/fd or not. +E.g. /dev/fd/3 is file descriptor 3 which was opened by the program that +later started xorriso. +.TP +\fB\-prev-session\fR disk_path +Alias of \-M. +.TP +\fB\-dev\fR disk_path +Alias of \-M. +.TP +\fB\-C\fR last_session_start,next_writeable_address +Set the 2 KiB block address last_session_start from where to read the +ISO image out of the file given by option \-M. +.br +Separated by a comma, set the next_writeable_address to which the +add\-on session will finally be written. Decisive is actually the block +address which the intended readers will have to use as superblock address +on the intended medium. +.br +Both values can be inquired from optical media by help of burn programs +and cdrecord option \-msinfo. xorriso itself can obtain it in its +cdrecord emulation. Do not let it load the drive, but rather do this manually +or by a program like dd which reads a few bytes. Only then it is sure that +the device driver knows the true readable size of the medium. +.br + dd if=/dev/... count=1 >/dev/null 2>&1 +.br + values=$(xorriso \-as cdrecord dev=/dev/... \-msinfo) +.br + echo $values +.br +Option \-C may be used without option \-M to create an ISO image from +scratch and prepare it for being finally written to a block address +other than 0. Parameter last_session_start must then be set to 0. +.TP +\fB\-cdrecord-params\fR last_session_start,next_writeable_address +Alias of \-C. +.TP +.B Settings for file insertion: +.TP +\fB\-path-list\fR disk_path +Read pathspecs line\-by\-line from disk_file and insert the depicted file +objects into the ISO image. If disk_path is "\-" then read the pathspecs +from standard input. +.TP +\fB--quoted_path_list\fR disk_path +Like option \-path\-list but reading quoted words rather than plain lines. +Whitespace outside of quotes will be discarded. On the other hand it is +possible to represent pathspecs which contain newline characters. +.br +The double quotation mark " and the single quotation mark ' can be used to +enclose whitespace and make it part of pathspecs. Each mark +type can enclose the marks of the other type. A trailing backslash \\ outside +quotations or an open quotation cause the next input line to be appended. +.TP +\fB\-f\fR +.br +Resolve symbolic links on disk rather than storing them as symbolic +links in the ISO image. +.TP +\fB\-follow-links\fR +Alias of \-f. +.TP +\fB\-graft-points\fR +Enable interpretation of input file pathspecs as combination of iso_rr_path +and disk_path, separated by a =\-character. +.TP +\fB\-m\fR disk_pattern +Exclude files from being inserted into the image. Silently ignored are +those files of which the disk_path matches the given shell parser pattern. +If no /\-character is part of the pattern, then it gets matched against +the leaf name of the disk file. +.br +It is possible to give more than one \-m option. +.TP +\fB\-exclude\fR +Alias of \-m. +.TP +\fB\-x\fR +.br +Alias of \-m. +.TP +\fB\-old-exclude\fR +Alias of \-m. +.TP +\fB\-exclude-list\fR disk_path +Perform \-m using each line out of file disk_path as argument disk_pattern. +.TP +\fB\-z\fR +.br +Enable recognition and proper processing of zisofs compressed files +as produced by program mkzftree. These files will get equipped with the +necessary meta data so that a Linux kernel will recognize them and +deliver their content in uncompressed form. +.TP +\fB\-transparent-compression\fR +Alias of \-z. +.TP +\fB\-root\fR iso_rr_path +Insert all files under the given iso_rr_path. If option \-graft\-points is given, +then iso_rr_path is prepended to each target part of a pathspec. +.br +The default for \-root is "/". +.TP +\fB\-old-root\fR iso_rr_path +Enable incremental insertion of files into the loaded image. +The effective target and source addresses of given pathspecs get compared +whether the target already exists in the ISO image and is still identical +to the source on disk. Metadata in the ISO image will get adjusted, if they +differ from those on disk. +New files and files with changed content will get newly added. +Target files which do not exist in any of the according pathspec sources +will get removed from the ISO directory tree. +.br +If the effective setting of \-root differs from the iso_rr_path given +with \-old\-root, then the files underneath the \-old\-root directory get cloned +underneath the \-root directory. Cloning happens before file comparison. +.TP +\fB--old-root-no-ino\fR +Disable recording and use of disk inode numbers. +If no disk inode numbers are recorded, then option \-old\-root will have +to read disk file content and compare it with the MD5 checksum that is +recorded in the ISO image. +.br +With recorded disk inode numbers and with credible ctime and mtime, +it is possible to detect potential changes in the content without actually +reading it. +A loophole remains if multiple different filesystems may get mounted +at the same directory, like it is habit with /mnt. +In this case one has to use option \-\-old\-root\-devno +or disable the inode number shortcut by \-\-old\-root\-no\-ino. +.TP +\fB--old-root-devno\fR +Enable comparison of recorded device numbers together with recorded +inode numbers. This works only with good old stable device numbers which +get out of fashion, regrettably. If the hard disk has a different +device number after each reboot, then this comparison will see all +files as changed and thus prevent any incremental size saving. +.TP +\fB--old-root-no-md5\fR +Disable recording and use of MD5 checksums for data file content. +If neither checksums and nor disk inode numbers are recorded, then +option \-old\-root will have to read ISO image file content when comparing +it with disk file content. +.TP +.B Settings for image production: +.TP +\fB\-o\fR disk_path +Set the output file address for the emerging ISO image. +If the address exists as regular file, it will be truncated to length 0 +when image production begins. It may not already exist as directory. +If it does not exist yet then its parent directory must exist and +a regular file will get created. +.br +A special kind of pseudo disk_path has the form "/dev/fd/"number. +It depicts the open file descriptor with the given number, regardless whether +the operating system supports this feature by file nodes in /dev/fd or not. +E.g. /dev/fd/4 is file descriptor 4 which was opened by the program that +later started xorriso. +.br +Default is standard output (/dev/fd/1) which may also be set by disk_path "\-". +.TP +\fB\-output\fR disk_path +Alias of \-o. +.TP +\fB--stdio_sync\fR "on"|"off"|number +Set the number of bytes after which to force output to disk +in order to keep the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +.br +xorriso uses an inner fifo buffer with default size 4 MiB. So forcing +the operating system i/o cache to disk does not necessarily block the +simultaneous production of more image content. +.TP +\fB--emul-toc\fR +Write a second superblock with the first session into random\-access +files. If further sessions get appended and the first superblock gets updated, +then the second superblock will not be overwritten. This allows to still +mount the first session and to find the start blocks of the further sessions. +.br +The price is 64 KiB extra space consumption. If \-partition_offset is non\-zero, +then it is 128 KiB plus twice the partition setup. +.TP +\fB--no-emul-toc\fR +Do not write a second superblock with the first session into random\-access +files. +.br +This is the default. +.TP +\fB--sort-weight\fR weight_number iso_rr_path +Attribute a LBA weight number to regular files. If iso_rr_path leads +to a directory then all regular files underneath will get the weight_number. +.br +The weight_number may range from \-2147483648 to 2147483647. +The higher it is, the lower will be the block address of the file data +in the emerging ISO image. +Currently the El Torito boot catalog has a hardcoded weight of 1 billion. +Normally it should occupy the block with the lowest possible address. +Data files get added or loaded with initial weight 0. +.TP +\fB\-dir-mode\fR mode +Set the access permissions for all directories in the image to the given +mode which is either an octal number beginning with "0" or a comma separated +list of statements of the form [ugoa]*[+\-=][rwxst]* . E.g. ug=rx,a\-rwx +.TP +\fB\-file-mode\fR mode +Like \-dir\-mode but for all regular data files in the image. +.TP +\fB\-pad\fR +.br +Add 300 KiB to the end of the produced ISO image. This circumvents possible +read errors from ISO images which have been written to CD media in TAO mode. +The additional bytes are claimed as part of the ISO image if not \-\-emul\-toc +is given. +.br +Option \-pad is the default. +.TP +\fB\-no-pad\fR +Disable padding of 300 KiB to the end of the produced ISO image. +This is safe if the image is not meant to be written on CD or if it +gets written to CD as only track in write mode SAO. +.TP +\fB--old-empty\fR +Use the old way of of giving block addresses in the range +of [0,31] to files with no own data content. The new way is to have +a dedicated block to which all such files will point. +.TP +.B Settings for standards compliance: +.TP +\fB\-iso-level\fR number +Specify the ISO 9660 version which defines the limitations of file naming +and data file size. The naming restrictions do not apply to the +Rock Ridge names but only to the low\-level ISO 9660 names. +There are three conformance levels: +.br +Level 1 allows ISO names of the form 8.3 and file size up to 4 GiB \- 1. +.br +Level 2 allows ISO names with up to 32 characters +and file size up to 4 GiB \- 1. +.br +Level 3 allows ISO names with up to 32 characters +and file size of up to 400 GiB \- 200 KiB. (This size limitation is +set by the xorriso implementation and not by ISO 9660 which would +allow nearly 8 TiB.) +.br +Pseudo\-level 4 enables production of an additional ISO 9660:1999 +directory tree. +.TP +\fB\-disallow_dir_id_ext\fR +Do not follow a bad habit of mkisofs which allows dots in the ISO names +of directories. On the other hand, some bootable GNU/Linux images depend on +this bad habit. +.TP +\fB\-U\fR +.br +This option allows ISO file names without dot and up to 37 characters, +ISO file paths longer than 255 characters, and all ASCII characters in file +names. Further it omits the semicolon and the version numbers at the end +of ISO names. +.br +This all violates ISO 9660 specs. +.TP +\fB\-untranslated-filenames\fR +Alias of \-U. +.TP +\fB\-untranslated_name_len\fR number +Allow ISO file names up to the given number of characters +without any character conversion. The maximum number is 96. +If a file name has more characters, then image production will +fail deliberately. +.br +This violates ISO 9660 specs. +.TP +\fB\-allow-lowercase\fR +Allow lowercase character in ISO file names. +.br +This violates ISO 9660 specs. +.TP +\fB\-d\fR +.br +Do not add trailing dot to ISO file names without dot. +.br +This violates ISO 9660 specs. +.TP +\fB\-omit-period\fR +Alias of \-d. +.TP +\fB\-l\fR +.br +Allow up to 37 characters in ISO file names. +.br +This violates ISO 9660 specs. +.TP +\fB\-full-iso9660-filenames\fR +Alias of \-l. +.TP +\fB\-max-iso9660-filenames\fR +Alias of \-l. +.TP +\fB\-N\fR +.br +Omit the semicolon and the version numbers at the end of ISO names. +.br +This violates ISO 9660 specs. +.TP +\fB\-omit-version-number\fR +Alias of \-N. +.TP +.B Settings for standards extensions: +.TP +\fB\-R\fR +.br +With mkisofs this option enables Rock Ridge extensions. \fBxorrisofs\fR +produces them unconditionally. +.TP +\fB\-rock\fR +.br +Alias of \-R. +.TP +\fB\-r\fR +.br +Set Rock Ridge user and group id of all files in the ISO image to 0. +Grant r\-permissions to all. Deny all w\-permissions. +If any x\-permission is set, grant x\-permission to all. +Remove s\-bit and t\-bit. +.TP +\fB\-rational-rock\fR +Alias of \-r. +.TP +\fB--for_backup\fR +Enable options which improve backup fidelity: +\-\-acl, \-\-xattr, \-\-md5, +\-\-hardlinks. +.TP +\fB--acl\fR +.br +Enable recording and loading of ACLs from GNU/Linux or FreeBSD +(see man getfacl, man acl). +They will not be in effect with mounted ISO images. But xorriso can +restore them on the same systems when extracting files from the ISO image. +.TP +\fB--xattr\fR +.br +Enable recording and loading of GNU/Linux or FreeBSD extended attributes in +user namespace (see man getfattr, man attr, +resp. man getextattr, man 9 extattr). +They will not be in effect with mounted ISO images. But xorriso can +restore them on the same systems when extracting files from the ISO image. +.TP +\fB--md5\fR +.br +Enable recording of MD5 checksums for the overall ISO image and for each +single data file in the image. xorriso can check the content of an ISO +image with these sums and raise alert on mismatch. +See man xorriso, options \-check_media, check_md5_r. +xorriso can print recorded MD5 checksums. E.g. by: +.br + \-find / \-exec get_md5 +.TP +\fB--hardlinks\fR +Enable loading and recording of hardlink relations. +Search for families of iso_rr files which stem from the same disk file, +have identical content filtering and have identical properties. +The members of each family get the same inode number in the ISO image. +.br +Whether these numbers are respected at mount time depends on the operating +system. xorriso can create hardlink families when extracting files from +the ISO image. +.TP +\fB--scdbackup_tag\fR disk_path record_name +Append a scdbackup checksum record to the image. This works only if the +parameter next_writeable_address of option \-C is 0. +If disk_path is not an empty string, then append a scdbackup checksum record +to the end of this file. record_name is a word that gets part of tag +and record. +.br +Program scdbackup_verify will recognize and verify tag resp. record. +.TP +\fB\-J\fR +.br +Enable the production of an additional Joliet directory tree along +with the ISO 9660 Rock Ridge tree. +.TP +\fB\-joliet\fR +Alias of \-J. +.TP +\fB\-joliet-long\fR +Allow 103 characters in Joliet file names rather than 64 as is prescribed +by the specification. Allow Joliet paths longer than the prescribed limit of +240 characters. +.br +Oversized names get truncated. Without this option, oversized paths get +excluded from the Joliet tree. +.TP +.B Settings for file hiding: +.TP +\fB\-hide\fR disk_path_pattern +Make files invisible in the directory tree of ISO 9660 and Rock Ridge, +if their disk_path matches the given shell parser pattern. +The data content of such hidden files will be included in the +resulting image, even if they do not show up in any directory. +But you will need own means to find nameless data in the image. +.br +This command does not apply to the boot catalog. +.TP +\fB\-hide-list\fR disk_path +Perform \-hide using each line out of file disk_path as argument +disk_path_pattern. +.TP +\fB\-hide-joliet\fR disk_path_pattern +Like option \-hide but making files invisible in the directory tree of Joliet, +if their disk_path matches the given shell parser pattern. +.TP +\fB\-hide-joliet-list\fR disk_path +Perform \-hide\-joliet using each line out of file disk_path as argument +disk_path_pattern. +.TP +.B ISO image ID strings: +.PP +The following strings and file addresses get stored in the Primary Volume +Descriptor of the ISO9660 image. The file addresses are ISO 9660 +paths. These files should have iso_rr_paths which consist only of +the characters [A\-Z0\-9_] and exactly one dot which separates +at most 8 characters from at most 3 characters. +.TP +\fB\-V\fR text +Set the Volume Id of the ISO image. +xorriso accepts any text up to 32 characters, +but according to rarely obeyed specs stricter rules apply: +.br +Conformant are ASCII characters out of [A\-Z0\-9_]. Like: "IMAGE_23" +.br +Joliet allows 16 UCS\-2 characters. Like: "Windows name" +.br +Be aware that the volume id might get used automatically as name of the +mount point when the medium is inserted into a playful computer system. +.TP +\fB\-volid\fR text +Alias of \-V. +.TP +\fB\-volset\fR text +Set the Volume Set Id of the ISO image. +Permissible are up to 128 characters. +.TP +\fB\-p\fR text +Set the Publisher Id of the ISO image. This may identify the person or +organisation who specified what shall be recorded. +Permissible are up to 128 characters. +.TP +\fB\-publisher\fR text +Alias of \-p. +.TP +\fB\-A\fR text +Set the Application Id of the ISO image. +This may identify the specification of how the data are recorded. +Permissible are up to 128 characters. +.br +The special text "@xorriso@" gets converted to the id string of xorriso +which is normally written as Preparer Id. It is a wrong tradition to write +the program id as Application Id. +.TP +\fB\-appid\fR text +Alias of \-A. +.TP +\fB\-sysid\fR text +Set the System Id of the ISO image. This may +identify the system which can recognize and act upon the content of the +System Area in image blocks 0 to 15. +Permissible are up to 32 characters. +.TP +\fB\-p\fR text +Set the Preparer Id of the ISO image. This may +identify the person or other entity which controls the preparation of the data +which shall be recorded. Normally this should be the id of xorriso and not +of the person or program which operates xorriso. Please avoid to change it. +Permissible are up to 128 characters. +.br +The special text "@xorriso@" gets converted to the id string of xorriso +which is default at program startup. +.TP +\fB\-preparer\fR text +Alias of \-p. +.TP +\fB\-abstract\fR iso_path +Set the address of the Abstract File of the ISO image. This should +be the ISO 9660 path of a file in the image which contains an abstract +statement about the image content. +Permissible are up to 37 characters. +.TP +\fB\-biblio\fR iso_path +Set the address of the Biblio File of the ISO image. This should +be the ISO 9660 path of a file in the image which contains bibliographic +records. +Permissible are up to 37 characters. +.TP +\fB\-copyright\fR iso_path +Set the address of the Copyright File of the ISO image. This should +be the ISO 9660 path of a file in the image which contains a copyright +statement. +Permissible are up to 37 characters. +.TP +\fB--modification-date=YYYYMMDDhhmmsscc\fR +Set a timestring that overrides ISO image creation and modification timestamps +literally. +It must consist of 16 decimal digits which form YYYYMMDDhhmmsscc, with +YYYY between 1970 and 2999. Time zone is GMT. +It is supposed to match this GRUB line: +.br + search \-\-fs\-uuid \-\-set YYYY\-MM\-DD\-hh\-mm\-ss\-cc +.br +E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). +.TP +.B El Torito Bootable ISO images: +.PP +The precondition for a bootable ISO image is to have in the ISO image +the files of a boot loader. The boot facilities of computers get +directed to such files, which usually execute further program files +from the ISO image. +\fBxorrisofs\fR can produce several kinds of boot block or boot record, +which become part of the ISO image, and get interpreted by the according +boot facility. +.br +.PP +An \fBEl Torito\fR +boot record points the bootstrapping facility to a boot catalog +with one or more boot images, which are binary program files stored in +the ISO image. +The content of the boot image files is not in the scope of El Torito. +.br +xorriso composes the boot catalog according to the boot image +files given and structured by options \-b, \-e, \-el\-torito\-alt\-boot, +and \-\-efi\-boot. Often it contains only one entry. +.br +El Torito gets interpreted by boot facilities PC\-BIOS and EFI. +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images +for PC\-BIOS. +.br +\fBxorrisofs\fR supports the example options out of the ISOLINUX wiki, +the options used in GRUB script grub\-mkrescue, and the example in the +FreeBSD AvgLiveCD wiki. +.br +.PP +For CD booting via boot facilities other than PC\-BIOS and EFI, and +for booting from USB sticks or hard disks, see the next section +about the Sytem Area. +.br +.TP +\fB\-b\fR iso_rr_path +Specify the boot image file which shall be mentioned in the current +entry of the El Torito boot catalog. It will be marked as suitable for +PC\-BIOS. +.br +With boot images from ISOLINUX and GRUB this option should be accompanied by +options \-c , \-no\-emul\-boot , \-boot\-load\-size 4 , \-boot\-info\-table. +.TP +\fB\-eltorito-boot\fR iso_rr_path +Alias of \-b. +.TP +\fB\-eltorito-alt-boot\fR +Finalize the current El Torito boot catalog entry and begin a new one. +A boot image file and all its necessary options shall be specified before +option \-eltorito\-alt\-boot. +All further El Torito boot options apply to the new catalog +entry. Up to 32 catalog entries are possible. +.TP +\fB\-e\fR iso_rr_path +Specify the boot image file which shall be mentioned in the current +entry of the El Torito boot catalog. It will be marked as suitable for EFI. +.br +Normally no other El Torito options should be used with the catalog entry +that points to an EFI image. +Consider to use \-\-efi\-boot rather than \-e. +.TP +\fB--efi-boot\fR iso_rr_path +Perform \-eltorito\-alt\-boot, option \-e with the given +iso_rr_path, and again \-eltorito\-alt\-boot. This gesture is +used for achieving EFI\-bootability of the GRUB2 rescue CD. +.TP +\fB\-boot-load-size\fR number +Set the number of 512\-byte blocks for boot images which emulate +a floppy or a hard disk. A safe default for non\-emulating boot images is 4. +.TP +\fB\-hard-disk-boot\fR +Mark the boot image in the current catalog entry as emulated hard disk. +(Not suitable for any known boot loader.) +.TP +\fB\-no-emul-boot\fR +Mark the boot image in the current catalog entry as not emulating +floppy or hard disk. (This is to be used with all known boot loaders.) +.br +If neither \-hard\-disk\-boot nor \-no\-emul\-boot is given, then the +boot image will be marked as emulating a floppy. +(Not suitable for any known boot loader.) +.TP +\fB\-boot-info-table\fR +Overwrite certain bytes in the current boot image. The information will be +supplied by xorriso in the course of image production: Block address of +the Primary Volume Descriptor, block address of the boot image file, +size of the boot image file. +.TP +\fB\-c\fR iso_rr_path +Set the address of the El Torito boot catalog file within the image. +This file address is not significant for the booting PC\-BIOS or EFI, +but it may later be read by other programs in order to learn about +the available boot images. +.TP +\fB\-eltorito-catalog\fR iso_rr_path +Alias of \-c. +.TP +\fB--boot-catalog-hide\fR +Prevent the El Torito boot catalog from appearing as file +in the directory trees of the image. +.TP +.B System Area, MBR, other boot blocks: +.PP +The first 16 blocks of an ISO image are the System Area. +It is reserved for system dependent boot software. This may be the +CD boot facilities of exotic hardware architectures or it may be +a MBR for booting via PC\-BIOS from USB stick or hard disk. +.br +A \fBMBR\fR (Master Boot Record) contains boot code and a partition table. +It does not hamper El Torito booting from CDROM. +.br +\fBxorrisofs\fR supports boot facilities other than PC\-BIOS: +MIPS Big Endian (SGI), MIPS Little Endian (DEC), SUN SPARC. +Those are mutually not combinable and also not combinable with MBR. +.br +.TP +\fB\-G\fR disk_path +Copy at most 32768 bytes from the given disk file to the very start of +the ISO image. +.br +Other than a El Torito boot image, the file disk_path needs not to be added +to the ISO image. It will not show up as file in the directory trees. +.TP +\fB\-generic-boot\fR disk_path +Alias of \-G. +.TP +\fB--embedded-boot\fR disk_path +Alias of \-G. +.TP +\fB\-isohybrid-mbr\fR disk_path +Install disk_path as ISOLINUX isohybrid MBR which makes the boot image +given by option \-b bootable from USB sticks and hard disks via PC\-BIOS. +This preparation is normally done by ISOLINUX program isohybrid +on the already produced ISO image. +.br +The disk path should lead to one of the Syslinux files isohdp[fp]x*.bin . +The MBR gets patched according to isohybrid needs. The first partition +describes the range of the ISO image. Its start is at block 0 by default, +but may be set to 64 disk blocks by option \-partition_offset 16. +.TP +\fB--protective-msdos-label\fR +Patch the System Area by a simple PC\-DOS partition table where partition 1 +claims the range of the ISO image but leaves the first block unclaimed. +.TP +\fB\-partition_offset\fR 2kb_block_adr +Cause a partition table with a single partition that begins at the +given block address. This is counted in 2048 byte +blocks, not in 512 byte blocks. If the block address is non\-zero then it must +be at least 16. Values larger than 16 are hardly of use. +A non\-zero partition offset causes two superblocks to be +generated and two sets of directory trees. The image is then mountable from its +absolute start as well as from the partition start. +.br +The offset value of an ISO image gets preserved when a new session is added +to a loaded image. +So the value defined here is only in effect if a new ISO image gets written. +.TP +\fB\-partition_hd_cyl\fR number +Set the number of heads per cylinder for the partition table. +0 chooses a default value. Maximum is 255. +.TP +\fB\-partition_sec_hd\fR number +Set the number of sectors per head for the partition table. +0 chooses a default value. Maximum is 63. +.br +The product partition_sec_hd * partition_hd_cyl * 512 is the cylinder size. +It should be divisible by 2048 in order to allow exact alignment. +If it is too small to describe the image size by at most 1024 cylinders, +then appropriate values of partition_hd_cyl are chosen with +partition_sec_hd 32 or 63. If the image is larger than 8,422,686,720 bytes, +then the cylinder size constraints cannot be fulfilled. They seem not overly +important anyway. Flat block addresses in partition tables are good for 1 TiB. +.TP +\fB\-partition_cyl_align\fR mode +Control image size alignment to an integer number of cylinders. +It is prescribed by isohybrid specs and it seems to please program fdisk. +Cylinder size must be divisible by 2048. +Images larger than 8,323,596,288 bytes cannot be aligned. +.br +Mode "auto" is default. Alignment by padding happens only if +option \-isohybrid\-mbr is given. +.br +Mode "on" causes alignment by padding with option +\-\-protective\-msdos\-label too. +Mode "off" disables alignment unconditionally. +.TP +\fB\-append_partition\fR partition_number type_code disk_path +Cause a prepared filesystem image to be appended to the ISO image and to be +described by a partition table entry in a boot block at the start of the +emerging ISO image. The partition entry will bear the size of the submitted +file rounded up to the next multiple of 2048 bytes. +.br +Beware of subsequent multi\-session runs. The appended partition will get +overwritten. +.br +partition_number may be 1 to 4. Number 1 will put the whole ISO image into +the unclaimed space before partition 1. So together with most xorriso MBR +features, number 2 would be the most natural choice. +.br +The type_code may be "FAT12", "FAT16", "Linux", +or a hexadecimal number between 0x00 and 0xff. Not all those numbers will +yield usable results. For a list of codes search the Internet for +"Partition Types" or run fdisk command "L". +.TP +\fB\-mips-boot\fR iso_rr_path +Declare a data file in the image to be a +MIPS Big Endian boot file and cause production of a MIPS Big Endian Volume +Header. This is mutually exclusive with production of other boot blocks +like MBR. +It will overwrite the first 512 bytes of any data provided by \-G. +Up to 15 boot files can be declared by multiple \-mips\-boot options. +.TP +\fB\-mipsel-boot\fR iso_rr_path +Declare a data file in the image to be the +MIPS Little Endian boot file. This is mutually exclusive with other boot +blocks. +It will overwrite the first 512 bytes of any data provided by \-G. +Only a single boot file can be declared by \-mipsel\-boot. +.TP +\fB\-B\fR disk_path[,disk_path ...] +Cause one or more data files on disk to be written after the end of the +ISO image. A SUN Disk Label will be written into the first 512 bytes of the +ISO image which lists this image as partition 1 and the given disk_paths as +partition 2 up to 8. +.br +The disk files should contain suitable boot images for SUN SPARC systems. +.br +The pseudo disk_path "..." causes that all empty partition entries become +copies of the last non\-empty entry. If no other disk_path is given before +"..." then all partitions describe the ISO image. In this case, the boot +loader code has to be imported by option \-G. +.TP +\fB\-sparc-boot\fR disk_path[,disk_path ...] +Alias of \-B. +.TP +\fB\-sparc-label\fR text +Set the ASCII label text of a SUN Disk Label. +.TP +.B Character sets: +.PP +Character sets should not matter as long as only english alphanumeric +characters are used for file names or as long as all writers and readers +of the medium use the same character set. +Outside these constraints it may be necessary to let xorriso convert byte +codes. +.br +A conversion from input character set to the output character set is +performed when an ISO image gets written. +Vice versa there is a conversion from output character set to the +input character set when an ISO image gets loaded. +The sets can be defined by options \-input\-charset and \-output\-charset, +if needed. +.br +.TP +\fB\-input-charset\fR character_set_name +Set the character set from which to convert disk file names when +inserting them into the ISO image. +.TP +\fB\-output-charset\fR character_set_name +Set the character set from which to convert names of loaded ISO images +and to which to convert names when writing ISO images. +.TP +.B Jigdo Template Extraction: +.PP +From man genisoimage: +"Jigdo is a tool to help in the distribution of large files like CD and +DVD images; see http://atterer.net/jigdo/ for more details. Debian CDs +and DVD ISO images are published on the web in jigdo format to allow +end users to download them more efficiently." +.br +If the use of libjte was enabled at compile time of xorriso, then +\fBxorrisofs\fR can produce a .jigdo and a .template file together with a +single\-session ISO image. If not, then Jigdo options will cause a +FAILURE event, which normally leads to program abort. +.br +One may determine the ability for Jigdo by: +.br + $ xorrisofs \-version 2>&1 | grep '^libjte' && echo YES +.br +.PP +The .jigdo file contains checksums and symbolic file addresses. +The .template file contains the compressed ISO image with reference tags +instead of the content bytes of the listed files. +.br +Input for this process are the normal arguments for a \fBxorrisofs\fR +session +with no image loaded, and a .md5 file which lists those data files which may be +listed in the .jigdo file and externally referenced in the .template file. +Each designated file is represented in the .md5 file by a single text line: +.br +MD5 as 32 hex digits, 2 blanks, size as 12 decimal digits or blanks, 2 blanks, +symbolic file address +.br +The file address in an .md5 line has to bear the same basename as the +disk_path of the file which it shall match. The directory path of +the file address is decisive for To=From mapping, not for file recognition. +After To=From mapping, the file address gets written into the .jigdo +file. Jigdo restore tools will convert these addresses into really +reachable data source addresses from which they can read. +.br +If the list of jigdo parameters is not empty, then padding will be +counted as part of the ISO image. +.br +.TP +\fB\-jigdo-jigdo\fR disk_path +Set the disk_path for the .jigdo file with the checksums +and download addresses for filling the holes in .template. +.TP +\fB\-jigdo-template\fR disk_path +Set the disk_path for the .template file with the +holed and compressed ISO image copy. +.TP +\fB\-jigdo-min-file-size\fR size +Set the minimum size for a data file to be listed +in the .jigdo file and being a hole in the .template file. +size may be a plain number counting bytes, or a number with appended +letter "k", "m", "g" to count KiB (1024 bytes), MiB (1024 KiB), or +GiB (1024 MiB). +.TP +\fB\-jigdo-force-md5\fR disk_path_pattern +adds a regular expression pattern which will get compared +with the absolute disk_path of any data file that was not found in the .md5 +list. A match causes a MISHAP event, which normally does not abort the +program run but finally causes a non\-zero exit value of the program. +.TP +\fB\-jigdo-exclude\fR disk_path_pattern +Add a regular expression pattern which will get compared +with the absolute disk_path of any data file. A match causes the file to +stay in .template in any case. +.TP +\fB\-jigdo-map\fR To=From +Add a string pair of the form To=From to the parameter list. +If a data file gets listed in the .jigdo file, then it is referred by the +file address from its line in the .md5 file. This file address gets checked +whether it begins with the From string. If so, then this string will be +replaced by the To string and a ':' character, before it goes into the .jigdo +file. The From string should end by a '/' character. +.TP +\fB\-md5-list\fR disk_path +Set the disk_path where to find the .md5 input file. +.TP +\fB\-jigdo-template-compress\fR "gzip"|"bzip2" +Choose one of "bzip2" or "gzip" for the compression of +the template file. The jigdo file is put out uncompressed. +.TP +\fB\-checksum_algorithm_iso\fR list_of_names +Choose one or more of "md5", "sha1", "sha256", "sha512" +for the auxiliary "# Image Hex" checksums in the .jigdo file. The list_of_names +may e.g. look like "md5,sha1,sha512". Value "all" chooses all available +algorithms. +Note that MD5 stays always enabled. +.TP +\fB\-checksum_algorithm_template\fR list_of_names +Choose the algorithms for the "# Template Hex" checksums in the .jigdo file. +The rules for list_of_names are the same as with \-checksum_algorithm_iso. +.TP +.B Miscellaneous options: +.TP +\fB\-print-size\fR +Print to stdandard output the foreseeable number of 2048 byte blocks in +the emerging ISO image. Do not produce this image. +.br +The result depends on several settings. +.br +If option \-\-emul\-toc is given, then padding (see \-pad) is not +counted as part of the image size. In this case either use \-no\-pad or +add 150 (= 300 KiB) to the resulting number. +.TP +\fB--no_rc\fR +Only if used as first argument this option +prevents reading and interpretation of startup files. See section FILES below. +.TP +\fB\-help\fR +.br +List supported options to stderr. Original mkisofs options bear their +original mkisofs description texts. +.TP +\fB\-quiet\fR +.br +Suppress most messages of the program run, except those which indicate +problems or errors. +.TP +\fB\-v\fR +.br +Enable the output of informational program messages. +.TP +\fB\-verbose\fR +Alias of \-v. +.TP +\fB\-version\fR +Print to standard output a text that begins with +.br + "mkisofs 2.01\-Emulation Copyright (C)" +.br +and to standard error the version information of xorriso. +.br +.SH EXAMPLES +.SS +.B Overview of examples: +A simple image production run +.br +Set ISO image paths by -graft-points +.br +Perform multi-session runs +.br +Let xorrisofs work underneath growisofs +.br +Incremental backup of a few directory trees +.br +Incremental backup with accumulated trees +.br +Create bootable images for PC-BIOS +.br +.SS +.B A simple image production run +A prepared file tree in directory ./for_iso gets copied into the root +directory of the ISO image. File permissions get set to read\-only for +everybody. +Joliet attributes for Microsoft systems get added. +The resulting image gets written as data file ./image.iso on disk. +.br + $ xorrisofs \-r \-J \-o ./image.iso ./for_iso +.SS +.B Set ISO image paths by -graft-points +Without option \-graft\-points each given disk file is copied into the root +directory of the ISO image, maintaining its name. If a directory is given, +then its files and sub\-directories are copied into the root directory, +maintaining their names. +.br + $ xorrisofs ... /home/me/datafile /tmp/directory +.br +yields in the ISO image root directory: +.br + /datafile +.br + /file_1_from_directory +.br + ... +.br + /file_N_from_directory +.br +.sp 1 +With option \-graft\-points it is possible to put files and directories to +arbitrary paths in the ISO image. +.br + $ xorrisofs ... \-graft\-points /home/me/datafile /dir=/tmp/directory +.br +yields in the ISO image root directory: +.br + /datafile +.br + /dir +.br +Eventually needed parent directories in +the image will be created automatically: +.br + /datafiles/file1=/home/me/datafile +.br +yields in the ISO image: +.br + /datafiles/file1 +.br +The attributes of directory /datafiles get copied from /home/me on disk. +.br +.sp 1 +Normally one should avoid = and \\ characters in the ISO part of a pathspec. +But if it must be, one may escape them: +.br + /with_\\=_and_\\\\/file=/tmp/directory/file +.br +yields in the ISO image: +.br + /with_=_and_\\/file +.SS +.B Perform multi-session runs +This example works for multi\-session media only: +CD\-R[W], DVD\-R[W], DVD+R, BD\-R. +Add cdrskin option \-\-grow_overwriteable_iso +to all \-as cdrecord runs +in order to enable multi\-session emulation on overwriteable media. +.br +The first session is written like this: +.br + $ xorrisofs \-graft\-points \\ +.br + /tree1=prepared_for_iso/tree1 \\ +.br + | xorriso \-as cdrecord \-v dev=/dev/sr0 blank=fast \-multi \-eject \- +.br +Follow\-up sessions are written like this: +.br + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +.br + $ m=$(xorriso \-as cdrecord dev=/dev/sr0 \-msinfo) +.br + $ xorrisofs \-M /dev/sr0 \-C $m \-graft\-points \\ +.br + /tree2=prepared_for_iso/tree2 \\ +.br + | xorriso \-as cdrecord \-v dev=/dev/sr0 \-waiti \-multi \-eject \- +.br +Always eject the drive tray between sessions. The old sessions +get read via /dev/sr0. Its device driver might not be aware +of the changed content before it loads the medium again. +In this case the previous session would not be loaded and the +new session would contain only the newly added files. +.br +For the same reason do not let xorriso \-as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +.SS +.B Let xorrisofs work underneath growisofs +growisofs expects an ISO formatter program which understands options \-C and +\-M. A variable is defined to override the hardcoded default name. +.br + $ export MKISOFS="xorrisofs" +.br + $ growisofs \-Z /dev/dvd /some/files +.br + $ growisofs \-M /dev/dvd /more/files +.br +If no "xorrisofs" is available on your system, then you will have to create +a link pointing to the xorriso binary and tell growisofs to use it. E.g. by: +.br + $ ln \-s $(which xorriso) "$HOME/xorrisofs" +.br + $ export MKISOFS="$HOME/xorrisofs" +.br +One may quit mkisofs emulation by argument "\-\-" and make +use of all xorriso commands. growisofs dislikes options which +start with "\-o" but \-outdev must be set to "\-". +So use "outdev" instead: +.br + $ growisofs \-Z /dev/dvd \-\-for_backup \-\- \\ +.br + outdev \- \-update_r /my/files /files +.br + $ growisofs \-M /dev/dvd \-\-for_backup \-\- \\ +.br + outdev \- \-update_r /my/files /files +.br +Note that \-\-for_backup is given in the mkisofs emulation. +To preserve the recorded extra data it must already be in effect, when +the emulation loads the image. +.SS +.B Incremental backup of a few directory trees +This changes the directory trees /open_source_project and /personal_mail +in the ISO image so that they become exact copies of their disk counterparts. +ISO file objects get created, deleted or get their attributes adjusted +accordingly. +.br +ACL, xattr, hard links and MD5 checksums will be recorded. +It is expected that inode numbers in the disk filesystem are persistent +over cycles of mounting and booting. +Files with names matching *.o or *.swp get excluded explicitly. +.br +.sp 1 +To be used several times on the same medium, whenever an update of +the two disk trees to the medium is desired. Begin with a blank medium and +update it until he run fails gracefully due to lack of remaining space on +the old one. +.br +Do not let xorriso \-as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +.br + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +.br + $ msinfo=$(xorriso \-as cdrecord dev=/dev/sr0 \-msinfo) +.br + $ load_opts= +.br + $ test \-n "$msinfo" && load_opts="\-M /dev/sr0 \-C $msinfo" +.br + $ xorrisofs $load_opts \-o \- \-\-for_backup \-m '*.o' \-m '*.swp' \\ +.br + \-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \-graft\-points \\ +.br + \-old\-root / \\ +.br + /projects=/home/thomas/projects \\ +.br + /personal_mail=/home/thomas/personal_mail \\ +.br + | xorriso \-as cdrecord dev=/dev/sr0 \-v \-multi \-waiti \-eject \- +.br +.sp 1 +This makes sense if the full backup leaves substantial remaining capacity +on media and if the expected changes are much smaller than the full backup. +.br +.sp 1 +\fBBetter do not use your youngest backup for \-old\-root\fR. +Have at least two media which you use alternatingly. So only older backups +get endangered by the new write operation, while the newest backup is +stored safely on a different medium. +.br +Always have a blank medium ready to perform a full backup in case the update +attempt fails due to insufficient remaining capacity. This failure will +not spoil the old medium, of course. +.br +.sp 1 +If inode numbers on disk are not persistent, then use +option \-\-old\-root\-no\-ino . +In this case an update run will compare recorded MD5 +sums against the current file content on hard disk. +.br +.sp 1 +With \fBmount\fR option \fB\-o "sbsector="\fR on GNU/Linux +resp. \fB\-s\fR on FreeBSD +it is possible to access the session trees which represent the older backup +versions. With CD media, GNU/Linux mount accepts session numbers directly by +its option "session=". +.br +Multi\-session media and most overwriteable media written by xorriso can tell +the sbsectors of their sessions by xorriso option \-toc: +.br + $ xorriso \-dev /dev/sr0 \-toc +.br +xorriso can print the matching mount command for a session number: +.br + $ xorriso \-mount_cmd /dev/sr0 session 12 /mnt +.br +or for a volume id that matches a search expression: +.br + $ xorriso \-mount_cmd /dev/sr0 volid '*2008_12_05*' /mnt +.br +Both yield on standard output something like: +.br + mount \-t iso9660 \-o nodev,noexec,nosuid,ro,sbsector=1460256 '/dev/sr0' '/mnt' +.br +The superuser may let xorriso execute the mount command directly: +.br + # osirrox \-mount /dev/sr0 "volid" '*2008_12_05*' /mnt +.SS +.B Incremental backup with accumulated trees +Solaris does not offer the option to mount older sessions. +In order to keep them accessible, one may map all files to a file tree under +a session directory and accumulate those directories from session to session. +The \-root tree is cloned from the \-old\-root tree before it gets +compared with the appropriate trees on disk. +.br +This demands to know the previously used session directory name. +.br +With the first session: +.br + $ xorrisofs \-root /session1 \\ +.br + \-o \- \-\-for_backup \-m '*.o' \-m '*.swp' \\ +.br + \-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \-graft\-points \\ +.br + /projects=/home/thomas/projects \\ +.br + /personal_mail=/home/thomas/personal_mail \\ +.br + | xorriso \-as cdrecord dev=/dev/sr0 \-v blank=as_needed \\ +.br + \-multi \-waiti \-eject \- +.br +.sp 1 +With the second session, option \-old\-root refers to /session1 and the +new \-root is /session2. +.br +Do not let xorriso \-as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +.br + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +.br + $ msinfo=$(xorriso \-as cdrecord dev=/dev/sr0 \-msinfo) +.br + $ load_opts= +.br + $ test \-n "$msinfo" && load_opts="\-M /dev/sr0 \-C $msinfo" +.br + $ xorrisofs $load_opts \-root /session2 \-old\-root /session1 \\ +.br + \-o \- \-\-for_backup \-m '*.o' \-m '*.swp' \\ +.br + \-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" \-graft\-points \\ +.br + /projects=/home/thomas/projects \\ +.br + /personal_mail=/home/thomas/personal_mail \\ +.br + | xorriso \-as cdrecord dev=/dev/sr0 \-v \-multi \-waiti \-eject \- +.br +With the third session, option \-old\-root refers to /session2. +The new \-root is /session3. And so on. +.SS +.B Create bootable images for PC-BIOS +The ISOLINUX wiki prescribes to create on disk a directory ./CD_root and +to copy all desired files underneath that directory. Especially file +isolinux.bin shall be copied to ./CD_root/isolinux/isolinux.bin . +This is the boot image file. +.br +The prescribed mkisofs options can be used unchanged with \fBxorrisofs\fR: +.br + $ xorrisofs \-o output.iso \\ +.br + \-b isolinux/isolinux.bin \-c isolinux/boot.cat \\ +.br + \-no\-emul\-boot \-boot\-load\-size 4 \-boot\-info\-table \\ +.br + ./CD_root +.br +Put it on CD by a burn program. E.g.: +.br + $ xorriso \-as cdrecord \-v dev=/dev/sr0 blank=as_needed output.iso +.br +.sp 1 +The image from above example will boot from CD, DVD or BD, but not from +USB stick or other hard\-disk\-like devices. This can be done by help of an +isohybrid MBR. Syslinux provides matching template files +as isohdp[fp]x*.bin . E.g. /usr/lib/syslinux/isohdpfx.bin . +.br +If a few hundred KB of size do not matter, then option \-partition_offset +can be used to create a partition table where partition 1 starts not +at block 0. This facilitates later manipulations of the USB stick by +tools for partitioning and formatting. +.br +The image from the following example will be prepared for booting via MBR +and its first parttion will start at hard disk block 64. +.br +It will also boot from optical media. +.br + $ xorrisofs \-o output.iso \\ + \-b isolinux/isolinux.bin \-c isolinux/boot.cat \\ + \-no\-emul\-boot \-boot\-load\-size 4 \-boot\-info\-table \\ +.br + \-isohybrid\-mbr /usr/lib/syslinux/isohdpfx.bin \\ +.br + \-partition_offset 16 \\ +.br + ./CD_root +.br +Become superuser and copy the image to the unpartitioned base device file +of the USB stick. On GNU/Linux this is e.g. /dev/sdb, not /dev/sdb1. +.br +CAUTION: +This will overwrite any partitioning on the USB stick and make +remaining data unaccessible. +.br +So first make sure you got the correct address of the intended device. +E.g. by reading 100 MiB data from it and watching it blinking: +.br + # dd bs=2K if=/dev/sdb count=50K >/dev/null +.br +Now copy the image onto it +.br + # dd bs=2K if=output.iso of=/dev/sdb +.br +.SH FILES +.SS +.B Startup files: +.br +If not \-\-no_rc is given as the first argument then \fBxorrisofs\fR +attempts on startup to read and execute lines from the following files: +.br + /etc/default/xorriso +.br + /etc/opt/xorriso/rc +.br + /etc/xorriso/xorriso.conf +.br + $HOME/.xorrisorc +.br +The files are read in the sequence given here, but none of them is required +to exist. The lines are not interpreted as \fBxorrisofs\fR options but +as generic xorriso commands. See man xorriso. +.PP +After the xorriso startup files, the program tries one by one to open for +reading: +.br + ./.mkisofsrc +.br + $MKISOFSRC +.br + $HOME/.mkisofsrc +.br + $(dirname $0)/.mkisofsrc +.br +On success it interprets the file content and does not try further files. +The last address is used only if start argument 0 has a non\-trivial dirname. +.br +The reader currently interprets the following NAME=VALUE pairs: +.br + APPI default for \-A +.br + PUBL default for \-publisher +.br + SYSI default for \-sysid +.br + VOLI default for \-V +.br + VOLS default for \-volset +.br +Any other lines will be silently ignored. +.br +.SH SEE ALSO +.TP +For generic xorriso command mode +.BR xorriso(1) +.TP +For the cdrecord emulation of xorriso +.BR xorrecord(1) +.TP +For mounting xorriso generated ISO 9660 images (-t iso9660) +.BR mount(8) +.TP +Other programs which produce ISO 9660 images +.BR mkisofs(8), +.BR genisoimage(8) +.TP +Programs which burn sessions to optical media +.BR growisofs(1), +.BR cdrecord(1), +.BR wodim(1), +.BR cdrskin(1), +.BR xorriso(1) +.TP +ACL and xattr +.BR getfacl(1), +.BR setfacl(1), +.BR getfattr(1), +.BR setfattr(1) +.TP +MD5 checksums +.BR md5sum(1) +.TP +On FreeBSD the commands for xattr and MD5 differ +.BR getextattr(8), +.BR setextattr(8), +.BR md5(1) +.SH BUGS +To report bugs, request help, or suggest enhancements for \fBxorriso\fR, +please send electronic mail to the public list . +If more privacy is desired, mail to . +.br +Please describe what you expect \fBxorriso\fR to do, +the program arguments resp. commands by which you tried to achieve it, +the messages of \fBxorriso\fR, and the undesirable outcome of your +program run. +.br +Expect to get asked more questions before solutions can be proposed. +.SH AUTHOR +Thomas Schmitt +.br +for libburnia\-project.org +.SH COPYRIGHT +Copyright (c) 2011 Thomas Schmitt +.br +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of xorriso. If you make use +of the license to derive modified versions of xorriso then you are entitled +to modify this text under that same license. +.SH CREDITS +\fBxorrisofs\fR is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +.br +Compliments towards Joerg Schilling whose cdrtools served me for ten years. diff --git a/libisoburn/branches/1.1.8/xorriso/xorrisofs.info b/libisoburn/branches/1.1.8/xorriso/xorrisofs.info new file mode 100644 index 00000000..7ea114dc --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrisofs.info @@ -0,0 +1,1844 @@ +This is xorrisofs.info, produced by makeinfo version 4.8 from +./xorrisofs.texi. + +INFO-DIR-SECTION Archiving +START-INFO-DIR-ENTRY +* Xorrisofs: (xorrisofs). Emulates ISO 9660 program mkisofs +END-INFO-DIR-ENTRY + xorrisofs - Emulation of ISO 9660 program mkisofs by program xorriso + + Copyright (C) 2011 - 2011 Thomas Schmitt + + Permission is granted to distrubute this text freely. + + +File: xorrisofs.info, Node: Top, Next: Overview, Up: (dir) + +xorrisofs 1.1.7 +*************** + +xorrisofs - Emulation of ISO 9660 program mkisofs by program xorriso + +* Menu: + +* Overview:: Overview +* Standards:: ISO 9660, Rock Ridge, Joliet +* Insert:: Inserting files into the ISO image +* Xorriso:: Relation to program xorriso +* Options:: Options +* Examples:: Examples +* Files:: Files +* Seealso:: See also +* Bugreport:: Reporting bugs +* Legal:: Author, Copyright, Credits +* CommandIdx:: Alphabetic Command List +* ConceptIdx:: Alphabetic List of Concepts and Objects + + +File: xorrisofs.info, Node: Overview, Next: Standards, Prev: Top, Up: Top + +1 Overview +********** + +`xorrisofs' produces Rock Ridge enhanced ISO 9660 filesystems and +add-on sessions to such filesystems. Optionally it can produce Joliet +directory trees too. + +`xorrisofs' understands options of program mkisofs from cdrtools by +Joerg Schilling. Its implementation is part of program xorriso which +shares no source code with cdrtools. + + +File: xorrisofs.info, Node: Standards, Next: Insert, Prev: Overview, Up: Top + +2 ISO 9660, Rock Ridge, Joliet +****************************** + +*ISO 9660* (aka *ECMA-119*) is a read-only filesystem that is mainly +used for optical media CD, DVD, BD, but may also reside on other +storage devices like disk files, USB sticks or disk partitions. It is +widely readable by many operating systems and by boot facilities of +personal computers. +ISO 9660 describes directories and data files by very restricted +filenames with no distinction of upper case and lower case. Its +metadata do not comply to fundamental POSIX specifications. +*Rock Ridge* is the name of a set of additional information which +enhance an ISO 9660 filesystem so that it can represent a POSIX +compliant filesystem with ownership, access permissions, symbolic +links, and other attributes. Rock Ridge allows filenames of up to 255 +bytes and paths of up to 1024 bytes. +Rock Ridge information is produced unconditionally with any `xorrisofs' +image. +*Joliet* is the name of an additional directory tree which provides +filenames up to 64 characters encoded as UTF-16. A Joliet tree is +mainly interesting for reading the ISO image by operating systems of +Microsoft Corporation. Production of this directory tree may be +enabled by option -J. +*ISO 9660:1999* is the name of an additional directory tree which +provides longer filenames. It allows single file names to have up to +207 characters. It might be of use with some older computer system boot +facilities which read neither Rock Ridge nor Joliet but need longer +filenames nevertheless. Production of this directory tree may be +enabled by option -iso-level 4. + + +File: xorrisofs.info, Node: Insert, Next: Xorriso, Prev: Standards, Up: Top + +3 Inserting files into the ISO image +************************************ + +`xorrisofs' deals with two kinds of file addresses: +*disk_path* is a path to an object in the local filesystem tree. +*iso_rr_path* is the Rock Ridge address of a file object in the ISO +image. (Do not confuse with the lowlevel ISO 9660 names visible if Rock +Ridge gets ignored.) + +A program argument is handled as a *pathspec*, if it is not recognized +as original mkisofs option or additional `xorrisofs' option. A +pathspec depicts an input file object by a disk_path. If option +-graft-points is not present, then the behavior depends on the file +type of disk_path. Directories get merged with the /-directory of the +ISO image. Files of other types get copied into the /-directory. +If -graft-points is present then each pathspec gets split at the first +occurence of the =-character. The part before the = is taken as +*target*, i.e. the iso_rr_path for the file object in the ISO image. +The part after the first = is taken as *source*, i.e. the disk_path of +the input object. +It is possible to make =-characters part of the iso_rr_path by preceding +them with a \-character. The same must be done for \-characters which +shall be part of the iso_rr_path. + +If the source part of the pathspec leads to a directory, then all files +underneath this directory get inserted into the image, too. It is +possible to exclude particular files from being inserted by help of +option -m. +In case that target already exists, the following rules apply: +Directories and other files may overwrite existing non-directories. +Directories get merged with existing directories. Non-directories may +not overwrite existing directories. + + +File: xorrisofs.info, Node: Xorriso, Next: Options, Prev: Insert, Up: Top + +4 Relation to program xorriso +***************************** + +`xorrisofs' is actually a command mode of program *xorriso*, which gets +entered either by xorriso command "-as mkisofs" or by starting the +program by one of the names "xorrisofs", "mkisofs", "genisoimage", or +"genisofs". +This command mode can be left by argument "--" which leads to generic +xorriso command mode. See *man xorriso* for its description. + +xorriso performs image reading and writing by help of libburn, which is +mainly intended for optical drives, but also operates on all POSIX file +types except directories. +The program messages call any image file a "drive". File types which +are not supported for reading are reported as "blank". The reported +free media space may be quite fictional. +Nevertheless `xorrisofs' does not operate directly on optical drives, +but rather forces libburn to regard them as general device files. So +for writing of sequential optical media (CD, DVD-R, DVD+R, BD-R) one +will have to use a burn program. E.g the cdrecord emulation of xorriso. +See EXAMPLES. + + +File: xorrisofs.info, Node: Options, Next: Examples, Prev: Xorriso, Up: Top + +5 Options +********* + +* Menu: + +* Loading:: Image loading +* SetInsert:: Settings for file insertion +* SetProduct:: Settings for image production +* SetCompl:: Settings for standards compliance +* SetExtras:: Settings for standards extensions +* SetHide:: Settings for file hiding +* ImageId:: ISO image ID strings +* Bootable:: El Torito Bootable ISO images +* SystemArea:: System Area, MBR, other boot blocks +* Charset:: Character sets +* Jigdo:: Jigdo Template Extraction +* Miscellaneous:: Miscellaneous options + + +File: xorrisofs.info, Node: Loading, Next: SetInsert, Prev: Options, Up: Options + +5.1 Influencing the behavior of image loading +============================================= + +The following options control loading of an existing ISO image for the +purpose of preparing a suitable add-on session. If they are missing +then a new image is composed from scratch. + +-M disk_path + Set the path from which to load the existing ISO image directory + tree on which to base the upcomming directory tree as add-on + session. The path must lead to a random-access readable file + object. On GNU/Linux: regular data files or block device files. + A special kind of pseudo disk_path has the form "/dev/fd/"number. + It depicts the open file descriptor with the given number, + regardless whether the operating system supports this feature by + file nodes in /dev/fd or not. E.g. /dev/fd/3 is file descriptor 3 + which was opened by the program that later started xorriso. + +-prev-session disk_path + Alias of -M. + +-dev disk_path + Alias of -M. + +-C last_session_start,next_writeable_address + Set the 2 KiB block address last_session_start from where to read + the ISO image out of the file given by option -M. + Separated by a comma, set the next_writeable_address to which the + add-on session will finally be written. Decisive is actually the + block address which the intended readers will have to use as + superblock address on the intended medium. + Both values can be inquired from optical media by help of burn + programs and cdrecord option -msinfo. xorriso itself can obtain it + in its cdrecord emulation. Do not let it load the drive, but + rather do this manually or by a program like dd which reads a few + bytes. Only then it is sure that the device driver knows the true + readable size of the medium. + + dd if=/dev/... count=1 >/dev/null 2>&1 + values=$(xorriso -as cdrecord dev=/dev/... -msinfo) + echo $values + + Option -C may be used without option -M to create an ISO image from + scratch and prepare it for being finally written to a block address + other than 0. Parameter last_session_start must then be set to 0. + +-cdrecord-params last_session_start,next_writeable_address + Alias of -C. + + +File: xorrisofs.info, Node: SetInsert, Next: SetProduct, Prev: Loading, Up: Options + +5.2 Settings for file insertion +=============================== + + +-path-list disk_path + Read pathspecs line-by-line from disk_file and insert the depicted + file objects into the ISO image. If disk_path is "-" then read the + pathspecs from standard input. + +--quoted_path_list disk_path + Like option -path-list but reading quoted words rather than plain + lines. Whitespace outside of quotes will be discarded. On the + other hand it is possible to represent pathspecs which contain + newline characters. + The double quotation mark " and the single quotation mark ' can be + used to enclose whitespace and make it part of pathspecs. Each mark + type can enclose the marks of the other type. A trailing backslash + \ outside quotations or an open quotation cause the next input + line to be appended. + +-f + Resolve symbolic links on disk rather than storing them as symbolic + links in the ISO image. + +-follow-links + Alias of -f. + +-graft-points + Enable interpretation of input file pathspecs as combination of + iso_rr_path and disk_path, separated by a =-character. + +-m disk_pattern + Exclude files from being inserted into the image. Silently ignored + are those files of which the disk_path matches the given shell + parser pattern. If no /-character is part of the pattern, then it + gets matched against the leaf name of the disk file. + It is possible to give more than one -m option. + +-exclude + Alias of -m. + +-x + Alias of -m. + +-old-exclude + Alias of -m. + +-exclude-list disk_path + Perform -m using each line out of file disk_path as argument + disk_pattern. + +-z + Enable recognition and proper processing of zisofs compressed files + as produced by program mkzftree. These files will get equipped + with the necessary meta data so that a Linux kernel will recognize + them and deliver their content in uncompressed form. + +-transparent-compression + Alias of -z. + +-root iso_rr_path + Insert all files under the given iso_rr_path. If option + -graft-points is given, then iso_rr_path is prepended to each + target part of a pathspec. + The default for -root is "/". + +-old-root iso_rr_path + Enable incremental insertion of files into the loaded image. The + effective target and source addresses of given pathspecs get + compared whether the target already exists in the ISO image and is + still identical to the source on disk. Metadata in the ISO image + will get adjusted, if they differ from those on disk. New files + and files with changed content will get newly added. Target files + which do not exist in any of the according pathspec sources will + get removed from the ISO directory tree. + If the effective setting of -root differs from the iso_rr_path + given with -old-root, then the files underneath the -old-root + directory get cloned underneath the -root directory. Cloning + happens before file comparison. + +--old-root-no-ino + Disable recording and use of disk inode numbers. If no disk inode + numbers are recorded, then option -old-root will have to read disk + file content and compare it with the MD5 checksum that is recorded + in the ISO image. + With recorded disk inode numbers and with credible ctime and mtime, + it is possible to detect potential changes in the content without + actually reading it. A loophole remains if multiple different + filesystems may get mounted at the same directory, like it is + habit with /mnt. In this case one has to use option + --old-root-devno or disable the inode number shortcut by + --old-root-no-ino. + +--old-root-devno + Enable comparison of recorded device numbers together with recorded + inode numbers. This works only with good old stable device numbers + which get out of fashion, regrettably. If the hard disk has a + different device number after each reboot, then this comparison + will see all files as changed and thus prevent any incremental + size saving. + +--old-root-no-md5 + Disable recording and use of MD5 checksums for data file content. + If neither checksums and nor disk inode numbers are recorded, then + option -old-root will have to read ISO image file content when + comparing it with disk file content. + + +File: xorrisofs.info, Node: SetProduct, Next: SetCompl, Prev: SetInsert, Up: Options + +5.3 Settings for image production +================================= + + +-o disk_path + Set the output file address for the emerging ISO image. If the + address exists as regular file, it will be truncated to length 0 + when image production begins. It may not already exist as + directory. If it does not exist yet then its parent directory + must exist and a regular file will get created. + A special kind of pseudo disk_path has the form "/dev/fd/"number. + It depicts the open file descriptor with the given number, + regardless whether the operating system supports this feature by + file nodes in /dev/fd or not. E.g. /dev/fd/4 is file descriptor 4 + which was opened by the program that later started xorriso. + Default is standard output (/dev/fd/1) which may also be set by + disk_path "-". + +-output disk_path + Alias of -o. + +--stdio_sync "on"|"off"|number + Set the number of bytes after which to force output to disk in + order to keep the memory from being clogged with lots of pending + data for slow devices. Default "on" is the same as "16m". Forced + output can be disabled by "off". + xorriso uses an inner fifo buffer with default size 4 MiB. So + forcing the operating system i/o cache to disk does not + necessarily block the simultaneous production of more image + content. + +--emul-toc + Write a second superblock with the first session into random-access + files. If further sessions get appended and the first superblock + gets updated, then the second superblock will not be overwritten. + This allows to still mount the first session and to find the start + blocks of the further sessions. + The price is 64 KiB extra space consumption. If -partition_offset + is non-zero, then it is 128 KiB plus twice the partition setup. + +--no-emul-toc + Do not write a second superblock with the first session into + random-access files. + This is the default. + +--sort-weight weight_number iso_rr_path + Attribute a LBA weight number to regular files. If iso_rr_path + leads to a directory then all regular files underneath will get + the weight_number. + The weight_number may range from -2147483648 to 2147483647. The + higher it is, the lower will be the block address of the file data + in the emerging ISO image. Currently the El Torito boot catalog + has a hardcoded weight of 1 billion. Normally it should occupy + the block with the lowest possible address. Data files get added + or loaded with initial weight 0. + +-dir-mode mode + Set the access permissions for all directories in the image to the + given mode which is either an octal number beginning with "0" or a + comma separated list of statements of the form + [ugoa]*[+-=][rwxst]* . E.g. ug=rx,a-rwx + +-file-mode mode + Like -dir-mode but for all regular data files in the image. + +-pad + Add 300 KiB to the end of the produced ISO image. This circumvents + possible read errors from ISO images which have been written to CD + media in TAO mode. The additional bytes are claimed as part of + the ISO image if not -emul-toc is given. + Option -pad is the default. + +-no-pad + Disable padding of 300 KiB to the end of the produced ISO image. + This is safe if the image is not meant to be written on CD or if it + gets written to CD as only track in write mode SAO. + +--old-empty + Use the old way of of giving block addresses in the range of + [0,31] to files with no own data content. The new way is to have a + dedicated block to which all such files will point. + + +File: xorrisofs.info, Node: SetCompl, Next: SetExtras, Prev: SetProduct, Up: Options + +5.4 Settings for standards compliance +===================================== + + +-iso-level number + Specify the ISO 9660 version which defines the limitations of file + naming and data file size. The naming restrictions do not apply to + the Rock Ridge names but only to the low-level ISO 9660 names. + There are three conformance levels: + Level 1 allows ISO names of the form 8.3 and file size up to 4 GiB + - 1. + Level 2 allows ISO names with up to 32 characters and file size up + to 4 GiB - 1. + Level 3 allows ISO names with up to 32 characters and file size + of up to 400 GiB - 200 KiB. (This size limitation is set by the + xorriso implementation and not by ISO 9660 which would allow + nearly 8 TiB.) + Pseudo-level 4 enables production of an additional ISO 9660:1999 + directory tree. + +-disallow_dir_id_ext + Do not follow a bad habit of mkisofs which allows dots in the ISO + names of directories. On the other hand, some bootable GNU/Linux + images depend on this bad habit. + +-U + This option allows ISO file names without dot and up to 37 + characters, ISO file paths longer than 255 characters, and all + ASCII characters in file names. Further it omits the semicolon and + the version numbers at the end of ISO names. + This all violates ISO 9660 specs. + +-untranslated-filenames + Alias of -U. + +-untranslated_name_len number + Allow ISO file names up to the given number of characters without + any character conversion. The maximum number is 96. If a file + name has more characters, then image production will fail + deliberately. + This violates ISO 9660 specs. + +-allow-lowercase + Allow lowercase character in ISO file names. + This violates ISO 9660 specs. + +-d + Do not add trailing dot to ISO file names without dot. + This violates ISO 9660 specs. + +-omit-period + Alias of -d. + +-l + Allow up to 37 characters in ISO file names. + This violates ISO 9660 specs. + +-full-iso9660-filenames + Alias of -l. + +-max-iso9660-filenames + Alias of -l. + +-N + Omit the semicolon and the version numbers at the end of ISO names. + This violates ISO 9660 specs. + +-omit-version-number + Alias of -N. + + +File: xorrisofs.info, Node: SetExtras, Next: SetHide, Prev: SetCompl, Up: Options + +5.5 Settings for standards extensions +===================================== + + +-R + With mkisofs this option enables Rock Ridge extensions. `xorrisofs' + produces them unconditionally. + +-rock + Alias of -R. + +-r + Set Rock Ridge user and group id of all files in the ISO image to + 0. Grant r-permissions to all. Deny all w-permissions. If any + x-permission is set, grant x-permission to all. Remove s-bit and + t-bit. + +-rational-rock + Alias of -r. + +--for_backup + Enable options which improve backup fidelity: --acl, --xattr, + --md5, --hardlinks. + +--acl + Enable recording and loading of ACLs from GNU/Linux or FreeBSD + (see man getfacl, man acl). They will not be in effect with + mounted ISO images. But xorriso can restore them on the same + systems when extracting files from the ISO image. + +--xattr + Enable recording and loading of GNU/Linux or FreeBSD extended + attributes in user namespace (see man getfattr, man attr, resp. + man getextattr, man 9 extattr). They will not be in effect with + mounted ISO images. But xorriso can restore them on the same + systems when extracting files from the ISO image. + +--md5 + Enable recording of MD5 checksums for the overall ISO image and + for each single data file in the image. xorriso can check the + content of an ISO image with these sums and raise alert on + mismatch. See man xorriso, options -check_media, check_md5_r. + xorriso can print recorded MD5 checksums. E.g. by: + -find / -exec get_md5 + +--hardlinks + Enable loading and recording of hardlink relations. Search for + families of iso_rr files which stem from the same disk file, have + identical content filtering and have identical properties. The + members of each family get the same inode number in the ISO image. + Whether these numbers are respected at mount time depends on the + operating system. xorriso can create hardlink families when + extracting files from the ISO image. + +--scdbackup_tag disk_path record_name + Append a scdbackup checksum record to the image. This works only + if the parameter next_writeable_address of option -C is 0. If + disk_path is not an empty string, then append a scdbackup checksum + record to the end of this file. record_name is a word that gets + part of tag and record. + Program scdbackup_verify will recognize and verify tag resp. + record. + +-J + Enable the production of an additional Joliet directory tree along + with the ISO 9660 Rock Ridge tree. + +-joliet + Alias of -J. + +-joliet-long + Allow 103 characters in Joliet file names rather than 64 as is + prescribed by the specification. Allow Joliet paths longer than + the prescribed limit of 240 characters. + Oversized names get truncated. Without this option, oversized + paths get excluded from the Joliet tree. + + +File: xorrisofs.info, Node: SetHide, Next: ImageId, Prev: SetExtras, Up: Options + +5.6 Settings for file hiding +============================ + + +-hide disk_path_pattern + Make files invisible in the directory tree of ISO 9660 and Rock + Ridge, if their disk_path matches the given shell parser pattern. + The data content of such hidden files will be included in the + resulting image, even if they do not show up in any directory. + But you will need own means to find nameless data in the image. + This command does not apply to the boot catalog. + +-hide-list disk_path + Perform -hide using each line out of file disk_path as argument + disk_path_pattern. + +-hide-joliet disk_path_pattern + Like option -hide but making files invisible in the directory tree + of Joliet, if their disk_path matches the given shell parser + pattern. + +-hide-joliet-list disk_path + Perform -hide-joliet using each line out of file disk_path as + argument disk_path_pattern. + + +File: xorrisofs.info, Node: ImageId, Next: Bootable, Prev: SetHide, Up: Options + +5.7 ISO image ID strings +======================== + +The following strings and file addresses get stored in the Primary +Volume Descriptor of the ISO9660 image. The file addresses are ISO 9660 +paths. These files should have iso_rr_paths which consist only of the +characters [A-Z0-9_] and exactly one dot which separates at most 8 +characters from at most 3 characters. + +-V text + Set the Volume Id of the ISO image. xorriso accepts any text up + to 32 characters, but according to rarely obeyed specs stricter + rules apply: + Conformant are ASCII characters out of [A-Z0-9_]. Like: "IMAGE_23" + Joliet allows 16 UCS-2 characters. Like: "Windows name" + Be aware that the volume id might get used automatically as name + of the mount point when the medium is inserted into a playful + computer system. + +-volid text + Alias of -V. + +-volset text + Set the Volume Set Id of the ISO image. Permissible are up to 128 + characters. + +-p text + Set the Publisher Id of the ISO image. This may identify the + person or organisation who specified what shall be recorded. + Permissible are up to 128 characters. + +-publisher text + Alias of -p. + +-A text + Set the Application Id of the ISO image. This may identify the + specification of how the data are recorded. Permissible are up to + 128 characters. + The special text "@xorriso@" gets converted to the id string of + xorriso which is normally written as Preparer Id. It is a wrong + tradition to write the program id as Application Id. + +-appid text + Alias of -A. + +-sysid text + Set the System Id of the ISO image. This may identify the system + which can recognize and act upon the content of the System Area in + image blocks 0 to 15. Permissible are up to 32 characters. + +-p text + Set the Preparer Id of the ISO image. This may identify the person + or other entity which controls the preparation of the data which + shall be recorded. Normally this should be the id of xorriso and + not of the person or program which operates xorriso. Please avoid + to change it. Permissible are up to 128 characters. + The special text "@xorriso@" gets converted to the id string of + xorriso which is default at program startup. + +-preparer text + Alias of -p. + +-abstract iso_path + Set the address of the Abstract File of the ISO image. This should + be the ISO 9660 path of a file in the image which contains an + abstract statement about the image content. Permissible are up to + 37 characters. + +-biblio iso_path + Set the address of the Biblio File of the ISO image. This should + be the ISO 9660 path of a file in the image which contains + bibliographic records. Permissible are up to 37 characters. + +-copyright iso_path + Set the address of the Copyright File of the ISO image. This should + be the ISO 9660 path of a file in the image which contains a + copyright statement. Permissible are up to 37 characters. + +--modification-date=YYYYMMDDhhmmsscc + Set a timestring that overrides ISO image creation and + modification timestamps literally. It must consist of 16 decimal + digits which form YYYYMMDDhhmmsscc, with YYYY between 1970 and + 2999. Time zone is GMT. It is supposed to match this GRUB line: + search --fs-uuid --set YYYY-MM-DD-hh-mm-ss-cc + E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). + + +File: xorrisofs.info, Node: Bootable, Next: SystemArea, Prev: ImageId, Up: Options + +5.8 El Torito Bootable ISO images +================================= + +The precondition for a bootable ISO image is to have in the ISO image +the files of a boot loader. The boot facilities of computers get +directed to such files, which usually execute further program files +from the ISO image. `xorrisofs' can produce several kinds of boot +block or boot record, which become part of the ISO image, and get +interpreted by the according boot facility. + +An *El Torito* boot record points the bootstrapping facility to a boot +catalog with one or more boot images, which are binary program files +stored in the ISO image. The content of the boot image files is not in +the scope of El Torito. +xorriso composes the boot catalog according to the boot image files +given and structured by options -b, -e, -el-torito-alt-boot, and +--efi-boot. Often it contains only one entry. +El Torito gets interpreted by boot facilities PC-BIOS and EFI. Most +bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images +for PC-BIOS. +`xorrisofs' supports the example options out of the ISOLINUX wiki, the +options used in GRUB script grub-mkrescue, and the example in the +FreeBSD AvgLiveCD wiki. + +For CD booting via boot facilities other than PC-BIOS and EFI, and for +booting from USB sticks or hard disks, see the next section about the +Sytem Area. + +-b iso_rr_path + Specify the boot image file which shall be mentioned in the current + entry of the El Torito boot catalog. It will be marked as suitable + for PC-BIOS. + With boot images from ISOLINUX and GRUB this option should be + accompanied by options -c , -no-emul-boot , -boot-load-size 4 , + -boot-info-table. + +-eltorito-boot iso_rr_path + Alias of -b. + +-eltorito-alt-boot + Finalize the current El Torito boot catalog entry and begin a new + one. A boot image file and all its necessary options shall be + specified before option -eltorito-alt-boot. All further El Torito + boot options apply to the new catalog entry. Up to 32 catalog + entries are possible. + +-e iso_rr_path + Specify the boot image file which shall be mentioned in the current + entry of the El Torito boot catalog. It will be marked as suitable + for EFI. + Normally no other El Torito options should be used with the + catalog entry that points to an EFI image. Consider to use + --efi-boot rather than -e. + +--efi-boot iso_rr_path + Perform -eltorito-alt-boot, option -e with the given iso_rr_path, + and again -eltorito-alt-boot. This gesture is used for achieving + EFI-bootability of the GRUB2 rescue CD. + +-boot-load-size number + Set the number of 512-byte blocks for boot images which emulate a + floppy or a hard disk. A safe default for non-emulating boot + images is 4. + +-hard-disk-boot + Mark the boot image in the current catalog entry as emulated hard + disk. (Not suitable for any known boot loader.) + +-no-emul-boot + Mark the boot image in the current catalog entry as not emulating + floppy or hard disk. (This is to be used with all known boot + loaders.) + If neither -hard-disk-boot nor -no-emul-boot is given, then the + boot image will be marked as emulating a floppy. (Not suitable + for any known boot loader.) + +-boot-info-table + Overwrite certain bytes in the current boot image. The information + will be supplied by xorriso in the course of image production: + Block address of the Primary Volume Descriptor, block address of + the boot image file, size of the boot image file. + +-c iso_rr_path + Set the address of the El Torito boot catalog file within the + image. This file address is not significant for the booting + PC-BIOS or EFI, but it may later be read by other programs in + order to learn about the available boot images. + +-eltorito-catalog iso_rr_path + Alias of -c. + +--boot-catalog-hide + Prevent the El Torito boot catalog from appearing as file in the + directory trees of the image. + + +File: xorrisofs.info, Node: SystemArea, Next: Charset, Prev: Bootable, Up: Options + +5.9 System Area, MBR, other boot blocks +======================================= + +The first 16 blocks of an ISO image are the System Area. It is +reserved for system dependent boot software. This may be the CD boot +facilities of exotic hardware architectures or it may be a MBR for +booting via PC-BIOS from USB stick or hard disk. +A *MBR* (Master Boot Record) contains boot code and a partition table. +It does not hamper El Torito booting from CDROM. +`xorrisofs' supports boot facilities other than PC-BIOS: MIPS Big +Endian (SGI), MIPS Little Endian (DEC), SUN SPARC. Those are mutually +not combinable and also not combinable with MBR. + +-G disk_path + Copy at most 32768 bytes from the given disk file to the very + start of the ISO image. + Other than a El Torito boot image, the file disk_path needs not to + be added to the ISO image. It will not show up as file in the + directory trees. + +-generic-boot disk_path + Alias of -G. + +--embedded-boot disk_path + Alias of -G. + +-isohybrid-mbr disk_path + Install disk_path as ISOLINUX isohybrid MBR which makes the boot + image given by option -b bootable from USB sticks and hard disks + via PC-BIOS. This preparation is normally done by ISOLINUX + program isohybrid on the already produced ISO image. + The disk path should lead to one of the Syslinux files + isohdp[fp]x*.bin . The MBR gets patched according to isohybrid + needs. The first partition describes the range of the ISO image. + Its start is at block 0 by default, but may be set to 64 disk + blocks by option -partition_offset 16. + +--protective-msdos-label + Patch the System Area by a simple PC-DOS partition table where + partition 1 claims the range of the ISO image but leaves the first + block unclaimed. + +-partition_offset 2kb_block_adr + Cause a partition table with a single partition that begins at the + given block address. This is counted in 2048 byte blocks, not in + 512 byte blocks. If the block address is non-zero then it must be + at least 16. Values larger than 16 are hardly of use. A non-zero + partition offset causes two superblocks to be generated and two + sets of directory trees. The image is then mountable from its + absolute start as well as from the partition start. + The offset value of an ISO image gets preserved when a new session + is added to a loaded image. So the value defined here is only in + effect if a new ISO image gets written. + +-partition_hd_cyl number + Set the number of heads per cylinder for the partition table. 0 + chooses a default value. Maximum is 255. + +-partition_sec_hd number + Set the number of sectors per head for the partition table. 0 + chooses a default value. Maximum is 63. + The product partition_sec_hd * partition_hd_cyl * 512 is the + cylinder size. It should be divisible by 2048 in order to allow + exact alignment. If it is too small to describe the image size by + at most 1024 cylinders, then appropriate values of + partition_hd_cyl are chosen with partition_sec_hd 32 or 63. If the + image is larger than 8,422,686,720 bytes, then the cylinder size + constraints cannot be fulfilled. They seem not overly important + anyway. Flat block addresses in partition tables are good for 1 + TiB. + +-partition_cyl_align mode + Control image size alignment to an integer number of cylinders. + It is prescribed by isohybrid specs and it seems to please program + fdisk. Cylinder size must be divisible by 2048. Images larger + than 8,323,596,288 bytes cannot be aligned. + Mode "auto" is default. Alignment by padding happens only if + option -isohybrid-mbr is given. + Mode "on" causes alignment by padding with option + --protective-msdos-label too. Mode "off" disables alignment + unconditionally. + +-append_partition partition_number type_code disk_path + Cause a prepared filesystem image to be appended to the ISO image + and to be described by a partition table entry in a boot block at + the start of the emerging ISO image. The partition entry will bear + the size of the submitted file rounded up to the next multiple of + 2048 bytes. + Beware of subsequent multi-session runs. The appended partition + will get overwritten. + partition_number may be 1 to 4. Number 1 will put the whole ISO + image into the unclaimed space before partition 1. So together + with most xorriso MBR features, number 2 would be the most natural + choice. + The type_code may be "FAT12", "FAT16", "Linux", or a hexadecimal + number between 0x00 and 0xff. Not all those numbers will yield + usable results. For a list of codes search the Internet for + "Partition Types" or run fdisk command "L". + +-mips-boot iso_rr_path + Declare a data file in the image to be a MIPS Big Endian boot file + and cause production of a MIPS Big Endian Volume Header. This is + mutually exclusive with production of other boot blocks like MBR. + It will overwrite the first 512 bytes of any data provided by -G. + Up to 15 boot files can be declared by multiple -mips-boot options. + +-mipsel-boot iso_rr_path + Declare a data file in the image to be the MIPS Little Endian boot + file. This is mutually exclusive with other boot blocks. It will + overwrite the first 512 bytes of any data provided by -G. Only a + single boot file can be declared by -mipsel-boot. + +-B disk_path[,disk_path ...] + Cause one or more data files on disk to be written after the end + of the ISO image. A SUN Disk Label will be written into the first + 512 bytes of the ISO image which lists this image as partition 1 + and the given disk_paths as partition 2 up to 8. + The disk files should contain suitable boot images for SUN SPARC + systems. + The pseudo disk_path "..." causes that all empty partition entries + become copies of the last non-empty entry. If no other disk_path + is given before "..." then all partitions describe the ISO image. + In this case, the boot loader code has to be imported by option -G. + +-sparc-boot disk_path[,disk_path ...] + Alias of -B. + +-sparc-label text + Set the ASCII label text of a SUN Disk Label. + + +File: xorrisofs.info, Node: Charset, Next: Jigdo, Prev: SystemArea, Up: Options + +5.10 Character sets +=================== + +Character sets should not matter as long as only english alphanumeric +characters are used for file names or as long as all writers and readers +of the medium use the same character set. Outside these constraints it +may be necessary to let xorriso convert byte codes. +A conversion from input character set to the output character set is +performed when an ISO image gets written. Vice versa there is a +conversion from output character set to the input character set when an +ISO image gets loaded. The sets can be defined by options +-input-charset and -output-charset, if needed. + +-input-charset character_set_name + Set the character set from which to convert disk file names when + inserting them into the ISO image. + +-output-charset character_set_name + Set the character set from which to convert names of loaded ISO + images and to which to convert names when writing ISO images. + + +File: xorrisofs.info, Node: Jigdo, Next: Miscellaneous, Prev: Charset, Up: Options + +5.11 Jigdo Template Extraction +============================== + +From man genisoimage: "Jigdo is a tool to help in the distribution of +large files like CD and DVD images; see http://atterer.net/jigdo/ for +more details. Debian CDs and DVD ISO images are published on the web in +jigdo format to allow end users to download them more efficiently." +If the use of libjte was enabled at compile time of xorriso, then +`xorrisofs' can produce a .jigdo and a .template file together with a +single-session ISO image. If not, then Jigdo options will cause a +FAILURE event, which normally leads to program abort. +One may determine the ability for Jigdo by: + +$ xorrisofs -version 2>&1 | grep '^libjte' && echo YES + +The .jigdo file contains checksums and symbolic file addresses. The +.template file contains the compressed ISO image with reference tags +instead of the content bytes of the listed files. +Input for this process are the normal arguments for a `xorrisofs' +session with no image loaded, and a .md5 file which lists those data +files which may be listed in the .jigdo file and externally referenced +in the .template file. Each designated file is represented in the .md5 +file by a single text line: +MD5 as 32 hex digits, 2 blanks, size as 12 decimal digits or blanks, 2 +blanks, symbolic file address +The file address in an .md5 line has to bear the same basename as the +disk_path of the file which it shall match. The directory path of the +file address is decisive for To=From mapping, not for file recognition. +After To=From mapping, the file address gets written into the .jigdo +file. Jigdo restore tools will convert these addresses into really +reachable data source addresses from which they can read. +If the list of jigdo parameters is not empty, then padding will be +counted as part of the ISO image. + +-jigdo-jigdo disk_path + Set the disk_path for the .jigdo file with the checksums and + download addresses for filling the holes in .template. + +-jigdo-template disk_path + Set the disk_path for the .template file with the holed and + compressed ISO image copy. + +-jigdo-min-file-size size + Set the minimum size for a data file to be listed in the .jigdo + file and being a hole in the .template file. size may be a plain + number counting bytes, or a number with appended letter "k", "m", + "g" to count KiB (1024 bytes), MiB (1024 KiB), or GiB (1024 MiB). + +-jigdo-force-md5 disk_path_pattern + adds a regular expression pattern which will get compared with the + absolute disk_path of any data file that was not found in the .md5 + list. A match causes a MISHAP event, which normally does not abort + the program run but finally causes a non-zero exit value of the + program. + +-jigdo-exclude disk_path_pattern + Add a regular expression pattern which will get compared with the + absolute disk_path of any data file. A match causes the file to + stay in .template in any case. + +-jigdo-map To=From + Add a string pair of the form To=From to the parameter list. If a + data file gets listed in the .jigdo file, then it is referred by + the file address from its line in the .md5 file. This file address + gets checked whether it begins with the From string. If so, then + this string will be replaced by the To string and a ':' character, + before it goes into the .jigdo file. The From string should end by + a '/' character. + +-md5-list disk_path + Set the disk_path where to find the .md5 input file. + +-jigdo-template-compress "gzip"|"bzip2" + Choose one of "bzip2" or "gzip" for the compression of the + template file. The jigdo file is put out uncompressed. + +-checksum_algorithm_iso list_of_names + Choose one or more of "md5", "sha1", "sha256", "sha512" for the + auxiliary "# Image Hex" checksums in the .jigdo file. The + list_of_names may e.g. look like "md5,sha1,sha512". Value "all" + chooses all available algorithms. Note that MD5 stays always + enabled. + +-checksum_algorithm_template list_of_names + Choose the algorithms for the "# Template Hex" checksums in the + .jigdo file. The rules for list_of_names are the same as with + -checksum_algorithm_iso. + + +File: xorrisofs.info, Node: Miscellaneous, Next: ExSimple, Prev: Jigdo, Up: Options + +5.12 Miscellaneous options +========================== + + +-print-size + Print to stdandard output the foreseeable number of 2048 byte + blocks in the emerging ISO image. Do not produce this image. + The result depends on several settings. + If option -emul-toc is given, then padding (see -pad) is not + counted as part of the image size. In this case either use -no-pad + or add 150 (= 300 KiB) to the resulting number. + +--no_rc + Only if used as first argument this option prevents reading and + interpretation of startup files. See section FILES below. + +-help + List supported options to stderr. Original mkisofs options bear + their original mkisofs description texts. + +-quiet + Suppress most messages of the program run, except those which + indicate problems or errors. + +-v + Enable the output of informational program messages. + +-verbose + Alias of -v. + +-version + Print to standard output a text that begins with + "mkisofs 2.01-Emulation Copyright (C)" + and to standard error the version information of xorriso. + + +File: xorrisofs.info, Node: Examples, Next: Files, Prev: Options, Up: Top + +6 Examples +********** + +* Menu: + +* ExSimple:: A simple image production run +* ExGraft:: Set ISO image paths by -graft-points +* ExMkisofs:: Perform multi-session runs +* ExGrowisofs:: Let xorriso work underneath growisofs +* ExIncBackup:: Incremental backup of a few directory trees +* ExIncBckAcc:: Incremental backup with accumulated trees +* ExBootable:: Create bootable images for PC-BIOS + + +File: xorrisofs.info, Node: ExSimple, Next: ExGraft, Prev: Miscellaneous, Up: Examples + +6.1 A simple image production run +================================= + +A prepared file tree in directory ./for_iso gets copied into the root +directory of the ISO image. File permissions get set to read-only for +everybody. Joliet attributes for Microsoft systems get added. The +resulting image gets written as data file ./image.iso on disk. + +$ xorrisofs -r -J -o ./image.iso ./for_iso + + +File: xorrisofs.info, Node: ExGraft, Next: ExMkisofs, Prev: ExSimple, Up: Examples + +6.2 Set ISO image paths by -graft-points +======================================== + +Without option -graft-points each given disk file is copied into the +root directory of the ISO image, maintaining its name. If a directory +is given, then its files and sub-directories are copied into the root +directory, maintaining their names. + +$ xorrisofs ... /home/me/datafile /tmp/directory + +yields in the ISO image root directory: + +/datafile +/file_1_from_directory +... +/file_N_from_directory + +With option -graft-points it is possible to put files and directories to +arbitrary paths in the ISO image. + +$ xorrisofs ... -graft-points /home/me/datafile /dir=/tmp/directory + +yields in the ISO image root directory: + +/datafile +/dir + +Eventually needed parent directories in the image will be created +automatically: + +/datafiles/file1=/home/me/datafile + +yields in the ISO image: + +/datafiles/file1 + +The attributes of directory /datafiles get copied from /home/me on disk. + +Normally one should avoid = and \ characters in the ISO part of a +pathspec. But if it must be, one may escape them: + +/with_\=_and_\\/file=/tmp/directory/file + +yields in the ISO image: + +/with_=_and_\/file + + +File: xorrisofs.info, Node: ExMkisofs, Next: ExGrowisofs, Prev: ExGraft, Up: Examples + +6.3 Perform multi-session runs +============================== + +This example works for multi-session media only: CD-R[W], DVD-R[W], +DVD+R, BD-R. Add cdrskin option --grow_overwriteable_iso to all -as +cdrecord runs in order to enable multi-session emulation on +overwriteable media. +The first session is written like this: + +$ xorrisofs -graft-points \ +/tree1=prepared_for_iso/tree1 \ +| xorriso -as cdrecord -v dev=/dev/sr0 blank=fast -multi -eject - + +Follow-up sessions are written like this: + +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +$ m=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +$ xorrisofs -M /dev/sr0 -C $m -graft-points \ +/tree2=prepared_for_iso/tree2 \ +| xorriso -as cdrecord -v dev=/dev/sr0 -waiti -multi -eject - + +Always eject the drive tray between sessions. The old sessions get read +via /dev/sr0. Its device driver might not be aware of the changed +content before it loads the medium again. In this case the previous +session would not be loaded and the new session would contain only the +newly added files. +For the same reason do not let xorriso -as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. + + +File: xorrisofs.info, Node: ExGrowisofs, Next: ExIncBackup, Prev: ExMkisofs, Up: Examples + +6.4 Let xorriso work underneath growisofs +========================================= + +growisofs expects an ISO formatter program which understands options -C +and -M. A variable is defined to override the hardcoded default name. + +$ export MKISOFS="xorrisofs" +$ growisofs -Z /dev/dvd /some/files +$ growisofs -M /dev/dvd /more/files + +If no "xorrisofs" is available on your system, then you will have to +create a link pointing to the xorriso binary and tell growisofs to use +it. E.g. by: + +$ ln -s $(which xorriso) "$HOME/xorrisofs" +$ export MKISOFS="$HOME/xorrisofs" + +One may quit mkisofs emulation by argument "--" and make use of all +xorriso commands. growisofs dislikes options which start with "-o" but +-outdev must be set to "-". So use "outdev" instead: + +$ growisofs -Z /dev/dvd --for_backup -- \ +outdev - -update_r /my/files /files +$ growisofs -M /dev/dvd --for_backup -- \ +outdev - -update_r /my/files /files +Note that --for_backup is given in the mkisofs emulation. To preserve +the recorded extra data it must already be in effect, when the +emulation loads the image. + + +File: xorrisofs.info, Node: ExIncBackup, Next: ExIncBckAcc, Prev: ExGrowisofs, Up: Examples + +6.5 Incremental backup of a few directory trees +=============================================== + +This changes the directory trees /open_source_project and /personal_mail +in the ISO image so that they become exact copies of their disk +counterparts. ISO file objects get created, deleted or get their +attributes adjusted accordingly. +ACL, xattr, hard links and MD5 checksums will be recorded. It is +expected that inode numbers in the disk filesystem are persistent over +cycles of mounting and booting. Files with names matching *.o or *.swp +get excluded explicitly. + +To be used several times on the same medium, whenever an update of the +two disk trees to the medium is desired. Begin with a blank medium and +update it until he run fails gracefully due to lack of remaining space +on the old one. +Do not let xorriso -as cdrecord load the medium, but rather do this +manually or by a program that reads from /dev/sr0. + +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +$ msinfo=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +$ load_opts= +$ test -n "$msinfo" && load_opts="-M /dev/sr0 -C $msinfo" +$ xorrisofs $load_opts -o - --for_backup -m '*.o' -m '*.swp' \ +-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \ +-old-root / \ +/projects=/home/thomas/projects \ +/personal_mail=/home/thomas/personal_mail \ +| xorriso -as cdrecord dev=/dev/sr0 -v -multi -waiti -eject - + +This makes sense if the full backup leaves substantial remaining +capacity on media and if the expected changes are much smaller than the +full backup. + +*Better do not use your youngest backup for -old-root*. Have at least +two media which you use alternatingly. So only older backups get +endangered by the new write operation, while the newest backup is +stored safely on a different medium. +Always have a blank medium ready to perform a full backup in case the +update attempt fails due to insufficient remaining capacity. This +failure will not spoil the old medium, of course. + +If inode numbers on disk are not persistent, then use option +--old-root-no-ino . In this case an update run will compare recorded +MD5 sums against the current file content on hard disk. + +With *mount* option *-o "sbsector="* on GNU/Linux resp. *-s* on FreeBSD +it is possible to access the session trees which represent the older +backup versions. With CD media, GNU/Linux mount accepts session numbers +directly by its option "session=". +Multi-session media and most overwriteable media written by xorriso can +tell the sbsectors of their sessions by xorriso option -toc: + +$ xorriso -dev /dev/sr0 -toc + +xorriso can print the matching mount command for a session number: + +$ xorriso -mount_cmd /dev/sr0 session 12 /mnt + +or for a volume id that matches a search expression: + +$ xorriso -mount_cmd /dev/sr0 volid '*2008_12_05*' /mnt + +Both yield on standard output something like: +mount -t iso9660 -o nodev,noexec,nosuid,ro,sbsector=1460256 '/dev/sr0' +'/mnt' + +The superuser may let xorriso execute the mount command directly: + +# osirrox -mount /dev/sr0 "volid" '*2008_12_05*' /mnt + + +File: xorrisofs.info, Node: ExIncBckAcc, Next: ExBootable, Prev: ExIncBackup, Up: Examples + +6.6 Incremental backup with accumulated trees +============================================= + +Solaris does not offer the option to mount older sessions. In order to +keep them accessible, one may map all files to a file tree under a +session directory and accumulate those directories from session to +session. The -root tree is cloned from the -old-root tree before it +gets compared with the appropriate trees on disk. +This demands to know the previously used session directory name. +With the first session: + +$ xorrisofs -root /session1 \ +-o - --for_backup -m '*.o' -m '*.swp' \ +-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \ +/projects=/home/thomas/projects \ +/personal_mail=/home/thomas/personal_mail \ +| xorriso -as cdrecord dev=/dev/sr0 -v blank=as_needed \ +-multi -waiti -eject - + +With the second session, option -old-root refers to /session1 and the +new -root is /session2. +Do not let xorriso -as cdrecord load the medium, but rather do this +manually or by a program that reads from /dev/sr0. + +$ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +$ msinfo=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +$ load_opts= +$ test -n "$msinfo" && load_opts="-M /dev/sr0 -C $msinfo" +$ xorrisofs $load_opts -root /session2 -old-root /session1 \ +-o - --for_backup -m '*.o' -m '*.swp' \ +-V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \ +/projects=/home/thomas/projects \ +/personal_mail=/home/thomas/personal_mail \ +| xorriso -as cdrecord dev=/dev/sr0 -v -multi -waiti -eject - + +With the third session, option -old-root refers to /session2. The new +-root is /session3. And so on. + + +File: xorrisofs.info, Node: ExBootable, Prev: ExIncBckAcc, Up: Examples + +6.7 Create bootable images for PC-BIOS +====================================== + +The ISOLINUX wiki prescribes to create on disk a directory ./CD_root and +to copy all desired files underneath that directory. Especially file +isolinux.bin shall be copied to ./CD_root/isolinux/isolinux.bin . This +is the boot image file. +The prescribed mkisofs options can be used unchanged with `xorrisofs': + +$ xorrisofs -o output.iso \ +-b isolinux/isolinux.bin -c isolinux/boot.cat \ +-no-emul-boot -boot-load-size 4 -boot-info-table \ +./CD_root + +Put it on CD by a burn program. E.g.: + +$ xorriso -as cdrecord -v dev=/dev/sr0 blank=as_needed output.iso + +The image from above example will boot from CD, DVD or BD, but not from +USB stick or other hard-disk-like devices. This can be done by help of +an isohybrid MBR. Syslinux provides matching template files as +isohdp[fp]x*.bin . E.g. /usr/lib/syslinux/isohdpfx.bin . +If a few hundred KB of size do not matter, then option -partition_offset +can be used to create a partition table where partition 1 starts not at +block 0. This facilitates later manipulations of the USB stick by tools +for partitioning and formatting. +The image from the following example will be prepared for booting via +MBR and its first parttion will start at hard disk block 64. +It will also boot from optical media. + +$ xorrisofs -o output.iso \ +-b isolinux/isolinux.bin -c isolinux/boot.cat \ +-no-emul-boot -boot-load-size 4 -boot-info-table \ +-isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin \ +-partition_offset 16 \ +./CD_root + +Become superuser and copy the image to the unpartitioned base device +file of the USB stick. On GNU/Linux this is e.g. /dev/sdb, not +/dev/sdb1. +CAUTION: This will overwrite any partitioning on the USB stick and make +remaining data unaccessible. +So first make sure you got the correct address of the intended device. +E.g. by reading 100 MiB data from it and watching it blinking: + +# dd bs=2K if=/dev/sdb count=50K >/dev/null + +Now copy the image onto it + +# dd bs=2K if=output.iso of=/dev/sdb + + +File: xorrisofs.info, Node: Files, Next: Seealso, Prev: Examples, Up: Top + +7 Files +******* + +7.1 Startup Files +================= + +If not -no_rc is given as the first argument then `xorrisofs' attempts +on startup to read and execute lines from the following files: + +/etc/default/xorriso +/etc/opt/xorriso/rc +/etc/xorriso/xorriso.conf +$HOME/.xorrisorc + +The files are read in the sequence given here, but none of them is +required to exist. The lines are not interpreted as `xorrisofs' options +but as generic xorriso commands. See man xorriso. After the xorriso +startup files, the program tries one by one to open for reading: + +./.mkisofsrc +$MKISOFSRC +$HOME/.mkisofsrc +$(dirname $0)/.mkisofsrc + +On success it interprets the file content and does not try further +files. The last address is used only if start argument 0 has a +non-trivial dirname. +The reader currently interprets the following NAME=VALUE pairs: + +APPI default for -A +PUBL default for -publisher +SYSI default for -sysid +VOLI default for -V +VOLS default for -volset + +Any other lines will be silently ignored. + +File: xorrisofs.info, Node: Seealso, Next: Bugreport, Prev: Files, Up: Top + +8 See also +********** + +For generic `xorriso' command mode + xorriso(1) + +For the cdrecord emulation of `xorriso' + xorrecord(1) + +For mounting xorriso generated ISO 9660 images (-t iso9660) + mount(8) + +Other programs which produce ISO 9660 images + mkisofs(8), genisoimage(8) + +Programs which burn sessions to optical media + growisofs(1), cdrecord(1), wodim(1), cdrskin(1), xorriso(1) + +ACL and xattr + getfacl(1), setfacl(1), getfattr(1), setfattr(1) + +MD5 checksums + md5sum(1) + +On FreeBSD some commands differ: + getextattr(8), setextattr(8), md5(1) + + +File: xorrisofs.info, Node: Bugreport, Next: Legal, Prev: Seealso, Up: Top + +9 Reporting bugs +**************** + +To report bugs, request help, or suggest enhancements for `xorriso', +please send electronic mail to the public list . +If more privacy is desired, mail to . + +Please describe what you expect `xorriso' to do, the program arguments +resp. commands by which you tried to achieve it, the messages of +`xorriso', and the undesirable outcome of your program run. + +Expect to get asked more questions before solutions can be proposed. + + +File: xorrisofs.info, Node: Legal, Next: CommandIdx, Prev: Bugreport, Up: Top + +10 Author, Copyright, Credits +***************************** + +10.1 Author +=========== + +Thomas Schmitt +for libburnia-project.org + +10.2 Copyright +============== + +Copyright (c) 2011 Thomas Schmitt +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of xorriso. If you make +use of the license to derive modified versions of xorriso then you are +entitled to modify this text under that same license. + +10.3 Credits +============ + +`xorrisofs' is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +Compliments towards Joerg Schilling whose cdrtools served me for ten +years. + + +File: xorrisofs.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top + +11 Alphabetic Command List +************************** + +[index] +* Menu: + +* --acl Recording of ACLs: SetExtras. (line 28) +* --boot-catalog-hide Hide El Torito boot catalog: Bootable. + (line 95) +* --efi-boot El Torito EFI boot image: Bootable. (line 58) +* --embedded-boot Fill System Area e.g. by MBR: SystemArea. (line 27) +* --emul-toc enable table-of-content emulation: SetProduct. (line 35) +* --for_backup Enable backup fidelity: SetExtras. (line 24) +* --hardlinks Recording of hardlink relations: SetExtras. (line 49) +* --md5 Recording of MD5 checksums: SetExtras. (line 41) +* --modification-date set ISO image timestamps: ImageId. (line 82) +* --no-emul-toc no table-of-content emulation: SetProduct. (line 44) +* --no_rc do not execute startup files: Miscellaneous. (line 16) +* --old-empty old block addresses for empty files: SetProduct. + (line 81) +* --old-root-devno enable disk idevno with -old-root: SetInsert. + (line 97) +* --old-root-no-ino disable disk ino with -old-root: SetInsert. + (line 84) +* --old-root-no-md5 disable MD5 with -old-root: SetInsert. (line 105) +* --protective-msdos-label Patch System Area partition table: SystemArea. + (line 41) +* --quoted_path_list read pathspecs from disk file: SetInsert. + (line 13) +* --scdbackup_tag Recording of MD5 checksum: SetExtras. (line 58) +* --sort-weight set output file address: SetProduct. (line 49) +* --stdio_sync control forced output to disk files: SetProduct. + (line 25) +* --xattr Recording of xattr: SetExtras. (line 34) +* -A set Application Id: ImageId. (line 38) +* -abstract set Abstract File path: ImageId. (line 66) +* -allow-lowercase lowercase in ISO file names: SetCompl. (line 46) +* -append_partition Append MBR partition after image: SystemArea. + (line 86) +* -appid set Application Id: ImageId. (line 46) +* -b El Torito PC-BIOS boot image: Bootable. (line 32) +* -B SUN SPARC boot images: SystemArea. (line 116) +* -biblio set Biblio File path: ImageId. (line 72) +* -boot-info-table Patch El Torito boot image: Bootable. (line 80) +* -boot-load-size El Torito boot image load size: Bootable. (line 63) +* -c El Torito boot catalog name: Bootable. (line 86) +* -C set load address and write address offset: Loading. (line 28) +* -cdrecord-params set load address and write address offset: Loading. + (line 50) +* -checksum_algorithm_iso choose .jigdo checksums: Jigdo. (line 80) +* -checksum_algorithm_template choose .template checksums: Jigdo. + (line 87) +* -copyright set Copyright File path: ImageId. (line 77) +* -d omit trailing dot in ISO file names: SetCompl. (line 50) +* -dev set path for loading existing ISO image: Loading. (line 25) +* -dir-mode permissions for all directories: SetProduct. (line 60) +* -disallow_dir_id_ext enforce ISO level 1 directory names: SetCompl. + (line 24) +* -e El Torito EFI boot image: Bootable. (line 50) +* -eltorito-alt-boot begin next boot catalog entry: Bootable. + (line 43) +* -eltorito-boot El Torito PC-BIOS boot image: Bootable. (line 40) +* -eltorito-catalog El Torito boot catalog name: Bootable. (line 92) +* -exclude exclude disk files from inserting: SetInsert. (line 42) +* -exclude-list exclude disk files from inserting: SetInsert. + (line 51) +* -f follow symbolic links on disk: SetInsert. (line 24) +* -file-mode permissions for all data files: SetProduct. (line 66) +* -follow-links follow symbolic links on disk: SetInsert. (line 28) +* -full-iso9660-filenames allow 37 characters in ISO file names: SetCompl. + (line 61) +* -G Fill System Area e.g. by MBR: SystemArea. (line 17) +* -generic-boot Fill System Area e.g. by MBR: SystemArea. (line 24) +* -graft-points enable target=source pathspecs: SetInsert. (line 31) +* -hard-disk-boot El Torito boot image emulation: Bootable. (line 68) +* -help list supported options: Miscellaneous. (line 20) +* -hide keep matching files invisible in ISO tree: SetHide. (line 8) +* -hide-joliet keep matching files invisible in Joliet tree: SetHide. + (line 20) +* -hide-joliet-list keep matching files invisible in Joliet tree: SetHide. + (line 25) +* -hide-list keep matching files invisible in ISO tree: SetHide. + (line 16) +* -input-charset set character set of disk file names: Charset. + (line 17) +* -iso-level define ISO 9660 limitations: SetCompl. (line 7) +* -isohybrid-mbr Install ISOLINUX isohybrid MBR: SystemArea. + (line 30) +* -J enable production of Joliet directory tree: SetExtras. (line 67) +* -jigdo-exclude add exclusion pattern for .md5: Jigdo. (line 59) +* -jigdo-force-md5 add check pattern for .md5: Jigdo. (line 52) +* -jigdo-jigdo set name of .jigdo file: Jigdo. (line 38) +* -jigdo-map add address translation for .jigdo: Jigdo. (line 64) +* -jigdo-min-file-size set minimum extract size: Jigdo. (line 46) +* -jigdo-template set name of .template file: Jigdo. (line 42) +* -jigdo-template-compress choose compression algorithm: Jigdo. + (line 76) +* -joliet enable production of Joliet directory tree: SetExtras. + (line 71) +* -joliet-long allow longer Joliet names: SetExtras. (line 74) +* -l allow 37 characters in ISO file names: SetCompl. (line 57) +* -m exclude disk files from inserting: SetInsert. (line 35) +* -M set path for loading existing ISO image: Loading. (line 11) +* -max-iso9660-filenames allow 37 characters in ISO file names: SetCompl. + (line 64) +* -md5-list set path of readable .md5: Jigdo. (line 73) +* -mips-boot MIPS Big Endian boot image: SystemArea. (line 103) +* -mipsel-boot MIPS Little Endian boot image: SystemArea. (line 110) +* -N omit version number in ISO file names: SetCompl. (line 67) +* -no-emul-boot El Torito boot image emulation: Bootable. (line 72) +* -no-pad do not add zeros to ISO tree: SetProduct. (line 76) +* -o set output file address: SetProduct. (line 8) +* -old-exclude exclude disk files from inserting: SetInsert. + (line 48) +* -old-root enable incremental insertion: SetInsert. (line 70) +* -omit-period omit trailing dot in ISO file names: SetCompl. + (line 54) +* -omit-version-number omit version number in ISO file names: SetCompl. + (line 71) +* -output set output file address: SetProduct. (line 22) +* -output-charset set character set of ISO file names: Charset. + (line 21) +* -p set Preparer Id: ImageId. (line 54) +* -p set Publisher Id: ImageId. (line 30) +* -pad add 300 KiB of zeros to ISO tree: SetProduct. (line 69) +* -partition_cyl_align Image size alignment: SystemArea. (line 75) +* -partition_hd_cyl MBR heads per cylinder: SystemArea. (line 58) +* -partition_offset Make mountable by partition 1: SystemArea. + (line 46) +* -partition_sec_hd MBR sectors per head: SystemArea. (line 62) +* -path-list read pathspecs from disk file: SetInsert. (line 8) +* -preparer set Preparer Id: ImageId. (line 63) +* -prev-session set path for loading existing ISO image: Loading. + (line 22) +* -print-size predict ISO image size: Miscellaneous. (line 8) +* -publisher set Publisher Id: ImageId. (line 35) +* -quiet suppress most messages: Miscellaneous. (line 24) +* -R Rock Ridge (is always enabled): SetExtras. (line 8) +* -r Rock Ridge with altered owner and permission: SetExtras. + (line 15) +* -rational-rock Rock Ridge with altered owner and permission: SetExtras. + (line 21) +* -rock Rock Ridge (is always enabled): SetExtras. (line 12) +* -root redirect ISO root directory: SetInsert. (line 64) +* -sparc-boot SUN SPARC boot images: SystemArea. (line 128) +* -sparc-label SUN Disk Label text: SystemArea. (line 131) +* -sysid set System Id: ImageId. (line 49) +* -transparent-compression enable recognition of zisofs files: SetInsert. + (line 61) +* -U very relaxed filename rules: SetCompl. (line 29) +* -untranslated-filenames very relaxed filename rules: SetCompl. + (line 36) +* -untranslated_name_len untranslated file names: SetCompl. (line 39) +* -v enable verbous messages: Miscellaneous. (line 28) +* -V set Volume Id: ImageId. (line 13) +* -verbose enable verbous messages: Miscellaneous. (line 31) +* -version report program version: Miscellaneous. (line 34) +* -volid set Volume Id: ImageId. (line 23) +* -volset set Volume Set Id: ImageId. (line 26) +* -x exclude disk files from inserting: SetInsert. (line 45) +* -z enable recognition of zisofs files: SetInsert. (line 55) + + +File: xorrisofs.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top + +12 Alphabetic List of Concepts and Objects +****************************************** + +[index] +* Menu: + +* Abstract File, set path, -abstract: ImageId. (line 66) +* ACL, record and load, --acl: SetExtras. (line 28) +* Application Id, set, -A, -appid: ImageId. (line 38) +* Backup, enable fidelity, --for_backup: SetExtras. (line 24) +* Biblio File, set path, -biblio: ImageId. (line 72) +* Block address, set sort weight, --sort-weight: SetProduct. (line 49) +* Bootability, boot catalog hidden, --boot-catalog-hide: Bootable. + (line 95) +* Bootability, boot catalog name, -c, -eltorito-catalog: Bootable. + (line 86) +* Bootability, boot image emulation, -hard-disk-boot: Bootable. + (line 68) +* Bootability, boot image load size, -boot-load-size: Bootable. + (line 63) +* Bootability, boot image patching, -boot-info-table: Bootable. + (line 80) +* Bootability, control, --efi-boot: Bootable. (line 58) +* Bootability, control, -b, -eltorito-boot: Bootable. (line 32) +* Bootability, control, -B, -sparc-boot: SystemArea. (line 116) +* Bootability, control, -e: Bootable. (line 50) +* Bootability, control, -mips-boot: SystemArea. (line 103) +* Bootability, control, -mipsel-boot: SystemArea. (line 110) +* Bootability, fill System Area e.g. by MBR, -G, --embedded-boot, -generic-boot: SystemArea. + (line 17) +* Bootability, install ISOLINUX isohybrid MBR, -isohybrid-mbr: SystemArea. + (line 30) +* Bootability, next entry, -eltorito-alt-boot: Bootable. (line 43) +* Bootability, no boot image emulation, -no-emul-boot: Bootable. + (line 72) +* Bootability, patch System Area partition table, --protective-msdos-label: SystemArea. + (line 41) +* Bootability, SUN Disk Label text, -sparc-label: SystemArea. (line 131) +* Bugs, reporting: Bugreport. (line 6) +* Character Set, for disk file names, -input-charset: Charset. + (line 17) +* Character Set, for ISO file names, -output-charset: Charset. + (line 21) +* Character sets, _definition: Charset. (line 6) +* Copyright File, set path, -copyright: ImageId. (line 77) +* Disk files, exclude, -hide-list: SetInsert. (line 51) +* Disk files, exclude, -m, -exclude, -x, -old-exclude: SetInsert. + (line 35) +* disk_path, _definition: Insert. (line 8) +* ECMA-119, _definiton: Standards. (line 6) +* El Torito, _definiton: Bootable. (line 13) +* Examples: Examples. (line 6) +* Forced output, control, --stdio_sync: SetProduct. (line 25) +* Hiding, from ISO and Rock Ridge, -hide: SetHide. (line 8) +* Hiding, from ISO and Rock Ridge, -hide-list: SetHide. (line 16) +* Hiding, from Joliet, -hide-joliet: SetHide. (line 20) +* Hiding, from Joliet, -hide-joliet-list: SetHide. (line 25) +* Image size, alignment, -partition_cyl_align: SystemArea. (line 75) +* Incremental insertion, disable disk ino, --old-root-no-ino: SetInsert. + (line 84) +* Incremental insertion, disable MD5, --old-root-no-md5: SetInsert. + (line 105) +* Incremental insertion, enable disk devno, --old-root-devno: SetInsert. + (line 97) +* Incremental insertion, enable, -old-root: SetInsert. (line 70) +* ISO 9660, _definiton: Standards. (line 6) +* ISO 9660:1999, _definiton: Standards. (line 26) +* ISO file names, allow 37 characters, -l, -full-iso9660-filenames, -max-iso9660-filenames: SetCompl. + (line 57) +* ISO file names, allow lowercase, -allow-lowercase: SetCompl. + (line 46) +* ISO file names, omit trailing dot, -d, -omit-period: SetCompl. + (line 50) +* ISO file names, omit version number, -N, -omit-version-number: SetCompl. + (line 67) +* ISO file names, untranslated, -untranslated_name_len: SetCompl. + (line 39) +* ISO file names, very relaxed rules, -U, -untranslated-filenames: SetCompl. + (line 29) +* ISO image size, predict, -print-size: Miscellaneous. (line 8) +* ISO image, set timestamps, --modification-date=: ImageId. (line 82) +* ISO level 1, enforce directory names, -disallow_dir_id_ext: SetCompl. + (line 24) +* ISO level, specify, -iso-level: SetCompl. (line 7) +* ISO root directory, redirect, -root: SetInsert. (line 64) +* iso_rr_path, _definition: Insert. (line 9) +* Jigdo Template Extraction, -checksum_algorithm_iso: Jigdo. (line 80) +* Jigdo Template Extraction, -checksum_algorithm_template: Jigdo. + (line 87) +* Jigdo Template Extraction, -jigdo-exclude: Jigdo. (line 59) +* Jigdo Template Extraction, -jigdo-force-md5: Jigdo. (line 52) +* Jigdo Template Extraction, -jigdo-jigdo: Jigdo. (line 38) +* Jigdo Template Extraction, -jigdo-map: Jigdo. (line 64) +* Jigdo Template Extraction, -jigdo-min-file-size: Jigdo. (line 46) +* Jigdo Template Extraction, -jigdo-template: Jigdo. (line 42) +* Jigdo Template Extraction, -jigdo-template-compress: Jigdo. (line 76) +* Jigdo Template Extraction, -md5-list: Jigdo. (line 73) +* Jigdo Template Extraction, _definition: Jigdo. (line 6) +* Joliet, _definiton: Standards. (line 21) +* Joliet, allows longer names, -joliet-long: SetExtras. (line 74) +* Joliet, enable, -J, -joliet: SetExtras. (line 67) +* Links, follow on disk, -f, -follow-links: SetInsert. (line 24) +* Links, record and load hard links, --hardlinks: SetExtras. (line 49) +* MBR, _definiton: SystemArea. (line 10) +* MBR, append partition, -append_partition: SystemArea. (line 86) +* MBR, sectors per head, -partition_sec_hd: SystemArea. (line 58) +* MD5, record and load, --md5: SetExtras. (line 41) +* Message output, suppress, -quiet: Miscellaneous. (line 24) +* Mountability, by non-trivial partition 1, -partition_offset: SystemArea. + (line 46) +* Options, list, -help: Miscellaneous. (line 20) +* Output file, set address, -o, -output: SetProduct. (line 8) +* Padding, 300 KiB, -pad: SetProduct. (line 69) +* Padding, disable, --old-empty: SetProduct. (line 81) +* Padding, disable, -no-pad: SetProduct. (line 76) +* pathspec, _definition: Insert. (line 11) +* pathspec, enable target=source, -graft-points: SetInsert. (line 31) +* pathspec, read list of, --quoted_path_list: SetInsert. (line 13) +* pathspec, read list of, -path-list: SetInsert. (line 8) +* Permissions, for all data files, -file-mode: SetProduct. (line 66) +* Permissions, for all directories, -dir-mode: SetProduct. (line 60) +* Preparer Id, set, -p: ImageId. (line 54) +* Problems, reporting: Bugreport. (line 6) +* Program version, report, -version: Miscellaneous. (line 34) +* Publisher Id, set, -p, -publisher: ImageId. (line 30) +* Rock Ridge, (always enabled), -R, -rock: SetExtras. (line 8) +* Rock Ridge, _definiton: Standards. (line 14) +* Rock Ridge, altered owner and permission, -r, -rational-rock: SetExtras. + (line 15) +* scdbackup, record checksum tag, --scdbackup_tag: SetExtras. (line 58) +* Session, select path, -M, -prev-session, -dev: Loading. (line 11) +* Session, set load and write address, -C, -cdrecord-params: Loading. + (line 28) +* Startup files, suppress, --no_rc: Miscellaneous. (line 16) +* System Area, _definiton: SystemArea. (line 6) +* System Id, set, -sysid: ImageId. (line 49) +* Table-of-content, emulation off, --no-emul-toc: SetProduct. (line 44) +* Table-of-content, emulation, --emul-toc: SetProduct. (line 35) +* Verbosity, high, -v, -verbose: Miscellaneous. (line 28) +* Volume Id, set, -V, -volid: ImageId. (line 13) +* Volume Set Id, set, -volset: ImageId. (line 26) +* xattr, record and load, --xattr: SetExtras. (line 34) +* xorriso, mkisofs emulation: Xorriso. (line 6) +* xorriso, options: Options. (line 6) +* zisofs file, enable recognition, -z, -transparent-compression: SetInsert. + (line 55) + + + +Tag Table: +Node: Top397 +Node: Overview1103 +Node: Standards1541 +Node: Insert3218 +Node: Xorriso4990 +Node: Options6129 +Node: Loading6846 +Node: SetInsert9142 +Node: SetProduct13558 +Node: SetCompl17265 +Node: SetExtras19584 +Node: SetHide22561 +Node: ImageId23560 +Node: Bootable27065 +Node: SystemArea31130 +Node: Charset37464 +Node: Jigdo38490 +Node: Miscellaneous42757 +Node: Examples43921 +Node: ExSimple44407 +Node: ExGraft44886 +Node: ExMkisofs46133 +Node: ExGrowisofs47386 +Node: ExIncBackup48558 +Node: ExIncBckAcc51666 +Node: ExBootable53342 +Node: Files55434 +Node: Seealso56508 +Node: Bugreport57164 +Node: Legal57745 +Node: CommandIdx58553 +Node: ConceptIdx69886 + +End Tag Table diff --git a/libisoburn/branches/1.1.8/xorriso/xorrisofs.texi b/libisoburn/branches/1.1.8/xorriso/xorrisofs.texi new file mode 100644 index 00000000..08eaf104 --- /dev/null +++ b/libisoburn/branches/1.1.8/xorriso/xorrisofs.texi @@ -0,0 +1,2093 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename xorrisofs.info +@settitle GNU xorrisofs 1.1.7 +@c %**end of header +@c +@c man-ignore-lines begin +@dircategory Archiving +@direntry +* Xorrisofs: (xorrisofs). Emulates ISO 9660 program mkisofs +@end direntry +@c man-ignore-lines end +@c +@c Notes about embedded man page: +@c This texinfo code contains the necessary info to produce a man page +@c which resembles much the version of xorriso.1 from which this code +@c was originally derived in march 2010. +@c One can produce the man page by applying the following rules: +@c The first line gets discarded. +@c Line start "@c man " will become "", the remainder is put out unaltered. +@c Lines "@*" will be converted to ".br" +@c "@c man-ignore-lines N" will discard N following lines. +@c "@c man-ignore-lines begin" discards all following lines +@c up to "@c man-ignore-lines end". +@c Line blocks of "@menu" "@end menu" will be discarded. +@c "@item word words" becomes "\fBword\fR words". +@c @b{...}, @command{...}, @dfn{...}, @emph{...}, @strong{...} +@c get mapped to \fB...\fR . +@c @abbr{...}, @code{...}, @file{...}, @i{...}, @option{...}, @r{...}, +@c @ref{...}, @samp{...},@var{...}, get mapped to ... . +@c @ref{...}, @xref{...} get mapped to empty text. +@c @email{...} gets mapped to <...> . +@c Mapped {...} content is subject to the rules except {...} mapping. +@c @minus{} will become "-". +@c @@ , @{, @} will get stripped of their first @. +@c Other lines which begin by "@" will be discarded. +@c In lines not stemming from "@c man", "\" becomes "\\" +@c "-" which are not preceded by an uneven number of "\" will get +@c prepended one "\". +@c +@c +@c man .\" Hey, EMACS: -*- nroff -*- +@c man .\" +@c man .\" IMPORTANT NOTE: +@c man .\" +@c man .\" The original of this file is kept in xorriso/xorrisofs.texi +@c man .\" This here was generated by program xorriso/make_xorriso_1 +@c man .\" +@c man .\" +@c man .\" First parameter, NAME, should be all caps +@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +@c man .\" other parameters are allowed: see man(7), man(1) +@c man .TH XORRISOFS 1 "Version 1.1.7, Oct 24, 2011" +@c man .\" Please adjust this date whenever revising the manpage. +@c man .\" +@c man .\" Some roff macros, for reference: +@c man .\" .nh disable hyphenation +@c man .\" .hy enable hyphenation +@c man .\" .ad l left justify +@c man .\" .ad b justify to both left and right margins +@c man .\" .nf disable filling +@c man .\" .fi enable filling +@c man .\" .br insert line break +@c man .\" .sp insert n+1 empty lines +@c man .\" for manpage-specific macros, see man(7) +@c man .nh +@c man-ignore-lines begin +@copying +xorrisofs - Emulation of ISO 9660 program mkisofs by program xorriso + +Copyright @copyright{} 2011 - 2011 Thomas Schmitt + +@quotation +Permission is granted to distrubute this text freely. +@end quotation +@end copying +@c man-ignore-lines end +@titlepage +@title Manual of GNU xorriso personality xorrisofs 1.1.7 +@author Thomas Schmitt +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents +@ifnottex +@node Top +@top xorrisofs 1.1.7 +@c man-ignore-lines 1 + +@c man .SH NAME +xorrisofs - Emulation of ISO 9660 program mkisofs by program xorriso +@end ifnottex +@menu +* Overview:: Overview +* Standards:: ISO 9660, Rock Ridge, Joliet +* Insert:: Inserting files into the ISO image +* Xorriso:: Relation to program xorriso +* Options:: Options +* Examples:: Examples +* Files:: Files +* Seealso:: See also +* Bugreport:: Reporting bugs +* Legal:: Author, Copyright, Credits +* CommandIdx:: Alphabetic Command List +* ConceptIdx:: Alphabetic List of Concepts and Objects +@end menu +@node Overview, Standards, Top, Top +@chapter Overview +@c man .SH SYNOPSIS +@c man .B xorrisofs +@c man [ options ] [-o filename ] pathspec [pathspecs ...] +@c man .br +@c man .SH DESCRIPTION +@c man .PP +@command{xorrisofs} +produces Rock Ridge enhanced ISO 9660 filesystems and add-on sessions to +such filesystems. Optionally it can produce Joliet directory trees too. +@* +@sp 1 +@c man .PP +@command{xorrisofs} understands options of program mkisofs from cdrtools by +Joerg Schilling. +Its implementation is part of program xorriso which shares no source +code with cdrtools. +@c man .SS +@node Standards, Insert, Overview, Top +@chapter ISO 9660, Rock Ridge, Joliet +@c man \fBISO 9660, Rock Ridge, Joliet:\fR +@c man .br +@cindex ISO 9660, _definiton +@cindex ECMA-119, _definiton +@strong{ISO 9660} +(aka @strong{ECMA-119}) is a read-only filesystem that is mainly used for +optical media CD, DVD, BD, but may also reside on other storage devices like +disk files, USB sticks or disk partitions. It is widely readable by many +operating systems and by boot facilities of personal computers. +@* +ISO 9660 describes directories and data files by +very restricted filenames with no distinction of upper case and lower case. +Its metadata do not comply to fundamental POSIX specifications. +@* +@cindex Rock Ridge, _definiton +@strong{Rock Ridge} +is the name of a set of additional information which enhance +an ISO 9660 filesystem so that it can represent a POSIX compliant filesystem +with ownership, access permissions, symbolic links, and other attributes. +Rock Ridge allows filenames of up to 255 bytes and paths of up to +1024 bytes. +@* +Rock Ridge information is produced unconditionally with any @command{xorrisofs} +image. +@* +@cindex Joliet, _definiton +@strong{Joliet} +is the name of an additional directory tree which provides +filenames up to 64 characters encoded as UTF-16. +A Joliet tree is mainly interesting for reading the ISO image by +operating systems of Microsoft Corporation. +Production of this directory tree may be enabled by option -J. +@* +@cindex ISO 9660:1999, _definiton +@strong{ISO 9660:1999} +is the name of an additional directory tree which provides longer +filenames. It allows single file names to have up to 207 characters. +It might be of use with some older computer system boot +facilities which read neither Rock Ridge nor Joliet but +need longer filenames nevertheless. +Production of this directory tree may be enabled by option -iso-level 4. +@c man .SS +@sp 1 +@c man .B Inserting files into the ISO image: +@node Insert, Xorriso, Standards, Top +@chapter Inserting files into the ISO image +@c man .PP +@command{xorrisofs} deals with two kinds of file addresses: +@* +@cindex disk_path, _definition +@strong{disk_path} +is a path to an object in the local filesystem tree. +@* +@cindex iso_rr_path, _definition +@strong{iso_rr_path} +is the Rock Ridge address of a file object in the ISO image. (Do not +confuse with the lowlevel ISO 9660 names visible if Rock Ridge gets ignored.) +@cindex pathspec, _definition +@* +@sp 1 +@c man .PP +A program argument is handled as a @strong{pathspec}, if it is not +recognized as original mkisofs option or additional @command{xorrisofs} option. +A pathspec depicts an input file object by a disk_path. +If option -graft-points is not present, then the behavior depends on the +file type of disk_path. Directories get merged with the /-directory of the +ISO image. Files of other types get copied into the /-directory. +@* +If -graft-points is present then each pathspec gets split at the first +occurence of the =-character. +The part before the = is taken as @strong{target}, i.e. the iso_rr_path for +the file object in the ISO image. The part after the first = is taken +as @strong{source}, i.e. the disk_path of the input object. +@* +It is possible to make =-characters part of the iso_rr_path by preceding +them with a \-character. The same must be done for \-characters which +shall be part of the iso_rr_path. +@* +@sp 1 +@c man .PP +If the source part of the pathspec leads to a directory, then all files +underneath this directory get inserted into the image, too. +It is possible to exclude particular files from being inserted +by help of option -m. +@* +In case that target already exists, the following rules apply: +Directories and other files may overwrite existing non-directories. +Directories get merged with existing directories. +Non-directories may not overwrite existing directories. +@c man .SS +@node Xorriso, Options, Insert, Top +@chapter Relation to program xorriso +@c man \fBRelation to program xorriso:\fR +@c man .br +@cindex xorriso, mkisofs emulation +@command{xorrisofs} is actually a command mode of program @strong{xorriso}, +which gets entered either by xorriso command "-as mkisofs" or by +starting the program by one of the names "xorrisofs", "mkisofs", +"genisoimage", or "genisofs". +@* +This command mode can be left by argument "@minus{}@minus{}" which leads +to generic xorriso command mode. See @strong{man xorriso} for its description. +@* +@sp 1 +@c man .PP +xorriso performs image reading and writing by help of libburn, which is +mainly intended for optical drives, but also operates on all POSIX +file types except directories. +@* +The program messages call any image file a "drive". File types which are not +supported for reading are reported as "blank". The reported free media +space may be quite fictional. +@* +Nevertheless @command{xorrisofs} does not operate directly on optical drives, +but rather forces libburn to regard them as general device files. +So for writing of sequential optical media (CD, DVD-R, DVD+R, BD-R) +one will have to use a burn program. E.g the cdrecord emulation of xorriso. +See EXAMPLES. +@c man .SS +@node Options, Examples, Xorriso, top +@chapter Options +@cindex xorriso, options +@c man .br +@c man .SH OPTIONS +@c man .br +@menu +* Loading:: Image loading +* SetInsert:: Settings for file insertion +* SetProduct:: Settings for image production +* SetCompl:: Settings for standards compliance +* SetExtras:: Settings for standards extensions +* SetHide:: Settings for file hiding +* ImageId:: ISO image ID strings +* Bootable:: El Torito Bootable ISO images +* SystemArea:: System Area, MBR, other boot blocks +* Charset:: Character sets +* Jigdo:: Jigdo Template Extraction +* Miscellaneous:: Miscellaneous options +@end menu +@c man .PP +@c man .TP +@c man .B Image loading: +@node Loading, SetInsert, Options, Options +@section Influencing the behavior of image loading +@c man .PP +The following options control loading of an existing ISO image for the purpose +of preparing a suitable add-on session. +If they are missing then a new image is composed from scratch. +@table @asis +@sp 1 +@c man .TP +@item -M disk_path +@kindex -M set path for loading existing ISO image +@cindex Session, select path, -M, -prev-session, -dev +Set the path from which to load the existing ISO image directory tree +on which to base the upcomming directory tree as add-on session. +The path must lead to a random-access readable file object. +On GNU/Linux: regular data files or block device files. +@* +A special kind of pseudo disk_path has the form "/dev/fd/"number. +It depicts the open file descriptor with the given number, regardless whether +the operating system supports this feature by file nodes in /dev/fd or not. +E.g. /dev/fd/3 is file descriptor 3 which was opened by the program that +later started xorriso. +@c man .TP +@item -prev-session disk_path +@kindex -prev-session set path for loading existing ISO image +Alias of -M. +@c man .TP +@item -dev disk_path +@kindex -dev set path for loading existing ISO image +Alias of -M. +@c man .TP +@item -C last_session_start,next_writeable_address +@kindex -C set load address and write address offset +@cindex Session, set load and write address, -C, -cdrecord-params +Set the 2 KiB block address last_session_start from where to read the +ISO image out of the file given by option -M. +@* +Separated by a comma, set the next_writeable_address to which the +add-on session will finally be written. Decisive is actually the block +address which the intended readers will have to use as superblock address +on the intended medium. +@* +Both values can be inquired from optical media by help of burn programs +and cdrecord option -msinfo. xorriso itself can obtain it in its +cdrecord emulation. Do not let it load the drive, but rather do this manually +or by a program like dd which reads a few bytes. Only then it is sure that +the device driver knows the true readable size of the medium. +@* +@sp 1 + dd if=/dev/... count=1 >/dev/null 2>&1 +@* + values=$(xorriso -as cdrecord dev=/dev/... -msinfo) +@* + echo $values +@* +@sp 1 +Option -C may be used without option -M to create an ISO image from +scratch and prepare it for being finally written to a block address +other than 0. Parameter last_session_start must then be set to 0. +@c man .TP +@item -cdrecord-params last_session_start,next_writeable_address +@kindex -cdrecord-params set load address and write address offset +Alias of -C. +@end table +@c man .TP +@c man .B Settings for file insertion: +@node SetInsert, SetProduct, Loading, Options +@section Settings for file insertion +@table @asis +@sp 1 +@c man .TP +@item -path-list disk_path +@kindex -path-list read pathspecs from disk file +@cindex pathspec, read list of, -path-list +Read pathspecs line-by-line from disk_file and insert the depicted file +objects into the ISO image. If disk_path is "-" then read the pathspecs +from standard input. +@c man .TP +@item @minus{}@minus{}quoted_path_list disk_path +@kindex @minus{}@minus{}quoted_path_list read pathspecs from disk file +@cindex pathspec, read list of, @minus{}@minus{}quoted_path_list +Like option -path-list but reading quoted words rather than plain lines. +Whitespace outside of quotes will be discarded. On the other hand it is +possible to represent pathspecs which contain newline characters. +@* +The double quotation mark " and the single quotation mark ' can be used to +enclose whitespace and make it part of pathspecs. Each mark +type can enclose the marks of the other type. A trailing backslash \ outside +quotations or an open quotation cause the next input line to be appended. +@c man .TP +@item -f +@kindex -f follow symbolic links on disk +@cindex Links, follow on disk, -f, -follow-links +@* +Resolve symbolic links on disk rather than storing them as symbolic +links in the ISO image. +@c man .TP +@item -follow-links +@kindex -follow-links follow symbolic links on disk +Alias of -f. +@c man .TP +@item -graft-points +@kindex -graft-points enable target=source pathspecs +@cindex pathspec, enable target=source, -graft-points +Enable interpretation of input file pathspecs as combination of iso_rr_path +and disk_path, separated by a =-character. +@c man .TP +@item -m disk_pattern +@kindex -m exclude disk files from inserting +@cindex Disk files, exclude, -m, -exclude, -x, -old-exclude +Exclude files from being inserted into the image. Silently ignored are +those files of which the disk_path matches the given shell parser pattern. +If no /-character is part of the pattern, then it gets matched against +the leaf name of the disk file. +@* +It is possible to give more than one -m option. +@c man .TP +@item -exclude +@kindex -exclude exclude disk files from inserting +Alias of -m. +@c man .TP +@item -x +@kindex -x exclude disk files from inserting +@* +Alias of -m. +@c man .TP +@item -old-exclude +@kindex -old-exclude exclude disk files from inserting +Alias of -m. +@c man .TP +@item -exclude-list disk_path +@kindex -exclude-list exclude disk files from inserting +@cindex Disk files, exclude, -hide-list +Perform -m using each line out of file disk_path as argument disk_pattern. +@c man .TP +@item -z +@kindex -z enable recognition of zisofs files +@cindex zisofs file, enable recognition, -z, -transparent-compression +@* +Enable recognition and proper processing of zisofs compressed files +as produced by program mkzftree. These files will get equipped with the +necessary meta data so that a Linux kernel will recognize them and +deliver their content in uncompressed form. +@c man .TP +@item -transparent-compression +@kindex -transparent-compression enable recognition of zisofs files +Alias of -z. +@c man .TP +@item -root iso_rr_path +@kindex -root redirect ISO root directory +@cindex ISO root directory, redirect, -root +Insert all files under the given iso_rr_path. If option -graft-points is given, +then iso_rr_path is prepended to each target part of a pathspec. +@* +The default for -root is "/". +@c man .TP +@item -old-root iso_rr_path +@kindex -old-root enable incremental insertion +@cindex Incremental insertion, enable, -old-root +Enable incremental insertion of files into the loaded image. +The effective target and source addresses of given pathspecs get compared +whether the target already exists in the ISO image and is still identical +to the source on disk. Metadata in the ISO image will get adjusted, if they +differ from those on disk. +New files and files with changed content will get newly added. +Target files which do not exist in any of the according pathspec sources +will get removed from the ISO directory tree. +@* +If the effective setting of -root differs from the iso_rr_path given +with -old-root, then the files underneath the -old-root directory get cloned +underneath the -root directory. Cloning happens before file comparison. +@c man .TP +@item @minus{}@minus{}old-root-no-ino +@kindex @minus{}@minus{}old-root-no-ino disable disk ino with -old-root +@cindex Incremental insertion, disable disk ino, @minus{}@minus{}old-root-no-ino +Disable recording and use of disk inode numbers. +If no disk inode numbers are recorded, then option -old-root will have +to read disk file content and compare it with the MD5 checksum that is +recorded in the ISO image. +@* +With recorded disk inode numbers and with credible ctime and mtime, +it is possible to detect potential changes in the content without actually +reading it. +A loophole remains if multiple different filesystems may get mounted +at the same directory, like it is habit with /mnt. +In this case one has to use option @minus{}@minus{}old-root-devno +or disable the inode number shortcut by @minus{}@minus{}old-root-no-ino. +@c man .TP +@item @minus{}@minus{}old-root-devno +@kindex @minus{}@minus{}old-root-devno enable disk idevno with -old-root +@cindex Incremental insertion, enable disk devno, @minus{}@minus{}old-root-devno +Enable comparison of recorded device numbers together with recorded +inode numbers. This works only with good old stable device numbers which +get out of fashion, regrettably. If the hard disk has a different +device number after each reboot, then this comparison will see all +files as changed and thus prevent any incremental size saving. +@c man .TP +@item @minus{}@minus{}old-root-no-md5 +@kindex @minus{}@minus{}old-root-no-md5 disable MD5 with -old-root +@cindex Incremental insertion, disable MD5, @minus{}@minus{}old-root-no-md5 +Disable recording and use of MD5 checksums for data file content. +If neither checksums and nor disk inode numbers are recorded, then +option -old-root will have to read ISO image file content when comparing +it with disk file content. +@end table +@c man .TP +@c man .B Settings for image production: +@node SetProduct, SetCompl, SetInsert, Options +@section Settings for image production +@table @asis +@sp 1 +@c man .TP +@item -o disk_path +@kindex -o set output file address +@cindex Output file, set address, -o, -output +Set the output file address for the emerging ISO image. +If the address exists as regular file, it will be truncated to length 0 +when image production begins. It may not already exist as directory. +If it does not exist yet then its parent directory must exist and +a regular file will get created. +@* +A special kind of pseudo disk_path has the form "/dev/fd/"number. +It depicts the open file descriptor with the given number, regardless whether +the operating system supports this feature by file nodes in /dev/fd or not. +E.g. /dev/fd/4 is file descriptor 4 which was opened by the program that +later started xorriso. +@* +Default is standard output (/dev/fd/1) which may also be set by disk_path "-". +@c man .TP +@item -output disk_path +@kindex -output set output file address +Alias of -o. +@c man .TP +@item @minus{}@minus{}stdio_sync "on"|"off"|number +@kindex @minus{}@minus{}stdio_sync control forced output to disk files +@cindex Forced output, control, @minus{}@minus{}stdio_sync +Set the number of bytes after which to force output to disk +in order to keep the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +@* +xorriso uses an inner fifo buffer with default size 4 MiB. So forcing +the operating system i/o cache to disk does not necessarily block the +simultaneous production of more image content. +@c man .TP +@item @minus{}@minus{}emul-toc +@kindex @minus{}@minus{}emul-toc enable table-of-content emulation +@cindex Table-of-content, emulation, @minus{}@minus{}emul-toc +Write a second superblock with the first session into random-access +files. If further sessions get appended and the first superblock gets updated, +then the second superblock will not be overwritten. This allows to still +mount the first session and to find the start blocks of the further sessions. +@* +The price is 64 KiB extra space consumption. If -partition_offset is non-zero, +then it is 128 KiB plus twice the partition setup. +@c man .TP +@item @minus{}@minus{}no-emul-toc +@kindex @minus{}@minus{}no-emul-toc no table-of-content emulation +@cindex Table-of-content, emulation off, @minus{}@minus{}no-emul-toc +Do not write a second superblock with the first session into random-access +files. +@* +This is the default. +@c man .TP +@item @minus{}@minus{}sort-weight weight_number iso_rr_path +@kindex @minus{}@minus{}sort-weight set output file address +@cindex Block address, set sort weight, @minus{}@minus{}sort-weight +Attribute a LBA weight number to regular files. If iso_rr_path leads +to a directory then all regular files underneath will get the weight_number. +@* +The weight_number may range from -2147483648 to 2147483647. +The higher it is, the lower will be the block address of the file data +in the emerging ISO image. +Currently the El Torito boot catalog has a hardcoded weight of 1 billion. +Normally it should occupy the block with the lowest possible address. +Data files get added or loaded with initial weight 0. +@c man .TP +@item -dir-mode mode +@kindex -dir-mode permissions for all directories +@cindex Permissions, for all directories, -dir-mode +Set the access permissions for all directories in the image to the given +mode which is either an octal number beginning with "0" or a comma separated +list of statements of the form [ugoa]*[+-=][rwxst]* . E.g. ug=rx,a-rwx +@c man .TP +@item -file-mode mode +@kindex -file-mode permissions for all data files +@cindex Permissions, for all data files, -file-mode +Like -dir-mode but for all regular data files in the image. +@c man .TP +@item -pad +@kindex -pad add 300 KiB of zeros to ISO tree +@cindex Padding, 300 KiB, -pad +@* +Add 300 KiB to the end of the produced ISO image. This circumvents possible +read errors from ISO images which have been written to CD media in TAO mode. +The additional bytes are claimed as part of the ISO image if not --emul-toc +is given. +@* +Option -pad is the default. +@c man .TP +@item -no-pad +@kindex -no-pad do not add zeros to ISO tree +@cindex Padding, disable, -no-pad +Disable padding of 300 KiB to the end of the produced ISO image. +This is safe if the image is not meant to be written on CD or if it +gets written to CD as only track in write mode SAO. +@c man .TP +@item @minus{}@minus{}old-empty +@kindex @minus{}@minus{}old-empty old block addresses for empty files +@cindex Padding, disable, @minus{}@minus{}old-empty +Use the old way of of giving block addresses in the range +of [0,31] to files with no own data content. The new way is to have +a dedicated block to which all such files will point. +@end table +@c man .TP +@c man .B Settings for standards compliance: +@node SetCompl, SetExtras, SetProduct, Options +@section Settings for standards compliance +@table @asis +@sp 1 +@kindex -iso-level define ISO 9660 limitations +@cindex ISO level, specify, -iso-level +@c man .TP +@item -iso-level number +@kindex -iso-level define ISO 9660 limitations +@cindex ISO level, specify, -iso-level +Specify the ISO 9660 version which defines the limitations of file naming +and data file size. The naming restrictions do not apply to the +Rock Ridge names but only to the low-level ISO 9660 names. +There are three conformance levels: +@* +Level 1 allows ISO names of the form 8.3 and file size up to 4 GiB - 1. +@* +Level 2 allows ISO names with up to 32 characters +and file size up to 4 GiB - 1. +@* +Level 3 allows ISO names with up to 32 characters +and file size of up to 400 GiB - 200 KiB. (This size limitation is +set by the xorriso implementation and not by ISO 9660 which would +allow nearly 8 TiB.) +@* +Pseudo-level 4 enables production of an additional ISO 9660:1999 +directory tree. +@c man .TP +@item -disallow_dir_id_ext +@kindex -disallow_dir_id_ext enforce ISO level 1 directory names +@cindex ISO level 1, enforce directory names, -disallow_dir_id_ext +Do not follow a bad habit of mkisofs which allows dots in the ISO names +of directories. On the other hand, some bootable GNU/Linux images depend on +this bad habit. +@c man .TP +@item -U +@kindex -U very relaxed filename rules +@cindex ISO file names, very relaxed rules, -U, -untranslated-filenames +@* +This option allows ISO file names without dot and up to 37 characters, +ISO file paths longer than 255 characters, and all ASCII characters in file +names. Further it omits the semicolon and the version numbers at the end +of ISO names. +@* +This all violates ISO 9660 specs. +@c man .TP +@item -untranslated-filenames +@kindex -untranslated-filenames very relaxed filename rules +Alias of -U. +@c man .TP +@item -untranslated_name_len number +@kindex -untranslated_name_len untranslated file names +@cindex ISO file names, untranslated, -untranslated_name_len +Allow ISO file names up to the given number of characters +without any character conversion. The maximum number is 96. +If a file name has more characters, then image production will +fail deliberately. +@* +This violates ISO 9660 specs. +@c man .TP +@item -allow-lowercase +@kindex -allow-lowercase lowercase in ISO file names +@cindex ISO file names, allow lowercase, -allow-lowercase +Allow lowercase character in ISO file names. +@* +This violates ISO 9660 specs. +@c man .TP +@item -d +@kindex -d omit trailing dot in ISO file names +@cindex ISO file names, omit trailing dot, -d, -omit-period +@* +Do not add trailing dot to ISO file names without dot. +@* +This violates ISO 9660 specs. +@c man .TP +@item -omit-period +@kindex -omit-period omit trailing dot in ISO file names +Alias of -d. +@c man .TP +@item -l +@kindex -l allow 37 characters in ISO file names +@cindex ISO file names, allow 37 characters, -l, -full-iso9660-filenames, -max-iso9660-filenames +@* +Allow up to 37 characters in ISO file names. +@* +This violates ISO 9660 specs. +@c man .TP +@item -full-iso9660-filenames +@kindex -full-iso9660-filenames allow 37 characters in ISO file names +Alias of -l. +@c man .TP +@item -max-iso9660-filenames +@kindex -max-iso9660-filenames allow 37 characters in ISO file names +Alias of -l. +@c man .TP +@item -N +@kindex -N omit version number in ISO file names +@cindex ISO file names, omit version number, -N, -omit-version-number +@* +Omit the semicolon and the version numbers at the end of ISO names. +@* +This violates ISO 9660 specs. +@c man .TP +@item -omit-version-number +@kindex -omit-version-number omit version number in ISO file names +Alias of -N. +@end table +@c man .TP +@c man .B Settings for standards extensions: +@node SetExtras, SetHide, SetCompl, Options +@section Settings for standards extensions +@table @asis +@sp 1 +@c man .TP +@item -R +@kindex -R Rock Ridge (is always enabled) +@cindex Rock Ridge, (always enabled), -R, -rock +@* +With mkisofs this option enables Rock Ridge extensions. @command{xorrisofs} +produces them unconditionally. +@c man .TP +@item -rock +@kindex -rock Rock Ridge (is always enabled) +@* +Alias of -R. +@c man .TP +@item -r +@kindex -r Rock Ridge with altered owner and permission +@cindex Rock Ridge, altered owner and permission, -r, -rational-rock +@* +Set Rock Ridge user and group id of all files in the ISO image to 0. +Grant r-permissions to all. Deny all w-permissions. +If any x-permission is set, grant x-permission to all. +Remove s-bit and t-bit. +@c man .TP +@item -rational-rock +@kindex -rational-rock Rock Ridge with altered owner and permission +Alias of -r. +@c man .TP +@item @minus{}@minus{}for_backup +@kindex @minus{}@minus{}for_backup Enable backup fidelity +@cindex Backup, enable fidelity, @minus{}@minus{}for_backup +Enable options which improve backup fidelity: +@minus{}@minus{}acl, @minus{}@minus{}xattr, @minus{}@minus{}md5, +@minus{}@minus{}hardlinks. +@c man .TP +@item @minus{}@minus{}acl +@kindex @minus{}@minus{}acl Recording of ACLs +@cindex ACL, record and load, @minus{}@minus{}acl +@* +Enable recording and loading of ACLs from GNU/Linux or FreeBSD +(see man getfacl, man acl). +They will not be in effect with mounted ISO images. But xorriso can +restore them on the same systems when extracting files from the ISO image. +@c man .TP +@item @minus{}@minus{}xattr +@kindex @minus{}@minus{}xattr Recording of xattr +@cindex xattr, record and load, @minus{}@minus{}xattr +@* +Enable recording and loading of GNU/Linux or FreeBSD extended attributes in +user namespace (see man getfattr, man attr, +resp. man getextattr, man 9 extattr). +They will not be in effect with mounted ISO images. But xorriso can +restore them on the same systems when extracting files from the ISO image. +@c man .TP +@item @minus{}@minus{}md5 +@kindex @minus{}@minus{}md5 Recording of MD5 checksums +@cindex MD5, record and load, @minus{}@minus{}md5 +@* +Enable recording of MD5 checksums for the overall ISO image and for each +single data file in the image. xorriso can check the content of an ISO +image with these sums and raise alert on mismatch. +See man xorriso, options -check_media, check_md5_r. +xorriso can print recorded MD5 checksums. E.g. by: +@* + -find / -exec get_md5 +@c man .TP +@item @minus{}@minus{}hardlinks +@kindex @minus{}@minus{}hardlinks Recording of hardlink relations +@cindex Links, record and load hard links, @minus{}@minus{}hardlinks +Enable loading and recording of hardlink relations. +Search for families of iso_rr files which stem from the same disk file, +have identical content filtering and have identical properties. +The members of each family get the same inode number in the ISO image. +@* +Whether these numbers are respected at mount time depends on the operating +system. xorriso can create hardlink families when extracting files from +the ISO image. +@c man .TP +@item @minus{}@minus{}scdbackup_tag disk_path record_name +@kindex @minus{}@minus{}scdbackup_tag Recording of MD5 checksum +@cindex scdbackup, record checksum tag, @minus{}@minus{}scdbackup_tag +Append a scdbackup checksum record to the image. This works only if the +parameter next_writeable_address of option -C is 0. +If disk_path is not an empty string, then append a scdbackup checksum record +to the end of this file. record_name is a word that gets part of tag +and record. +@* +Program scdbackup_verify will recognize and verify tag resp. record. +@c man .TP +@item -J +@kindex -J enable production of Joliet directory tree +@cindex Joliet, enable, -J, -joliet +@* +Enable the production of an additional Joliet directory tree along +with the ISO 9660 Rock Ridge tree. +@c man .TP +@item -joliet +@kindex -joliet enable production of Joliet directory tree +Alias of -J. +@c man .TP +@item -joliet-long +@kindex -joliet-long allow longer Joliet names +@cindex Joliet, allows longer names, -joliet-long +Allow 103 characters in Joliet file names rather than 64 as is prescribed +by the specification. Allow Joliet paths longer than the prescribed limit of +240 characters. +@* +Oversized names get truncated. Without this option, oversized paths get +excluded from the Joliet tree. +@end table +@c man .TP +@c man .B Settings for file hiding: +@node SetHide, ImageId, SetExtras, Options +@section Settings for file hiding +@table @asis +@sp 1 +@c man .TP +@item -hide disk_path_pattern +@kindex -hide keep matching files invisible in ISO tree +@cindex Hiding, from ISO and Rock Ridge, -hide +Make files invisible in the directory tree of ISO 9660 and Rock Ridge, +if their disk_path matches the given shell parser pattern. +The data content of such hidden files will be included in the +resulting image, even if they do not show up in any directory. +But you will need own means to find nameless data in the image. +@* +This command does not apply to the boot catalog. +@c man .TP +@item -hide-list disk_path +@kindex -hide-list keep matching files invisible in ISO tree +@cindex Hiding, from ISO and Rock Ridge, -hide-list +Perform -hide using each line out of file disk_path as argument +disk_path_pattern. +@c man .TP +@item -hide-joliet disk_path_pattern +@kindex -hide-joliet keep matching files invisible in Joliet tree +@cindex Hiding, from Joliet, -hide-joliet +Like option -hide but making files invisible in the directory tree of Joliet, +if their disk_path matches the given shell parser pattern. +@c man .TP +@item -hide-joliet-list disk_path +@kindex -hide-joliet-list keep matching files invisible in Joliet tree +@cindex Hiding, from Joliet, -hide-joliet-list +Perform -hide-joliet using each line out of file disk_path as argument +disk_path_pattern. +@end table +@c man .TP +@c man .B ISO image ID strings: +@node ImageId, Bootable, SetHide, Options +@section ISO image ID strings +@c man .PP +The following strings and file addresses get stored in the Primary Volume +Descriptor of the ISO9660 image. The file addresses are ISO 9660 +paths. These files should have iso_rr_paths which consist only of +the characters [A-Z0-9_] and exactly one dot which separates +at most 8 characters from at most 3 characters. +@table @asis +@sp 1 +@c man .TP +@item -V text +@kindex -V set Volume Id +@cindex Volume Id, set, -V, -volid +Set the Volume Id of the ISO image. +xorriso accepts any text up to 32 characters, +but according to rarely obeyed specs stricter rules apply: +@* +Conformant are ASCII characters out of [A-Z0-9_]. Like: "IMAGE_23" +@* +Joliet allows 16 UCS-2 characters. Like: "Windows name" +@* +Be aware that the volume id might get used automatically as name of the +mount point when the medium is inserted into a playful computer system. +@c man .TP +@item -volid text +@kindex -volid set Volume Id +Alias of -V. +@c man .TP +@item -volset text +@kindex -volset set Volume Set Id +@cindex Volume Set Id, set, -volset +Set the Volume Set Id of the ISO image. +Permissible are up to 128 characters. +@c man .TP +@item -p text +@kindex -p set Publisher Id +@cindex Publisher Id, set, -p, -publisher +Set the Publisher Id of the ISO image. This may identify the person or +organisation who specified what shall be recorded. +Permissible are up to 128 characters. +@c man .TP +@item -publisher text +@kindex -publisher set Publisher Id +Alias of -p. +@c man .TP +@item -A text +@kindex -A set Application Id +@cindex Application Id, set, -A, -appid +Set the Application Id of the ISO image. +This may identify the specification of how the data are recorded. +Permissible are up to 128 characters. +@* +The special text "@@xorriso@@" gets converted to the id string of xorriso +which is normally written as Preparer Id. It is a wrong tradition to write +the program id as Application Id. +@c man .TP +@item -appid text +@kindex -appid set Application Id +Alias of -A. +@c man .TP +@item -sysid text +@kindex -sysid set System Id +@cindex System Id, set, -sysid +Set the System Id of the ISO image. This may +identify the system which can recognize and act upon the content of the +System Area in image blocks 0 to 15. +Permissible are up to 32 characters. +@c man .TP +@item -p text +@kindex -p set Preparer Id +@cindex Preparer Id, set, -p +Set the Preparer Id of the ISO image. This may +identify the person or other entity which controls the preparation of the data +which shall be recorded. Normally this should be the id of xorriso and not +of the person or program which operates xorriso. Please avoid to change it. +Permissible are up to 128 characters. +@* +The special text "@@xorriso@@" gets converted to the id string of xorriso +which is default at program startup. +@c man .TP +@item -preparer text +@kindex -preparer set Preparer Id +Alias of -p. +@c man .TP +@item -abstract iso_path +@kindex -abstract set Abstract File path +@cindex Abstract File, set path, -abstract +Set the address of the Abstract File of the ISO image. This should +be the ISO 9660 path of a file in the image which contains an abstract +statement about the image content. +Permissible are up to 37 characters. +@c man .TP +@item -biblio iso_path +@kindex -biblio set Biblio File path +@cindex Biblio File, set path, -biblio +Set the address of the Biblio File of the ISO image. This should +be the ISO 9660 path of a file in the image which contains bibliographic +records. +Permissible are up to 37 characters. +@c man .TP +@item -copyright iso_path +@kindex -copyright set Copyright File path +@cindex Copyright File, set path, -copyright +Set the address of the Copyright File of the ISO image. This should +be the ISO 9660 path of a file in the image which contains a copyright +statement. +Permissible are up to 37 characters. +@c man .TP +@item @minus{}@minus{}modification-date=YYYYMMDDhhmmsscc +@kindex @minus{}@minus{}modification-date set ISO image timestamps +@cindex ISO image, set timestamps, @minus{}@minus{}modification-date= +Set a timestring that overrides ISO image creation and modification timestamps +literally. +It must consist of 16 decimal digits which form YYYYMMDDhhmmsscc, with +YYYY between 1970 and 2999. Time zone is GMT. +It is supposed to match this GRUB line: +@* + search @minus{}@minus{}fs-uuid @minus{}@minus{}set YYYY-MM-DD-hh-mm-ss-cc +@* +E.g. 2010040711405800 is 7 Apr 2010 11:40:58 (+0 centiseconds). +@end table +@c man .TP +@c man .B El Torito Bootable ISO images: +@node Bootable, SystemArea, ImageId, Options +@section El Torito Bootable ISO images +@c man .PP +The precondition for a bootable ISO image is to have in the ISO image +the files of a boot loader. The boot facilities of computers get +directed to such files, which usually execute further program files +from the ISO image. +@command{xorrisofs} can produce several kinds of boot block or boot record, +which become part of the ISO image, and get interpreted by the according +boot facility. +@* +@c man .PP +@sp 1 +@cindex El Torito, _definiton +An @strong{El Torito} +boot record points the bootstrapping facility to a boot catalog +with one or more boot images, which are binary program files stored in +the ISO image. +The content of the boot image files is not in the scope of El Torito. +@* +xorriso composes the boot catalog according to the boot image +files given and structured by options -b, -e, -el-torito-alt-boot, +and @minus{}@minus{}efi-boot. Often it contains only one entry. +@* +El Torito gets interpreted by boot facilities PC-BIOS and EFI. +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images +for PC-BIOS. +@* +@command{xorrisofs} supports the example options out of the ISOLINUX wiki, +the options used in GRUB script grub-mkrescue, and the example in the +FreeBSD AvgLiveCD wiki. +@* +@c man .PP +@sp 1 +For CD booting via boot facilities other than PC-BIOS and EFI, and +for booting from USB sticks or hard disks, see the next section +about the Sytem Area. +@* +@table @asis +@sp 1 +@c man .TP +@item -b iso_rr_path +@kindex -b El Torito PC-BIOS boot image +@cindex Bootability, control, -b, -eltorito-boot +Specify the boot image file which shall be mentioned in the current +entry of the El Torito boot catalog. It will be marked as suitable for +PC-BIOS. +@* +With boot images from ISOLINUX and GRUB this option should be accompanied by +options -c , -no-emul-boot , -boot-load-size 4 , -boot-info-table. +@c man .TP +@item -eltorito-boot iso_rr_path +@kindex -eltorito-boot El Torito PC-BIOS boot image +Alias of -b. +@c man .TP +@item -eltorito-alt-boot +@kindex -eltorito-alt-boot begin next boot catalog entry +@cindex Bootability, next entry, -eltorito-alt-boot +Finalize the current El Torito boot catalog entry and begin a new one. +A boot image file and all its necessary options shall be specified before +option -eltorito-alt-boot. +All further El Torito boot options apply to the new catalog +entry. Up to 32 catalog entries are possible. +@c man .TP +@item -e iso_rr_path +@kindex -e El Torito EFI boot image +@cindex Bootability, control, -e +Specify the boot image file which shall be mentioned in the current +entry of the El Torito boot catalog. It will be marked as suitable for EFI. +@* +Normally no other El Torito options should be used with the catalog entry +that points to an EFI image. +Consider to use @minus{}@minus{}efi-boot rather than -e. +@c man .TP +@item @minus{}@minus{}efi-boot iso_rr_path +@kindex @minus{}@minus{}efi-boot El Torito EFI boot image +@cindex Bootability, control, @minus{}@minus{}efi-boot +Perform -eltorito-alt-boot, option -e with the given +iso_rr_path, and again -eltorito-alt-boot. This gesture is +used for achieving EFI-bootability of the GRUB2 rescue CD. +@c man .TP +@item -boot-load-size number +@kindex -boot-load-size El Torito boot image load size +@cindex Bootability, boot image load size, -boot-load-size +Set the number of 512-byte blocks for boot images which emulate +a floppy or a hard disk. A safe default for non-emulating boot images is 4. +@c man .TP +@item -hard-disk-boot +@kindex -hard-disk-boot El Torito boot image emulation +@cindex Bootability, boot image emulation, -hard-disk-boot +Mark the boot image in the current catalog entry as emulated hard disk. +(Not suitable for any known boot loader.) +@c man .TP +@item -no-emul-boot +@kindex -no-emul-boot El Torito boot image emulation +@cindex Bootability, no boot image emulation, -no-emul-boot +Mark the boot image in the current catalog entry as not emulating +floppy or hard disk. (This is to be used with all known boot loaders.) +@* +If neither -hard-disk-boot nor -no-emul-boot is given, then the +boot image will be marked as emulating a floppy. +(Not suitable for any known boot loader.) +@c man .TP +@item -boot-info-table +@kindex -boot-info-table Patch El Torito boot image +@cindex Bootability, boot image patching, -boot-info-table +Overwrite certain bytes in the current boot image. The information will be +supplied by xorriso in the course of image production: Block address of +the Primary Volume Descriptor, block address of the boot image file, +size of the boot image file. +@c man .TP +@item -c iso_rr_path +@kindex -c El Torito boot catalog name +@cindex Bootability, boot catalog name, -c, -eltorito-catalog +Set the address of the El Torito boot catalog file within the image. +This file address is not significant for the booting PC-BIOS or EFI, +but it may later be read by other programs in order to learn about +the available boot images. +@c man .TP +@item -eltorito-catalog iso_rr_path +@kindex -eltorito-catalog El Torito boot catalog name +Alias of -c. +@c man .TP +@item @minus{}@minus{}boot-catalog-hide +@kindex @minus{}@minus{}boot-catalog-hide Hide El Torito boot catalog +@cindex Bootability, boot catalog hidden, @minus{}@minus{}boot-catalog-hide +Prevent the El Torito boot catalog from appearing as file +in the directory trees of the image. +@end table +@c man .TP +@c man .B System Area, MBR, other boot blocks: +@node SystemArea, Charset, Bootable, Options +@section System Area, MBR, other boot blocks +@c man .PP +@cindex System Area, _definiton +The first 16 blocks of an ISO image are the System Area. +It is reserved for system dependent boot software. This may be the +CD boot facilities of exotic hardware architectures or it may be +a MBR for booting via PC-BIOS from USB stick or hard disk. +@* +@cindex MBR, _definiton +A @strong{MBR} (Master Boot Record) contains boot code and a partition table. +It does not hamper El Torito booting from CDROM. +@* +@command{xorrisofs} supports boot facilities other than PC-BIOS: +MIPS Big Endian (SGI), MIPS Little Endian (DEC), SUN SPARC. +Those are mutually not combinable and also not combinable with MBR. +@* +@table @asis +@sp 1 +@c man .TP +@item -G disk_path +@kindex -G Fill System Area e.g. by MBR +@cindex Bootability, fill System Area e.g. by MBR, -G, @minus{}@minus{}embedded-boot, -generic-boot +Copy at most 32768 bytes from the given disk file to the very start of +the ISO image. +@* +Other than a El Torito boot image, the file disk_path needs not to be added +to the ISO image. It will not show up as file in the directory trees. +@c man .TP +@item -generic-boot disk_path +@kindex -generic-boot Fill System Area e.g. by MBR +Alias of -G. +@c man .TP +@item @minus{}@minus{}embedded-boot disk_path +@kindex @minus{}@minus{}embedded-boot Fill System Area e.g. by MBR +Alias of -G. +@c man .TP +@item -isohybrid-mbr disk_path +@kindex -isohybrid-mbr Install ISOLINUX isohybrid MBR +@cindex Bootability, install ISOLINUX isohybrid MBR, -isohybrid-mbr +Install disk_path as ISOLINUX isohybrid MBR which makes the boot image +given by option -b bootable from USB sticks and hard disks via PC-BIOS. +This preparation is normally done by ISOLINUX program isohybrid +on the already produced ISO image. +@* +The disk path should lead to one of the Syslinux files isohdp[fp]x*.bin . +The MBR gets patched according to isohybrid needs. The first partition +describes the range of the ISO image. Its start is at block 0 by default, +but may be set to 64 disk blocks by option -partition_offset 16. +@c man .TP +@item @minus{}@minus{}protective-msdos-label +@kindex @minus{}@minus{}protective-msdos-label Patch System Area partition table +@cindex Bootability, patch System Area partition table, @minus{}@minus{}protective-msdos-label +Patch the System Area by a simple PC-DOS partition table where partition 1 +claims the range of the ISO image but leaves the first block unclaimed. +@c man .TP +@item -partition_offset 2kb_block_adr +@kindex -partition_offset Make mountable by partition 1 +@cindex Mountability, by non-trivial partition 1, -partition_offset +Cause a partition table with a single partition that begins at the +given block address. This is counted in 2048 byte +blocks, not in 512 byte blocks. If the block address is non-zero then it must +be at least 16. Values larger than 16 are hardly of use. +A non-zero partition offset causes two superblocks to be +generated and two sets of directory trees. The image is then mountable from its +absolute start as well as from the partition start. +@* +The offset value of an ISO image gets preserved when a new session is added +to a loaded image. +So the value defined here is only in effect if a new ISO image gets written. +@c man .TP +@item -partition_hd_cyl number +@kindex -partition_hd_cyl MBR heads per cylinder +@cindex MBR, sectors per head, -partition_sec_hd +Set the number of heads per cylinder for the partition table. +0 chooses a default value. Maximum is 255. +@c man .TP +@item -partition_sec_hd number +@kindex -partition_sec_hd MBR sectors per head +@cindex MBR, sectors per head, -partition_sec_hd +Set the number of sectors per head for the partition table. +0 chooses a default value. Maximum is 63. +@* +The product partition_sec_hd * partition_hd_cyl * 512 is the cylinder size. +It should be divisible by 2048 in order to allow exact alignment. +If it is too small to describe the image size by at most 1024 cylinders, +then appropriate values of partition_hd_cyl are chosen with +partition_sec_hd 32 or 63. If the image is larger than 8,422,686,720 bytes, +then the cylinder size constraints cannot be fulfilled. They seem not overly +important anyway. Flat block addresses in partition tables are good for 1 TiB. +@c man .TP +@item -partition_cyl_align mode +@kindex -partition_cyl_align Image size alignment +@cindex Image size, alignment, -partition_cyl_align +Control image size alignment to an integer number of cylinders. +It is prescribed by isohybrid specs and it seems to please program fdisk. +Cylinder size must be divisible by 2048. +Images larger than 8,323,596,288 bytes cannot be aligned. +@* +Mode "auto" is default. Alignment by padding happens only if +option -isohybrid-mbr is given. +@* +Mode "on" causes alignment by padding with option +@minus{}@minus{}protective-msdos-label too. +Mode "off" disables alignment unconditionally. +@c man .TP +@item -append_partition partition_number type_code disk_path +@kindex -append_partition Append MBR partition after image +@cindex MBR, append partition, -append_partition +Cause a prepared filesystem image to be appended to the ISO image and to be +described by a partition table entry in a boot block at the start of the +emerging ISO image. The partition entry will bear the size of the submitted +file rounded up to the next multiple of 2048 bytes. +@* +Beware of subsequent multi-session runs. The appended partition will get +overwritten. +@* +partition_number may be 1 to 4. Number 1 will put the whole ISO image into +the unclaimed space before partition 1. So together with most xorriso MBR +features, number 2 would be the most natural choice. +@* +The type_code may be "FAT12", "FAT16", "Linux", +or a hexadecimal number between 0x00 and 0xff. Not all those numbers will +yield usable results. For a list of codes search the Internet for +"Partition Types" or run fdisk command "L". +@c man .TP +@item -mips-boot iso_rr_path +@kindex -mips-boot MIPS Big Endian boot image +@cindex Bootability, control, -mips-boot +Declare a data file in the image to be a +MIPS Big Endian boot file and cause production of a MIPS Big Endian Volume +Header. This is mutually exclusive with production of other boot blocks +like MBR. +It will overwrite the first 512 bytes of any data provided by -G. +Up to 15 boot files can be declared by multiple -mips-boot options. +@c man .TP +@item -mipsel-boot iso_rr_path +@kindex -mipsel-boot MIPS Little Endian boot image +@cindex Bootability, control, -mipsel-boot +Declare a data file in the image to be the +MIPS Little Endian boot file. This is mutually exclusive with other boot +blocks. +It will overwrite the first 512 bytes of any data provided by -G. +Only a single boot file can be declared by -mipsel-boot. +@c man .TP +@item -B disk_path[,disk_path ...] +@kindex -B SUN SPARC boot images +@cindex Bootability, control, -B, -sparc-boot +Cause one or more data files on disk to be written after the end of the +ISO image. A SUN Disk Label will be written into the first 512 bytes of the +ISO image which lists this image as partition 1 and the given disk_paths as +partition 2 up to 8. +@* +The disk files should contain suitable boot images for SUN SPARC systems. +@* +The pseudo disk_path "..." causes that all empty partition entries become +copies of the last non-empty entry. If no other disk_path is given before +"..." then all partitions describe the ISO image. In this case, the boot +loader code has to be imported by option -G. +@c man .TP +@item -sparc-boot disk_path[,disk_path ...] +@kindex -sparc-boot SUN SPARC boot images +Alias of -B. +@c man .TP +@item -sparc-label text +@kindex -sparc-label SUN Disk Label text +@cindex Bootability, SUN Disk Label text, -sparc-label +Set the ASCII label text of a SUN Disk Label. +@end table +@c man .TP +@c man .B Character sets: +@node Charset, Jigdo, SystemArea, Options +@section Character sets +@c man .PP +@cindex Character sets, _definition +Character sets should not matter as long as only english alphanumeric +characters are used for file names or as long as all writers and readers +of the medium use the same character set. +Outside these constraints it may be necessary to let xorriso convert byte +codes. +@* +A conversion from input character set to the output character set is +performed when an ISO image gets written. +Vice versa there is a conversion from output character set to the +input character set when an ISO image gets loaded. +The sets can be defined by options -input-charset and -output-charset, +if needed. +@* +@table @asis +@sp 1 +@c man .TP +@item -input-charset character_set_name +@kindex -input-charset set character set of disk file names +@cindex Character Set, for disk file names, -input-charset +Set the character set from which to convert disk file names when +inserting them into the ISO image. +@sp 1 +@c man .TP +@item -output-charset character_set_name +@kindex -output-charset set character set of ISO file names +@cindex Character Set, for ISO file names, -output-charset +Set the character set from which to convert names of loaded ISO images +and to which to convert names when writing ISO images. +@end table +@c man .TP +@c man .B Jigdo Template Extraction: +@node Jigdo, Miscellaneous, Charset, Options +@section Jigdo Template Extraction +@c man .PP +@cindex Jigdo Template Extraction, _definition +From man genisoimage: +"Jigdo is a tool to help in the distribution of large files like CD and +DVD images; see http://atterer.net/jigdo/ for more details. Debian CDs +and DVD ISO images are published on the web in jigdo format to allow +end users to download them more efficiently." +@* +If the use of libjte was enabled at compile time of xorriso, then +@command{xorrisofs} can produce a .jigdo and a .template file together with a +single-session ISO image. If not, then Jigdo options will cause a +FAILURE event, which normally leads to program abort. +@* +One may determine the ability for Jigdo by: +@* +@sp 1 + $ xorrisofs -version 2>&1 | grep '^libjte' && echo YES +@* +@sp 1 +@c man .PP +The .jigdo file contains checksums and symbolic file addresses. +The .template file contains the compressed ISO image with reference tags +instead of the content bytes of the listed files. +@* +Input for this process are the normal arguments for a @command{xorrisofs} +session +with no image loaded, and a .md5 file which lists those data files which may be +listed in the .jigdo file and externally referenced in the .template file. +Each designated file is represented in the .md5 file by a single text line: +@* +MD5 as 32 hex digits, 2 blanks, size as 12 decimal digits or blanks, 2 blanks, +symbolic file address +@* +The file address in an .md5 line has to bear the same basename as the +disk_path of the file which it shall match. The directory path of +the file address is decisive for To=From mapping, not for file recognition. +After To=From mapping, the file address gets written into the .jigdo +file. Jigdo restore tools will convert these addresses into really +reachable data source addresses from which they can read. +@* +If the list of jigdo parameters is not empty, then padding will be +counted as part of the ISO image. +@* +@table @asis +@sp 1 +@c man .TP +@item -jigdo-jigdo disk_path +@kindex -jigdo-jigdo set name of .jigdo file +@cindex Jigdo Template Extraction, -jigdo-jigdo +Set the disk_path for the .jigdo file with the checksums +and download addresses for filling the holes in .template. +@c man .TP +@item -jigdo-template disk_path +@kindex -jigdo-template set name of .template file +@cindex Jigdo Template Extraction, -jigdo-template +Set the disk_path for the .template file with the +holed and compressed ISO image copy. +@c man .TP +@item -jigdo-min-file-size size +@kindex -jigdo-min-file-size set minimum extract size +@cindex Jigdo Template Extraction, -jigdo-min-file-size +Set the minimum size for a data file to be listed +in the .jigdo file and being a hole in the .template file. +size may be a plain number counting bytes, or a number with appended +letter "k", "m", "g" to count KiB (1024 bytes), MiB (1024 KiB), or +GiB (1024 MiB). +@c man .TP +@item -jigdo-force-md5 disk_path_pattern +@kindex -jigdo-force-md5 add check pattern for .md5 +@cindex Jigdo Template Extraction, -jigdo-force-md5 +adds a regular expression pattern which will get compared +with the absolute disk_path of any data file that was not found in the .md5 +list. A match causes a MISHAP event, which normally does not abort the +program run but finally causes a non-zero exit value of the program. +@c man .TP +@item -jigdo-exclude disk_path_pattern +@kindex -jigdo-exclude add exclusion pattern for .md5 +@cindex Jigdo Template Extraction, -jigdo-exclude +Add a regular expression pattern which will get compared +with the absolute disk_path of any data file. A match causes the file to +stay in .template in any case. +@c man .TP +@item -jigdo-map To=From +@kindex -jigdo-map add address translation for .jigdo +@cindex Jigdo Template Extraction, -jigdo-map +Add a string pair of the form To=From to the parameter list. +If a data file gets listed in the .jigdo file, then it is referred by the +file address from its line in the .md5 file. This file address gets checked +whether it begins with the From string. If so, then this string will be +replaced by the To string and a ':' character, before it goes into the .jigdo +file. The From string should end by a '/' character. +@c man .TP +@item -md5-list disk_path +@kindex -md5-list set path of readable .md5 +@cindex Jigdo Template Extraction, -md5-list +Set the disk_path where to find the .md5 input file. +@c man .TP +@item -jigdo-template-compress "gzip"|"bzip2" +@kindex -jigdo-template-compress choose compression algorithm +@cindex Jigdo Template Extraction, -jigdo-template-compress +Choose one of "bzip2" or "gzip" for the compression of +the template file. The jigdo file is put out uncompressed. +@c man .TP +@item -checksum_algorithm_iso list_of_names +@kindex -checksum_algorithm_iso choose .jigdo checksums +@cindex Jigdo Template Extraction, -checksum_algorithm_iso +Choose one or more of "md5", "sha1", "sha256", "sha512" +for the auxiliary "# Image Hex" checksums in the .jigdo file. The list_of_names +may e.g. look like "md5,sha1,sha512". Value "all" chooses all available +algorithms. +Note that MD5 stays always enabled. +@c man .TP +@item -checksum_algorithm_template list_of_names +@kindex -checksum_algorithm_template choose .template checksums +@cindex Jigdo Template Extraction, -checksum_algorithm_template +Choose the algorithms for the "# Template Hex" checksums in the .jigdo file. +The rules for list_of_names are the same as with -checksum_algorithm_iso. +@end table +@c man .TP +@c man .B Miscellaneous options: +@node Miscellaneous, ExSimple, Jigdo, Options +@section Miscellaneous options +@table @asis +@sp 1 +@c man .TP +@item -print-size +@kindex -print-size predict ISO image size +@cindex ISO image size, predict, -print-size +Print to stdandard output the foreseeable number of 2048 byte blocks in +the emerging ISO image. Do not produce this image. +@* +The result depends on several settings. +@* +If option --emul-toc is given, then padding (see -pad) is not +counted as part of the image size. In this case either use -no-pad or +add 150 (= 300 KiB) to the resulting number. +@c man .TP +@item @minus{}@minus{}no_rc +@kindex @minus{}@minus{}no_rc do not execute startup files +@cindex Startup files, suppress, @minus{}@minus{}no_rc +Only if used as first argument this option +prevents reading and interpretation of startup files. See section FILES below. +@c man .TP +@item -help +@kindex -help list supported options +@cindex Options, list, -help +@* +List supported options to stderr. Original mkisofs options bear their +original mkisofs description texts. +@c man .TP +@item -quiet +@kindex -quiet suppress most messages +@cindex Message output, suppress, -quiet +@* +Suppress most messages of the program run, except those which indicate +problems or errors. +@c man .TP +@item -v +@kindex -v enable verbous messages +@cindex Verbosity, high, -v, -verbose +@* +Enable the output of informational program messages. +@c man .TP +@item -verbose +@kindex -verbose enable verbous messages +Alias of -v. +@c man .TP +@item -version +@kindex -version report program version +@cindex Program version, report, -version +Print to standard output a text that begins with +@* + "mkisofs 2.01-Emulation Copyright (C)" +@* +and to standard error the version information of xorriso. +@end table +@c man .br +@node Examples, Files, Options, Top +@chapter Examples +@c man .SH EXAMPLES +@c man .SS +@c man .B Overview of examples: +@c man A simple image production run +@c man .br +@c man Set ISO image paths by -graft-points +@c man .br +@c man Perform multi-session runs +@c man .br +@c man Let xorrisofs work underneath growisofs +@c man .br +@c man Incremental backup of a few directory trees +@c man .br +@c man Incremental backup with accumulated trees +@c man .br +@c man Create bootable images for PC-BIOS +@c man .br +@cindex Examples +@menu +* ExSimple:: A simple image production run +* ExGraft:: Set ISO image paths by -graft-points +* ExMkisofs:: Perform multi-session runs +* ExGrowisofs:: Let xorriso work underneath growisofs +* ExIncBackup:: Incremental backup of a few directory trees +* ExIncBckAcc:: Incremental backup with accumulated trees +* ExBootable:: Create bootable images for PC-BIOS +@end menu +@c man .SS +@c man .B A simple image production run +@node ExSimple, ExGraft, Miscellaneous, Examples +@section A simple image production run +A prepared file tree in directory ./for_iso gets copied into the root +directory of the ISO image. File permissions get set to read-only for +everybody. +Joliet attributes for Microsoft systems get added. +The resulting image gets written as data file ./image.iso on disk. +@* +@sp 1 + $ xorrisofs -r -J -o ./image.iso ./for_iso +@c man .SS +@c man .B Set ISO image paths by -graft-points +@node ExGraft, ExMkisofs, ExSimple, Examples +@section Set ISO image paths by -graft-points +Without option -graft-points each given disk file is copied into the root +directory of the ISO image, maintaining its name. If a directory is given, +then its files and sub-directories are copied into the root directory, +maintaining their names. +@* +@sp 1 + $ xorrisofs ... /home/me/datafile /tmp/directory +@* +@sp 1 +yields in the ISO image root directory: +@* +@sp 1 + /datafile +@* + /file_1_from_directory +@* + ... +@* + /file_N_from_directory +@* +@sp 1 +@c man .sp 1 +With option -graft-points it is possible to put files and directories to +arbitrary paths in the ISO image. +@* +@sp 1 + $ xorrisofs ... -graft-points /home/me/datafile /dir=/tmp/directory +@* +@sp 1 +yields in the ISO image root directory: +@* +@sp 1 + /datafile +@* + /dir +@* +@sp 1 +Eventually needed parent directories in +the image will be created automatically: +@* +@sp 1 + /datafiles/file1=/home/me/datafile +@* +@sp 1 +yields in the ISO image: +@sp 1 +@* + /datafiles/file1 +@* +@sp 1 +The attributes of directory /datafiles get copied from /home/me on disk. +@* +@sp 1 +@c man .sp 1 +Normally one should avoid = and \ characters in the ISO part of a pathspec. +But if it must be, one may escape them: +@sp 1 +@* + /with_\=_and_\\/file=/tmp/directory/file +@* +@sp 1 +yields in the ISO image: +@* +@sp 1 + /with_=_and_\/file +@c man .SS +@c man .B Perform multi-session runs +@node ExMkisofs, ExGrowisofs, ExGraft, Examples +@section Perform multi-session runs +This example works for multi-session media only: +CD-R[W], DVD-R[W], DVD+R, BD-R. +Add cdrskin option @minus{}@minus{}grow_overwriteable_iso +to all -as cdrecord runs +in order to enable multi-session emulation on overwriteable media. +@* +The first session is written like this: +@* +@sp 1 + $ xorrisofs -graft-points \ +@* + /tree1=prepared_for_iso/tree1 \ +@* + | xorriso -as cdrecord -v dev=/dev/sr0 blank=fast -multi -eject - +@* +@sp 1 +Follow-up sessions are written like this: +@* +@sp 1 + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +@* + $ m=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +@* + $ xorrisofs -M /dev/sr0 -C $m -graft-points \ +@* + /tree2=prepared_for_iso/tree2 \ +@* + | xorriso -as cdrecord -v dev=/dev/sr0 -waiti -multi -eject - +@* +@sp 1 +Always eject the drive tray between sessions. The old sessions +get read via /dev/sr0. Its device driver might not be aware +of the changed content before it loads the medium again. +In this case the previous session would not be loaded and the +new session would contain only the newly added files. +@* +For the same reason do not let xorriso -as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +@c man .SS +@c man .B Let xorrisofs work underneath growisofs +@node ExGrowisofs, ExIncBackup, ExMkisofs, Examples +@section Let xorriso work underneath growisofs +growisofs expects an ISO formatter program which understands options -C and +-M. A variable is defined to override the hardcoded default name. +@* +@sp 1 + $ export MKISOFS="xorrisofs" +@* + $ growisofs -Z /dev/dvd /some/files +@* + $ growisofs -M /dev/dvd /more/files +@* +@sp 1 +If no "xorrisofs" is available on your system, then you will have to create +a link pointing to the xorriso binary and tell growisofs to use it. E.g. by: +@* +@sp 1 + $ ln -s $(which xorriso) "$HOME/xorrisofs" +@* + $ export MKISOFS="$HOME/xorrisofs" +@* +@sp 1 +One may quit mkisofs emulation by argument "@minus{}@minus{}" and make +use of all xorriso commands. growisofs dislikes options which +start with "-o" but -outdev must be set to "-". +So use "outdev" instead: +@* +@sp 1 + $ growisofs -Z /dev/dvd @minus{}@minus{}for_backup @minus{}@minus{} \ +@* + outdev - -update_r /my/files /files +@* + $ growisofs -M /dev/dvd @minus{}@minus{}for_backup @minus{}@minus{} \ +@* + outdev - -update_r /my/files /files +@* +Note that @minus{}@minus{}for_backup is given in the mkisofs emulation. +To preserve the recorded extra data it must already be in effect, when +the emulation loads the image. +@c man .SS +@c man .B Incremental backup of a few directory trees +@node ExIncBackup, ExIncBckAcc, ExGrowisofs, Examples +@section Incremental backup of a few directory trees +This changes the directory trees /open_source_project and /personal_mail +in the ISO image so that they become exact copies of their disk counterparts. +ISO file objects get created, deleted or get their attributes adjusted +accordingly. +@* +ACL, xattr, hard links and MD5 checksums will be recorded. +It is expected that inode numbers in the disk filesystem are persistent +over cycles of mounting and booting. +Files with names matching *.o or *.swp get excluded explicitly. +@* +@sp 1 +@c man .sp 1 +To be used several times on the same medium, whenever an update of +the two disk trees to the medium is desired. Begin with a blank medium and +update it until he run fails gracefully due to lack of remaining space on +the old one. +@* +Do not let xorriso -as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +@* +@sp 1 + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +@* + $ msinfo=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +@* + $ load_opts= +@* + $ test -n "$msinfo" && load_opts="-M /dev/sr0 -C $msinfo" +@* + $ xorrisofs $load_opts -o - @minus{}@minus{}for_backup -m '*.o' -m '*.swp' \ +@* + -V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \ +@* + -old-root / \ +@* + /projects=/home/thomas/projects \ +@* + /personal_mail=/home/thomas/personal_mail \ +@* + | xorriso -as cdrecord dev=/dev/sr0 -v -multi -waiti -eject - +@* +@sp 1 +@c man .sp 1 +This makes sense if the full backup leaves substantial remaining capacity +on media and if the expected changes are much smaller than the full backup. +@* +@sp 1 +@c man .sp 1 +@strong{Better do not use your youngest backup for -old-root}. +Have at least two media which you use alternatingly. So only older backups +get endangered by the new write operation, while the newest backup is +stored safely on a different medium. +@* +Always have a blank medium ready to perform a full backup in case the update +attempt fails due to insufficient remaining capacity. This failure will +not spoil the old medium, of course. +@* +@sp 1 +@c man .sp 1 +If inode numbers on disk are not persistent, then use +option @minus{}@minus{}old-root-no-ino . +In this case an update run will compare recorded MD5 +sums against the current file content on hard disk. +@* +@sp 1 +@c man .sp 1 +With @strong{mount} option @strong{-o "sbsector="} on GNU/Linux +resp. @strong{-s} on FreeBSD +it is possible to access the session trees which represent the older backup +versions. With CD media, GNU/Linux mount accepts session numbers directly by +its option "session=". +@* +Multi-session media and most overwriteable media written by xorriso can tell +the sbsectors of their sessions by xorriso option -toc: +@* +@sp 1 + $ xorriso -dev /dev/sr0 -toc +@* +@sp 1 +xorriso can print the matching mount command for a session number: +@* +@sp 1 + $ xorriso -mount_cmd /dev/sr0 session 12 /mnt +@* +@sp 1 +or for a volume id that matches a search expression: +@* +@sp 1 + $ xorriso -mount_cmd /dev/sr0 volid '*2008_12_05*' /mnt +@* +@sp 1 +Both yield on standard output something like: +@* + mount -t iso9660 -o nodev,noexec,nosuid,ro,sbsector=1460256 '/dev/sr0' '/mnt' +@* +@sp 1 +The superuser may let xorriso execute the mount command directly: +@* +@sp 1 + # osirrox -mount /dev/sr0 "volid" '*2008_12_05*' /mnt +@c man .SS +@c man .B Incremental backup with accumulated trees +@node ExIncBckAcc, ExBootable, ExIncBackup, Examples +@section Incremental backup with accumulated trees +Solaris does not offer the option to mount older sessions. +In order to keep them accessible, one may map all files to a file tree under +a session directory and accumulate those directories from session to session. +The -root tree is cloned from the -old-root tree before it gets +compared with the appropriate trees on disk. +@* +This demands to know the previously used session directory name. +@* +With the first session: +@* +@sp 1 + $ xorrisofs -root /session1 \ +@* + -o - @minus{}@minus{}for_backup -m '*.o' -m '*.swp' \ +@* + -V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \ +@* + /projects=/home/thomas/projects \ +@* + /personal_mail=/home/thomas/personal_mail \ +@* + | xorriso -as cdrecord dev=/dev/sr0 -v blank=as_needed \ +@* + -multi -waiti -eject - +@* +@sp 1 +@c man .sp 1 +With the second session, option -old-root refers to /session1 and the +new -root is /session2. +@* +Do not let xorriso -as cdrecord load the medium, +but rather do this manually or by a program that reads from /dev/sr0. +@* +@sp 1 + $ dd if=/dev/sr0 count=1 >/dev/null 2>&1 +@* + $ msinfo=$(xorriso -as cdrecord dev=/dev/sr0 -msinfo) +@* + $ load_opts= +@* + $ test -n "$msinfo" && load_opts="-M /dev/sr0 -C $msinfo" +@* + $ xorrisofs $load_opts -root /session2 -old-root /session1 \ +@* + -o - @minus{}@minus{}for_backup -m '*.o' -m '*.swp' \ +@* + -V PROJ_MAIL_"$(date '+%Y_%m_%d_%H%M%S')" -graft-points \ +@* + /projects=/home/thomas/projects \ +@* + /personal_mail=/home/thomas/personal_mail \ +@* + | xorriso -as cdrecord dev=/dev/sr0 -v -multi -waiti -eject - +@* +@sp 1 +With the third session, option -old-root refers to /session2. +The new -root is /session3. And so on. +@c man .SS +@c man .B Create bootable images for PC-BIOS +@node ExBootable, , ExIncBckAcc, Examples +@section Create bootable images for PC-BIOS +The ISOLINUX wiki prescribes to create on disk a directory ./CD_root and +to copy all desired files underneath that directory. Especially file +isolinux.bin shall be copied to ./CD_root/isolinux/isolinux.bin . +This is the boot image file. +@* +The prescribed mkisofs options can be used unchanged with @command{xorrisofs}: +@* +@sp 1 + $ xorrisofs -o output.iso \ +@* + -b isolinux/isolinux.bin -c isolinux/boot.cat \ +@* + -no-emul-boot -boot-load-size 4 -boot-info-table \ +@* + ./CD_root +@* +@sp 1 +Put it on CD by a burn program. E.g.: +@* +@sp 1 + $ xorriso -as cdrecord -v dev=/dev/sr0 blank=as_needed output.iso +@* +@sp 1 +@c man .sp 1 +The image from above example will boot from CD, DVD or BD, but not from +USB stick or other hard-disk-like devices. This can be done by help of an +isohybrid MBR. Syslinux provides matching template files +as isohdp[fp]x*.bin . E.g. /usr/lib/syslinux/isohdpfx.bin . +@* +If a few hundred KB of size do not matter, then option -partition_offset +can be used to create a partition table where partition 1 starts not +at block 0. This facilitates later manipulations of the USB stick by +tools for partitioning and formatting. +@* +The image from the following example will be prepared for booting via MBR +and its first parttion will start at hard disk block 64. +@* +It will also boot from optical media. +@* +@sp 1 + $ xorrisofs -o output.iso \ +@* + -b isolinux/isolinux.bin -c isolinux/boot.cat \ +@* + -no-emul-boot -boot-load-size 4 -boot-info-table \ +@* + -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin \ +@* + -partition_offset 16 \ +@* + ./CD_root +@* +@sp 1 +Become superuser and copy the image to the unpartitioned base device file +of the USB stick. On GNU/Linux this is e.g. /dev/sdb, not /dev/sdb1. +@* +CAUTION: +This will overwrite any partitioning on the USB stick and make +remaining data unaccessible. +@* +So first make sure you got the correct address of the intended device. +E.g. by reading 100 MiB data from it and watching it blinking: +@* +@sp 1 + # dd bs=2K if=/dev/sdb count=50K >/dev/null +@* +@sp 1 +Now copy the image onto it +@* +@sp 1 + # dd bs=2K if=output.iso of=/dev/sdb +@* +@sp 1 +@c man .SH FILES +@node Files, Seealso, Examples, Top +@chapter Files +@c man .SS +@c man .B Startup files: +@section Startup Files +@* +If not --no_rc is given as the first argument then @command{xorrisofs} +attempts on startup to read and execute lines from the following files: +@* +@sp 1 + /etc/default/xorriso +@* + /etc/opt/xorriso/rc +@* + /etc/xorriso/xorriso.conf +@* + $HOME/.xorrisorc +@* +@sp 1 +The files are read in the sequence given here, but none of them is required +to exist. The lines are not interpreted as @command{xorrisofs} options but +as generic xorriso commands. See man xorriso. +@c man .PP +After the xorriso startup files, the program tries one by one to open for +reading: +@* +@sp 1 + ./.mkisofsrc +@* + $MKISOFSRC +@* + $HOME/.mkisofsrc +@* + $(dirname $0)/.mkisofsrc +@* +@sp 1 +On success it interprets the file content and does not try further files. +The last address is used only if start argument 0 has a non-trivial dirname. +@* +The reader currently interprets the following NAME=VALUE pairs: +@* +@sp 1 + APPI default for -A +@* + PUBL default for -publisher +@* + SYSI default for -sysid +@* + VOLI default for -V +@* + VOLS default for -volset +@* +@sp 1 +Any other lines will be silently ignored. +@* +@c man .SH SEE ALSO +@c man .TP +@c man For generic xorriso command mode +@c man .BR xorriso(1) +@c man .TP +@c man For the cdrecord emulation of xorriso +@c man .BR xorrecord(1) +@c man .TP +@c man For mounting xorriso generated ISO 9660 images (-t iso9660) +@c man .BR mount(8) +@c man .TP +@c man Other programs which produce ISO 9660 images +@c man .BR mkisofs(8), +@c man .BR genisoimage(8) +@c man .TP +@c man Programs which burn sessions to optical media +@c man .BR growisofs(1), +@c man .BR cdrecord(1), +@c man .BR wodim(1), +@c man .BR cdrskin(1), +@c man .BR xorriso(1) +@c man .TP +@c man ACL and xattr +@c man .BR getfacl(1), +@c man .BR setfacl(1), +@c man .BR getfattr(1), +@c man .BR setfattr(1) +@c man .TP +@c man MD5 checksums +@c man .BR md5sum(1) +@c man .TP +@c man On FreeBSD the commands for xattr and MD5 differ +@c man .BR getextattr(8), +@c man .BR setextattr(8), +@c man .BR md5(1) +@c man-ignore-lines begin +@node Seealso, Bugreport, Files, Top +@chapter See also +@table @asis +@item For generic @command{xorriso} command mode +xorriso(1) +@item For the cdrecord emulation of @command{xorriso} +xorrecord(1) +@item For mounting xorriso generated ISO 9660 images (-t iso9660) +mount(8) +@item Other programs which produce ISO 9660 images +mkisofs(8), +genisoimage(8) +@item Programs which burn sessions to optical media +growisofs(1), +cdrecord(1), +wodim(1), +cdrskin(1), +xorriso(1) +@item ACL and xattr +getfacl(1), +setfacl(1), +getfattr(1), +setfattr(1) +@item MD5 checksums +md5sum(1) +@item On FreeBSD some commands differ: +getextattr(8), +setextattr(8), +md5(1) +@end table +@c man-ignore-lines end +@c man .SH BUGS +@node Bugreport, Legal, Seealso, Top +@chapter Reporting bugs +@cindex Bugs, reporting +@cindex Problems, reporting +To report bugs, request help, or suggest enhancements for @command{xorriso}, +please send electronic mail to the public list @email{bug-xorriso@@gnu.org}. +If more privacy is desired, mail to @email{scdbackup@@gmx.net}. +@* +@sp 1 +Please describe what you expect @command{xorriso} to do, +the program arguments resp. commands by which you tried to achieve it, +the messages of @command{xorriso}, and the undesirable outcome of your +program run. +@* +@sp 1 +Expect to get asked more questions before solutions can be proposed. +@c man .SH AUTHOR +@node Legal, CommandIdx, Bugreport, Top +@chapter Author, Copyright, Credits +@section Author +Thomas Schmitt +@* +for libburnia-project.org +@c man .SH COPYRIGHT +@section Copyright +Copyright (c) 2011 Thomas Schmitt +@* +Permission is granted to distribute this text freely. It shall only be +modified in sync with the technical properties of xorriso. If you make use +of the license to derive modified versions of xorriso then you are entitled +to modify this text under that same license. +@c man .SH CREDITS +@section Credits +@command{xorrisofs} is in part based on work by Vreixo Formoso who provides +libisofs together with Mario Danic who also leads the libburnia team. +@* +Compliments towards Joerg Schilling whose cdrtools served me for ten years. +@c man-ignore-lines begin + +@node CommandIdx, ConceptIdx, Legal, Top +@chapter Alphabetic Command List +@printindex ky + +@node ConceptIdx,, CommandIdx, top +@chapter Alphabetic List of Concepts and Objects +@printindex cp + +@c man-ignore-lines end +@bye